diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2011-10-04 22:01:30 +0200 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2011-10-04 22:01:30 +0200 |
commit | ed169177fbfd1fedb0750f3ba18737aba5596451 (patch) | |
tree | 4410859c72a75d3ca453521b881d0d40456e2749 | |
parent | 168c94858d20f79247aad40daf2c54cd54182565 (diff) | |
download | screen-ed169177fbfd1fedb0750f3ba18737aba5596451.tar.gz |
Imported Upstream version 4.0.3+git201108019upstream/4.0.3+git201108019
-rw-r--r-- | COPYING | 915 | ||||
l--------- | FAQ | 1 | ||||
-rw-r--r-- | Makefile | 3 | ||||
-rw-r--r-- | comm.h.dist | 227 | ||||
-rwxr-xr-x | configure | 9194 | ||||
l--------- | doc/install.sh | 1 | ||||
-rw-r--r-- | doc/screen.info | 198 | ||||
-rw-r--r-- | doc/screen.info-1 | 1447 | ||||
-rw-r--r-- | doc/screen.info-2 | 1171 | ||||
-rw-r--r-- | doc/screen.info-3 | 1255 | ||||
-rw-r--r-- | doc/screen.info-4 | 1411 | ||||
-rw-r--r-- | doc/screen.info-5 | 608 | ||||
-rw-r--r-- | incoming/howto/emulate_vims_help.txt | 52 | ||||
-rw-r--r-- | kmapdef.c.dist | 144 | ||||
-rwxr-xr-x | mktar.pl | 44 | ||||
-rw-r--r-- | patches/bill_pursell_fFtT_402.patch | 201 | ||||
-rw-r--r-- | patches/screen-4.0.2.dif | 29 | ||||
-rw-r--r-- | patches/screen-__P.diff | 10 | ||||
-rw-r--r-- | patches/screen-gcc4.diff | 44 | ||||
-rw-r--r-- | src/.gitignore | 21 | ||||
-rw-r--r-- | src/.iscreenrc | 169 | ||||
-rw-r--r-- | src/COPYING | 674 | ||||
-rw-r--r-- | src/ChangeLog (renamed from ChangeLog) | 121 | ||||
-rw-r--r-- | src/FAQ (renamed from doc/FAQ) | 0 | ||||
-rw-r--r-- | src/HACKING | 39 | ||||
-rw-r--r-- | src/INSTALL (renamed from INSTALL) | 5 | ||||
-rw-r--r-- | src/Makefile.in (renamed from Makefile.in) | 107 | ||||
-rw-r--r-- | src/NEWS (renamed from NEWS) | 14 | ||||
-rw-r--r-- | src/NEWS.3.5 (renamed from NEWS.3.5) | 2 | ||||
-rw-r--r-- | src/NEWS.3.6 (renamed from NEWS.3.6) | 0 | ||||
-rw-r--r-- | src/NEWS.3.7 (renamed from NEWS.3.7) | 0 | ||||
-rw-r--r-- | src/NEWS.3.9 (renamed from NEWS.3.9) | 0 | ||||
-rw-r--r-- | src/README (renamed from README) | 0 | ||||
-rw-r--r-- | src/TODO (renamed from TODO) | 0 | ||||
-rw-r--r-- | src/acconfig.h (renamed from config.h.in) | 123 | ||||
-rw-r--r-- | src/acls.c (renamed from acls.c) | 20 | ||||
-rw-r--r-- | src/acls.h (renamed from acls.h) | 15 | ||||
-rw-r--r-- | src/ansi.c (renamed from ansi.c) | 1106 | ||||
-rw-r--r-- | src/ansi.h (renamed from ansi.h) | 17 | ||||
-rw-r--r-- | src/attacher.c (renamed from attacher.c) | 152 | ||||
-rwxr-xr-x | src/autogen.sh | 2 | ||||
-rw-r--r-- | src/braille.c (renamed from braille.c) | 10 | ||||
-rw-r--r-- | src/braille.h (renamed from braille.h) | 10 | ||||
-rw-r--r-- | src/braille_tsi.c (renamed from braille_tsi.c) | 8 | ||||
-rw-r--r-- | src/canvas.c | 916 | ||||
-rw-r--r-- | src/canvas.h | 101 | ||||
-rw-r--r-- | src/comm.c (renamed from comm.c) | 65 | ||||
-rw-r--r-- | src/comm.sh (renamed from comm.sh) | 6 | ||||
-rw-r--r-- | src/configure.in (renamed from configure.in) | 179 | ||||
-rw-r--r-- | src/display.c (renamed from display.c) | 798 | ||||
-rw-r--r-- | src/display.h (renamed from display.h) | 89 | ||||
-rw-r--r-- | src/doc/.gitignore | 2 | ||||
-rw-r--r-- | src/doc/FAQ | 253 | ||||
-rw-r--r-- | src/doc/Makefile.in (renamed from doc/Makefile.in) | 1 | ||||
-rw-r--r-- | src/doc/README.DOTSCREEN (renamed from doc/README.DOTSCREEN) | 0 | ||||
-rw-r--r-- | src/doc/fdpat.ps (renamed from doc/fdpat.ps) | 0 | ||||
-rwxr-xr-x | src/doc/install.sh (renamed from install.sh) | 0 | ||||
-rw-r--r-- | src/doc/make.help (renamed from doc/make.help) | 0 | ||||
-rw-r--r-- | src/doc/screen.1 (renamed from doc/screen.1) | 617 | ||||
-rw-r--r-- | src/doc/screen.texinfo (renamed from doc/screen.texinfo) | 1039 | ||||
-rw-r--r-- | src/doc/window_to_display.ps (renamed from doc/window_to_display.ps) | 0 | ||||
-rw-r--r-- | src/encoding.c (renamed from encoding.c) | 244 | ||||
-rwxr-xr-x | src/etc/ccdefs (renamed from etc/ccdefs) | 0 | ||||
-rw-r--r-- | src/etc/completer.zsh (renamed from etc/completer.zsh) | 0 | ||||
-rwxr-xr-x | src/etc/countmail (renamed from etc/countmail) | 0 | ||||
-rw-r--r-- | src/etc/etcscreenrc (renamed from etc/etcscreenrc) | 0 | ||||
-rw-r--r-- | src/etc/gr-braille.tbl (renamed from etc/gr-braille.tbl) | 0 | ||||
-rw-r--r-- | src/etc/gs-braille.tbl (renamed from etc/gs-braille.tbl) | 0 | ||||
-rwxr-xr-x | src/etc/mkinstalldirs (renamed from etc/mkinstalldirs) | 0 | ||||
-rwxr-xr-x | src/etc/newsyntax (renamed from etc/newsyntax) | 0 | ||||
-rwxr-xr-x | src/etc/newsyntax38 (renamed from etc/newsyntax38) | 0 | ||||
-rw-r--r-- | src/etc/screenrc (renamed from etc/screenrc) | 0 | ||||
-rwxr-xr-x | src/etc/toolcheck (renamed from etc/toolcheck) | 0 | ||||
-rw-r--r-- | src/etc/us-braille.tbl (renamed from etc/us-braille.tbl) | 0 | ||||
-rw-r--r-- | src/extern.h (renamed from extern.h) | 63 | ||||
-rw-r--r-- | src/fileio.c (renamed from fileio.c) | 110 | ||||
-rw-r--r-- | src/help.c (renamed from help.c) | 833 | ||||
-rw-r--r-- | src/image.h (renamed from image.h) | 26 | ||||
-rw-r--r-- | src/input.c (renamed from input.c) | 252 | ||||
-rwxr-xr-x | src/install.sh | 119 | ||||
-rw-r--r-- | src/layer.c (renamed from layer.c) | 381 | ||||
-rw-r--r-- | src/layer.h (renamed from layer.h) | 72 | ||||
-rw-r--r-- | src/layout.c | 406 | ||||
-rw-r--r-- | src/layout.h | 60 | ||||
-rw-r--r-- | src/list_display.c | 243 | ||||
-rw-r--r-- | src/list_generic.c | 486 | ||||
-rw-r--r-- | src/list_generic.h | 73 | ||||
-rw-r--r-- | src/list_window.c | 710 | ||||
-rw-r--r-- | src/loadav.c (renamed from loadav.c) | 15 | ||||
-rw-r--r-- | src/logfile.c (renamed from logfile.c) | 15 | ||||
-rw-r--r-- | src/logfile.h (renamed from logfile.h) | 17 | ||||
-rw-r--r-- | src/mark.c (renamed from mark.c) | 202 | ||||
-rw-r--r-- | src/mark.h (renamed from mark.h) | 21 | ||||
-rw-r--r-- | src/misc.c (renamed from misc.c) | 65 | ||||
-rw-r--r-- | src/nethack.c (renamed from nethack.c) | 19 | ||||
-rw-r--r-- | src/os.h (renamed from os.h) | 56 | ||||
-rw-r--r-- | src/osdef.h.in (renamed from osdef.h.in) | 17 | ||||
-rw-r--r-- | src/osdef.sh (renamed from osdef.sh) | 0 | ||||
-rw-r--r-- | src/patchlevel.h (renamed from patchlevel.h) | 34 | ||||
-rw-r--r-- | src/process.c (renamed from process.c) | 2079 | ||||
-rw-r--r-- | src/pty.c (renamed from pty.c) | 17 | ||||
-rw-r--r-- | src/putenv.c (renamed from putenv.c) | 15 | ||||
-rw-r--r-- | src/resize.c (renamed from resize.c) | 348 | ||||
-rw-r--r-- | src/sched.c (renamed from sched.c) | 15 | ||||
-rw-r--r-- | src/sched.h (renamed from sched.h) | 17 | ||||
-rw-r--r-- | src/screen.c (renamed from screen.c) | 627 | ||||
-rw-r--r-- | src/screen.h (renamed from screen.h) | 40 | ||||
-rw-r--r-- | src/search.c (renamed from search.c) | 19 | ||||
-rw-r--r-- | src/socket.c (renamed from socket.c) | 662 | ||||
-rw-r--r-- | src/teln.c (renamed from teln.c) | 36 | ||||
-rw-r--r-- | src/term.c (renamed from term.c) | 21 | ||||
-rw-r--r-- | src/term.sh (renamed from term.sh) | 0 | ||||
-rw-r--r-- | src/termcap.c (renamed from termcap.c) | 44 | ||||
-rw-r--r-- | src/terminfo/8bits (renamed from terminfo/8bits) | 0 | ||||
-rw-r--r-- | src/terminfo/README (renamed from terminfo/README) | 0 | ||||
-rw-r--r-- | src/terminfo/checktc.c (renamed from terminfo/checktc.c) | 0 | ||||
-rw-r--r-- | src/terminfo/screencap (renamed from terminfo/screencap) | 0 | ||||
-rw-r--r-- | src/terminfo/screeninfo.src (renamed from terminfo/screeninfo.src) | 9 | ||||
-rw-r--r-- | src/terminfo/test.txt (renamed from terminfo/test.txt) | 0 | ||||
-rw-r--r-- | src/terminfo/tetris.c (renamed from terminfo/tetris.c) | 0 | ||||
-rw-r--r-- | src/tty.sh (renamed from tty.sh) | 25 | ||||
-rw-r--r-- | src/utf8encodings/01 (renamed from utf8encodings/01) | bin | 29808 -> 29808 bytes | |||
-rw-r--r-- | src/utf8encodings/02 (renamed from utf8encodings/02) | bin | 27550 -> 27550 bytes | |||
-rw-r--r-- | src/utf8encodings/03 (renamed from utf8encodings/03) | bin | 32926 -> 32926 bytes | |||
-rw-r--r-- | src/utf8encodings/04 (renamed from utf8encodings/04) | bin | 24302 -> 24302 bytes | |||
-rw-r--r-- | src/utf8encodings/18 (renamed from utf8encodings/18) | bin | 54862 -> 54862 bytes | |||
-rw-r--r-- | src/utf8encodings/19 (renamed from utf8encodings/19) | bin | 95776 -> 95776 bytes | |||
-rw-r--r-- | src/utf8encodings/a1 (renamed from utf8encodings/a1) | bin | 536 -> 536 bytes | |||
-rw-r--r-- | src/utf8encodings/bf (renamed from utf8encodings/bf) | bin | 232 -> 232 bytes | |||
-rw-r--r-- | src/utf8encodings/c2 (renamed from utf8encodings/c2) | bin | 256 -> 256 bytes | |||
-rw-r--r-- | src/utf8encodings/c3 (renamed from utf8encodings/c3) | bin | 140 -> 140 bytes | |||
-rw-r--r-- | src/utf8encodings/c4 (renamed from utf8encodings/c4) | bin | 228 -> 228 bytes | |||
-rw-r--r-- | src/utf8encodings/c6 (renamed from utf8encodings/c6) | bin | 68 -> 68 bytes | |||
-rw-r--r-- | src/utf8encodings/c7 (renamed from utf8encodings/c7) | bin | 52 -> 52 bytes | |||
-rw-r--r-- | src/utf8encodings/c8 (renamed from utf8encodings/c8) | bin | 40 -> 40 bytes | |||
-rw-r--r-- | src/utf8encodings/cc (renamed from utf8encodings/cc) | bin | 68 -> 68 bytes | |||
-rw-r--r-- | src/utf8encodings/cd (renamed from utf8encodings/cd) | bin | 52 -> 52 bytes | |||
-rw-r--r-- | src/utf8encodings/d6 (renamed from utf8encodings/d6) | bin | 212 -> 212 bytes | |||
-rw-r--r-- | src/utmp.c (renamed from utmp.c) | 35 | ||||
-rw-r--r-- | src/viewport.c | 140 | ||||
-rw-r--r-- | src/viewport.h | 51 | ||||
-rw-r--r-- | src/window.c (renamed from window.c) | 195 | ||||
-rw-r--r-- | src/window.h (renamed from window.h) | 78 | ||||
-rw-r--r-- | term.h.dist | 252 | ||||
-rw-r--r-- | tty.c.dist | 1887 |
145 files changed, 12773 insertions, 22014 deletions
@@ -1,285 +1,626 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + 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 + Preamble - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to + 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 -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. +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 make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. + 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 give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. +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. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to + + 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. - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or + 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 -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will +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 a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Programs + 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 @@ -287,15 +628,15 @@ free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least +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) 19yy <name of author> + Copyright (C) <year> <name of author> - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + 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, @@ -303,37 +644,31 @@ the "copyright" line and a pointer to where the full notice is found. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + 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 is interactive, make it output a short notice like this -when it starts in an interactive mode: + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + <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, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. +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>. @@ -1 +0,0 @@ -doc/FAQ
\ No newline at end of file diff --git a/Makefile b/Makefile deleted file mode 100644 index 06b972a..0000000 --- a/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -install all Makefiles and config: - rm -f config.cache - sh ./configure diff --git a/comm.h.dist b/comm.h.dist deleted file mode 100644 index bdc620e..0000000 --- a/comm.h.dist +++ /dev/null @@ -1,227 +0,0 @@ -/* - * 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 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; -}; - -#define RC_ILLEGAL -1 - -#define RC_ACLADD 0 -#define RC_ACLCHG 1 -#define RC_ACLDEL 2 -#define RC_ACLGRP 3 -#define RC_ACLUMASK 4 -#define RC_ACTIVITY 5 -#define RC_ADDACL 6 -#define RC_ALLPARTIAL 7 -#define RC_ALTSCREEN 8 -#define RC_AT 9 -#define RC_ATTRCOLOR 10 -#define RC_AUTODETACH 11 -#define RC_AUTONUKE 12 -#define RC_BACKTICK 13 -#define RC_BCE 14 -#define RC_BELL 15 -#define RC_BELL_MSG 16 -#define RC_BIND 17 -#define RC_BINDKEY 18 -#define RC_BLANKER 19 -#define RC_BLANKERPRG 20 -#define RC_BREAK 21 -#define RC_BREAKTYPE 22 -#define RC_BUFFERFILE 23 -#define RC_C1 24 -#define RC_CAPTION 25 -#define RC_CHACL 26 -#define RC_CHARSET 27 -#define RC_CHDIR 28 -#define RC_CLEAR 29 -#define RC_COLON 30 -#define RC_COMMAND 31 -#define RC_COMPACTHIST 32 -#define RC_CONSOLE 33 -#define RC_COPY 34 -#define RC_CRLF 35 -#define RC_DEBUG 36 -#define RC_DEFAUTONUKE 37 -#define RC_DEFBCE 38 -#define RC_DEFBREAKTYPE 39 -#define RC_DEFC1 40 -#define RC_DEFCHARSET 41 -#define RC_DEFENCODING 42 -#define RC_DEFESCAPE 43 -#define RC_DEFFLOW 44 -#define RC_DEFGR 45 -#define RC_DEFHSTATUS 46 -#define RC_DEFKANJI 47 -#define RC_DEFLOG 48 -#define RC_DEFLOGIN 49 -#define RC_DEFMODE 50 -#define RC_DEFMONITOR 51 -#define RC_DEFNONBLOCK 52 -#define RC_DEFOBUFLIMIT 53 -#define RC_DEFSCROLLBACK 54 -#define RC_DEFSHELL 55 -#define RC_DEFSILENCE 56 -#define RC_DEFSLOWPASTE 57 -#define RC_DEFUTF8 58 -#define RC_DEFWRAP 59 -#define RC_DEFWRITELOCK 60 -#define RC_DETACH 61 -#define RC_DIGRAPH 62 -#define RC_DINFO 63 -#define RC_DISPLAYS 64 -#define RC_DUMPTERMCAP 65 -#define RC_ECHO 66 -#define RC_ENCODING 67 -#define RC_ESCAPE 68 -#define RC_EVAL 69 -#define RC_EXEC 70 -#define RC_FIT 71 -#define RC_FLOW 72 -#define RC_FOCUS 73 -#define RC_GR 74 -#define RC_HARDCOPY 75 -#define RC_HARDCOPY_APPEND 76 -#define RC_HARDCOPYDIR 77 -#define RC_HARDSTATUS 78 -#define RC_HEIGHT 79 -#define RC_HELP 80 -#define RC_HISTORY 81 -#define RC_HSTATUS 82 -#define RC_IDLE 83 -#define RC_IGNORECASE 84 -#define RC_INFO 85 -#define RC_KANJI 86 -#define RC_KILL 87 -#define RC_LASTMSG 88 -#define RC_LICENSE 89 -#define RC_LOCKSCREEN 90 -#define RC_LOG 91 -#define RC_LOGFILE 92 -#define RC_LOGIN 93 -#define RC_LOGTSTAMP 94 -#define RC_MAPDEFAULT 95 -#define RC_MAPNOTNEXT 96 -#define RC_MAPTIMEOUT 97 -#define RC_MARKKEYS 98 -#define RC_MAXWIN 99 -#define RC_META 100 -#define RC_MONITOR 101 -#define RC_MSGMINWAIT 102 -#define RC_MSGWAIT 103 -#define RC_MULTIUSER 104 -#define RC_NETHACK 105 -#define RC_NEXT 106 -#define RC_NONBLOCK 107 -#define RC_NUMBER 108 -#define RC_OBUFLIMIT 109 -#define RC_ONLY 110 -#define RC_OTHER 111 -#define RC_PARTIAL 112 -#define RC_PASSWORD 113 -#define RC_PASTE 114 -#define RC_PASTEFONT 115 -#define RC_POW_BREAK 116 -#define RC_POW_DETACH 117 -#define RC_POW_DETACH_MSG 118 -#define RC_PREV 119 -#define RC_PRINTCMD 120 -#define RC_PROCESS 121 -#define RC_QUIT 122 -#define RC_READBUF 123 -#define RC_READREG 124 -#define RC_REDISPLAY 125 -#define RC_REGISTER 126 -#define RC_REMOVE 127 -#define RC_REMOVEBUF 128 -#define RC_RESET 129 -#define RC_RESIZE 130 -#define RC_SCREEN 131 -#define RC_SCROLLBACK 132 -#define RC_SELECT 133 -#define RC_SESSIONNAME 134 -#define RC_SETENV 135 -#define RC_SETSID 136 -#define RC_SHELL 137 -#define RC_SHELLTITLE 138 -#define RC_SILENCE 139 -#define RC_SILENCEWAIT 140 -#define RC_SLEEP 141 -#define RC_SLOWPASTE 142 -#define RC_SORENDITION 143 -#define RC_SOURCE 144 -#define RC_SPLIT 145 -#define RC_STARTUP_MESSAGE 146 -#define RC_STUFF 147 -#define RC_SU 148 -#define RC_SUSPEND 149 -#define RC_TERM 150 -#define RC_TERMCAP 151 -#define RC_TERMCAPINFO 152 -#define RC_TERMINFO 153 -#define RC_TIME 154 -#define RC_TITLE 155 -#define RC_UMASK 156 -#define RC_UNSETENV 157 -#define RC_UTF8 158 -#define RC_VBELL 159 -#define RC_VBELL_MSG 160 -#define RC_VBELLWAIT 161 -#define RC_VERBOSE 162 -#define RC_VERSION 163 -#define RC_WALL 164 -#define RC_WIDTH 165 -#define RC_WINDOWLIST 166 -#define RC_WINDOWS 167 -#define RC_WRAP 168 -#define RC_WRITEBUF 169 -#define RC_WRITELOCK 170 -#define RC_XOFF 171 -#define RC_XON 172 -#define RC_ZMODEM 173 -#define RC_ZOMBIE 174 - -#define RC_LAST 174 diff --git a/configure b/configure deleted file mode 100755 index 75675fc..0000000 --- a/configure +++ /dev/null @@ -1,9194 +0,0 @@ -#! /bin/sh -# From configure.in Revision: 1.18 . -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.57. -# -# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -# Free Software Foundation, Inc. -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi - -# Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - - -# Name of the host. -# hostname on some systems (SVR3.2, Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -exec 6>&1 - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_config_libobj_dir=. -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= -SHELL=${CONFIG_SHELL-/bin/sh} - -# Maximum number of lines to put in a shell here document. -# This variable seems obsolete. It should probably be removed, and -# only ac_max_sed_lines should be used. -: ${ac_max_here_lines=38} - -# Identity of this package. -PACKAGE_NAME= -PACKAGE_TARNAME= -PACKAGE_VERSION= -PACKAGE_STRING= -PACKAGE_BUGREPORT= - -ac_unique_file="screen.c" -# Factoring default headers for most tests. -ac_includes_default="\ -#include <stdio.h> -#if HAVE_SYS_TYPES_H -# include <sys/types.h> -#endif -#if HAVE_SYS_STAT_H -# include <sys/stat.h> -#endif -#if STDC_HEADERS -# include <stdlib.h> -# include <stddef.h> -#else -# if HAVE_STDLIB_H -# include <stdlib.h> -# endif -#endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H -# include <memory.h> -# endif -# include <string.h> -#endif -#if HAVE_STRINGS_H -# include <strings.h> -#endif -#if HAVE_INTTYPES_H -# include <inttypes.h> -#else -# if HAVE_STDINT_H -# include <stdint.h> -# endif -#endif -#if HAVE_UNISTD_H -# include <unistd.h> -#endif" - -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS VERSION ac_prefix_program CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP AWK INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA WRITEPATH XTERMPATH LIBOBJS LTLIBOBJS' -ac_subst_files='' - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -libdir='${exec_prefix}/lib' -includedir='${prefix}/include' -oldincludedir='/usr/include' -infodir='${prefix}/info' -mandir='${prefix}/man' - -ac_prev= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_option in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - eval "enable_$ac_feature=no" ;; - - -enable-* | --enable-*) - ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid feature name: $ac_feature" >&2 - { (exit 1); exit 1; }; } - ac_feature=`echo $ac_feature | sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "enable_$ac_feature='$ac_optarg'" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package| sed 's/-/_/g'` - case $ac_option in - *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; - *) ac_optarg=yes ;; - esac - eval "with_$ac_package='$ac_optarg'" ;; - - -without-* | --without-*) - ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid package name: $ac_package" >&2 - { (exit 1); exit 1; }; } - ac_package=`echo $ac_package | sed 's/-/_/g'` - eval "with_$ac_package=no" ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) { echo "$as_me: error: unrecognized option: $ac_option -Try \`$0 --help' for more information." >&2 - { (exit 1); exit 1; }; } - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && - { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 - { (exit 1); exit 1; }; } - ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` - eval "$ac_envvar='$ac_optarg'" - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - { echo "$as_me: error: missing argument to $ac_option" >&2 - { (exit 1); exit 1; }; } -fi - -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* | NONE | '' ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# Be sure to have absolute paths. -for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ - localstatedir libdir includedir oldincludedir infodir mandir -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [\\/$]* | ?:[\\/]* ) ;; - *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 - { (exit 1); exit 1; }; };; - esac -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used." >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then its parent. - ac_confdir=`(dirname "$0") 2>/dev/null || -$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$0" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r $srcdir/$ac_unique_file; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r $srcdir/$ac_unique_file; then - if test "$ac_srcdir_defaulted" = yes; then - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 - { (exit 1); exit 1; }; } - else - { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 - { (exit 1); exit 1; }; } - fi -fi -(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || - { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 - { (exit 1); exit 1; }; } -srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` -ac_env_build_alias_set=${build_alias+set} -ac_env_build_alias_value=$build_alias -ac_cv_env_build_alias_set=${build_alias+set} -ac_cv_env_build_alias_value=$build_alias -ac_env_host_alias_set=${host_alias+set} -ac_env_host_alias_value=$host_alias -ac_cv_env_host_alias_set=${host_alias+set} -ac_cv_env_host_alias_value=$host_alias -ac_env_target_alias_set=${target_alias+set} -ac_env_target_alias_value=$target_alias -ac_cv_env_target_alias_set=${target_alias+set} -ac_cv_env_target_alias_value=$target_alias -ac_env_CC_set=${CC+set} -ac_env_CC_value=$CC -ac_cv_env_CC_set=${CC+set} -ac_cv_env_CC_value=$CC -ac_env_CFLAGS_set=${CFLAGS+set} -ac_env_CFLAGS_value=$CFLAGS -ac_cv_env_CFLAGS_set=${CFLAGS+set} -ac_cv_env_CFLAGS_value=$CFLAGS -ac_env_LDFLAGS_set=${LDFLAGS+set} -ac_env_LDFLAGS_value=$LDFLAGS -ac_cv_env_LDFLAGS_set=${LDFLAGS+set} -ac_cv_env_LDFLAGS_value=$LDFLAGS -ac_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_env_CPPFLAGS_value=$CPPFLAGS -ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} -ac_cv_env_CPPFLAGS_value=$CPPFLAGS -ac_env_CPP_set=${CPP+set} -ac_env_CPP_value=$CPP -ac_cv_env_CPP_set=${CPP+set} -ac_cv_env_CPP_value=$CPP - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures this package to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -_ACEOF - - cat <<_ACEOF -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --datadir=DIR read-only architecture-independent data [PREFIX/share] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --infodir=DIR info documentation [PREFIX/info] - --mandir=DIR man documentation [PREFIX/man] -_ACEOF - - cat <<\_ACEOF -_ACEOF -fi - -if test -n "$ac_init_help"; then - - cat <<\_ACEOF - -Optional Features: - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --disable-socket-dir disable system wide socket-dir and use ~/.screen instead - --enable-pam enable PAM support - --enable-locale use localized month/day names - --enable-telnet enable builtin telnet - --enable-colors256 enable support for 256 colors - --enable-rxvt_osc enable support for rxvt OSC codes - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-socket-dir=path where to put the per-user sockets - --with-pty-mode=mode default mode for ptys - --with-pty-group=group default group for ptys - --with-sys-screenrc=path where to put the global screenrc file - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a - nonstandard directory <lib dir> - CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have - headers in a nonstandard directory <include dir> - CPP C preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -_ACEOF -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - ac_popdir=`pwd` - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d $ac_dir || continue - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` - - cd $ac_dir - # Check for guested configure; otherwise get Cygnus style configure. - if test -f $ac_srcdir/configure.gnu; then - echo - $SHELL $ac_srcdir/configure.gnu --help=recursive - elif test -f $ac_srcdir/configure; then - echo - $SHELL $ac_srcdir/configure --help=recursive - elif test -f $ac_srcdir/configure.ac || - test -f $ac_srcdir/configure.in; then - echo - $ac_configure --help - else - echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd $ac_popdir - done -fi - -test -n "$ac_init_help" && exit 0 -if $ac_init_version; then - cat <<\_ACEOF - -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit 0 -fi -exec 5>config.log -cat >&5 <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by $as_me, which was -generated by GNU Autoconf 2.57. Invocation command line was - - $ $0 $@ - -_ACEOF -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -hostinfo = `(hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - echo "PATH: $as_dir" -done - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_sep= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; - 2) - ac_configure_args1="$ac_configure_args1 '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" - # Get rid of the leading space. - ac_sep=" " - ;; - esac - done -done -$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } -$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - cat <<\_ASBOX -## ---------------- ## -## Cache variables. ## -## ---------------- ## -_ASBOX - echo - # The following way of writing the cache mishandles newlines in values, -{ - (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) - sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; - *) - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} - echo - - cat <<\_ASBOX -## ----------------- ## -## Output variables. ## -## ----------------- ## -_ASBOX - echo - for ac_var in $ac_subst_vars - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - - if test -n "$ac_subst_files"; then - cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## -_ASBOX - echo - for ac_var in $ac_subst_files - do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" - done | sort - echo - fi - - if test -s confdefs.h; then - cat <<\_ASBOX -## ----------- ## -## confdefs.h. ## -## ----------- ## -_ASBOX - echo - sed "/^$/d" confdefs.h | sort - echo - fi - test "$ac_signal" != 0 && - echo "$as_me: caught signal $ac_signal" - echo "$as_me: exit $exit_status" - } >&5 - rm -f core core.* *.core && - rm -rf conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status - ' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -rf conftest* confdefs.h -# AIX cpp loses on an empty file, so make sure it contains at least a newline. -echo >confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer explicitly selected file to automatically selected ones. -if test -z "$CONFIG_SITE"; then - if test "x$prefix" != xNONE; then - CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" - else - CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" - fi -fi -for ac_site_file in $CONFIG_SITE; do - if test -r "$ac_site_file"; then - { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 -echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special - # files actually), so we avoid doing that. - if test -f "$cache_file"; then - { echo "$as_me:$LINENO: loading cache $cache_file" >&5 -echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . $cache_file;; - *) . ./$cache_file;; - esac - fi -else - { echo "$as_me:$LINENO: creating cache $cache_file" >&5 -echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in `(set) 2>&1 | - sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val="\$ac_cv_env_${ac_var}_value" - eval ac_new_val="\$ac_env_${ac_var}_value" - case $ac_old_set,$ac_new_set in - set,) - { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 -echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 -echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 -echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 -echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) - ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 -echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 -echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - - - - - - - - - - - - - - ac_config_headers="$ac_config_headers config.h" - - - -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'` -VERSION="$rev.$vers.$pat" -echo "this is screen version $VERSION" 1>&6 - - -if test "x$prefix" = xNONE; then - echo $ECHO_N "checking for prefix by $ECHO_C" >&6 - # Extract the first word of "screen", so it can be a program name with args. -set dummy screen; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_ac_prefix_program+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $ac_prefix_program in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_prefix_program="$ac_prefix_program" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_prefix_program="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - ;; -esac -fi -ac_prefix_program=$ac_cv_path_ac_prefix_program - -if test -n "$ac_prefix_program"; then - echo "$as_me:$LINENO: result: $ac_prefix_program" >&5 -echo "${ECHO_T}$ac_prefix_program" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - if test -n $ac_prefix_program; then - prefix=`(dirname "$ac_prefix_program") 2>/dev/null || -$as_expr X"$ac_prefix_program" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_prefix_program" : 'X\(//\)[^/]' \| \ - X"$ac_prefix_program" : 'X\(//\)$' \| \ - X"$ac_prefix_program" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_prefix_program" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - prefix=`(dirname "$prefix") 2>/dev/null || -$as_expr X"$prefix" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$prefix" : 'X\(//\)[^/]' \| \ - X"$prefix" : 'X\(//\)$' \| \ - X"$prefix" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$prefix" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - fi -fi - -if test "x$prefix" = xNONE; then - echo $ECHO_N "checking for prefix by $ECHO_C" >&6 - # Extract the first word of "gzip", so it can be a program name with args. -set dummy gzip; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_ac_prefix_program+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $ac_prefix_program in - [\\/]* | ?:[\\/]*) - ac_cv_path_ac_prefix_program="$ac_prefix_program" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_ac_prefix_program="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - ;; -esac -fi -ac_prefix_program=$ac_cv_path_ac_prefix_program - -if test -n "$ac_prefix_program"; then - echo "$as_me:$LINENO: result: $ac_prefix_program" >&5 -echo "${ECHO_T}$ac_prefix_program" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - if test -n $ac_prefix_program; then - prefix=`(dirname "$ac_prefix_program") 2>/dev/null || -$as_expr X"$ac_prefix_program" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_prefix_program" : 'X\(//\)[^/]' \| \ - X"$ac_prefix_program" : 'X\(//\)$' \| \ - X"$ac_prefix_program" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_prefix_program" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - prefix=`(dirname "$prefix") 2>/dev/null || -$as_expr X"$prefix" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$prefix" : 'X\(//\)[^/]' \| \ - X"$prefix" : 'X\(//\)$' \| \ - X"$prefix" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$prefix" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - fi -fi - - -old_CFLAGS="$CFLAGS" -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="gcc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - CC=$ac_ct_CC -else - CC="$ac_cv_prog_CC" -fi - -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_ac_ct_CC+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_ac_ct_CC="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 -echo "${ECHO_T}$ac_ct_CC" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$ac_ct_CC" && break -done - - CC=$ac_ct_CC -fi - -fi - - -test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&5 -echo "$as_me: error: no acceptable C compiler found in \$PATH -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - -# Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 -ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5 - (eval $ac_compiler --version </dev/null >&5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5 - (eval $ac_compiler -v </dev/null >&5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5 - (eval $ac_compiler -V </dev/null >&5) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } - -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -echo "$as_me:$LINENO: checking for C compiler default output" >&5 -echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 -ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 - (eval $ac_link_default) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # Find the output, starting from the most likely. This scheme is -# not robust to junk in `.', hence go to wildcards (a.*) only as a last -# resort. - -# Be careful to initialize this variable, since it used to be cached. -# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. -ac_cv_exeext= -# b.out is created by i960 compilers. -for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) - ;; - conftest.$ac_ext ) - # This is the source file. - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - # FIXME: I believe we export ac_cv_exeext for Libtool, - # but it would be cool to find out if it's true. Does anybody - # maintain Libtool? --akim. - export ac_cv_exeext - break;; - * ) - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: C compiler cannot create executables -See \`config.log' for more details." >&5 -echo "$as_me: error: C compiler cannot create executables -See \`config.log' for more details." >&2;} - { (exit 77); exit 77; }; } -fi - -ac_exeext=$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 - -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether the C compiler works" >&5 -echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 -# FIXME: These cross compiler hacks should be removed for Autoconf 3.0 -# If not cross compiling, check that we can run a simple program. -if test "$cross_compiling" != yes; then - if { ac_try='./$ac_file' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } - fi - fi -fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - -rm -f a.out a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 -echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:$LINENO: result: $cross_compiling" >&5 -echo "${ECHO_T}$cross_compiling" >&6 - -echo "$as_me:$LINENO: checking for suffix of executables" >&5 -echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; - * ) break;; - esac -done -else - { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -echo "$as_me:$LINENO: checking for suffix of object files" >&5 -echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 -if test "${ac_cv_objext+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; then - for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot compute suffix of object files: cannot compile -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 -echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 -if test "${ac_cv_c_compiler_gnu+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_compiler_gnu=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_compiler_gnu=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 -echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 -GCC=`test $ac_compiler_gnu = yes && echo yes` -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -CFLAGS="-g" -echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 -echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_g+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_g=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_prog_cc_g=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 -echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 -if test "${ac_cv_prog_cc_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_prog_cc_stdc=no -ac_save_CC=$CC -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <stdarg.h> -#include <stdio.h> -#include <sys/types.h> -#include <sys/stat.h> -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -# Don't try gcc -ansi; that turns off useful extensions and -# breaks some systems' header files. -# AIX -qlanglvl=ansi -# Ultrix and OSF/1 -std1 -# HP-UX 10.20 and later -Ae -# HP-UX older versions -Aa -D_HPUX_SOURCE -# SVR4 -Xc -D__EXTENSIONS__ -for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_prog_cc_stdc=$ac_arg -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext -done -rm -f conftest.$ac_ext conftest.$ac_objext -CC=$ac_save_CC - -fi - -case "x$ac_cv_prog_cc_stdc" in - x|xno) - echo "$as_me:$LINENO: result: none needed" >&5 -echo "${ECHO_T}none needed" >&6 ;; - *) - echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 -echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 - CC="$CC $ac_cv_prog_cc_stdc" ;; -esac - -# Some people use a C++ compiler to compile C. Since we use `exit', -# in C++ we need to declare it. In case someone uses the same compiler -# for both compiling C and C++ we need to have the C++ compiler decide -# the declaration of exit, since it's the most demanding environment. -cat >conftest.$ac_ext <<_ACEOF -#ifndef __cplusplus - choke me -#endif -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - for ac_declaration in \ - ''\ - '#include <stdlib.h>' \ - 'extern "C" void std::exit (int) throw (); using std::exit;' \ - 'extern "C" void std::exit (int); using std::exit;' \ - 'extern "C" void exit (int) throw ();' \ - 'extern "C" void exit (int);' \ - 'void exit (int);' -do - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <stdlib.h> -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -continue -fi -rm -f conftest.$ac_objext conftest.$ac_ext - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_declaration -int -main () -{ -exit (42); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest.$ac_ext -done -rm -f conftest* -if test -n "$ac_declaration"; then - echo '#ifdef __cplusplus' >>confdefs.h - echo $ac_declaration >>confdefs.h - echo '#endif' >>confdefs.h -fi - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest.$ac_ext -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 -echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if test "${ac_cv_prog_CPP+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - # <limits.h> exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <ac_nonexistent.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6 -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - # <limits.h> exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif - Syntax error -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.$ac_ext - - # OK, works on sane cases. Now check whether non-existent headers - # can be detected and how. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <ac_nonexistent.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - # Broken: success on invalid input. -continue -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.err conftest.$ac_ext -if $ac_preproc_ok; then - : -else - { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&5 -echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -echo "$as_me:$LINENO: checking for egrep" >&5 -echo $ECHO_N "checking for egrep... $ECHO_C" >&6 -if test "${ac_cv_prog_egrep+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if echo a | (grep -E '(a|b)') >/dev/null 2>&1 - then ac_cv_prog_egrep='grep -E' - else ac_cv_prog_egrep='egrep' - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep - - -if test $ac_cv_c_compiler_gnu = yes; then - echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5 -echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 -if test "${ac_cv_prog_gcc_traditional+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_pattern="Autoconf.*'x'" - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <sgtty.h> -Autoconf TIOCGETP -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1; then - ac_cv_prog_gcc_traditional=yes -else - ac_cv_prog_gcc_traditional=no -fi -rm -f conftest* - - - if test $ac_cv_prog_gcc_traditional = no; then - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <termio.h> -Autoconf TCGETA -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "$ac_pattern" >/dev/null 2>&1; then - ac_cv_prog_gcc_traditional=yes -fi -rm -f conftest* - - fi -fi -echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 -echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 - if test $ac_cv_prog_gcc_traditional = yes; then - CC="$CC -traditional" - fi -fi - -echo "$as_me:$LINENO: checking for library containing strerror" >&5 -echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6 -if test "${ac_cv_search_strerror+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_func_search_save_LIBS=$LIBS -ac_cv_search_strerror=no -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char strerror (); -int -main () -{ -strerror (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_strerror="none required" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -if test "$ac_cv_search_strerror" = no; then - for ac_lib in cposix; do - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char strerror (); -int -main () -{ -strerror (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_strerror="-l$ac_lib" -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - done -fi -LIBS=$ac_func_search_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5 -echo "${ECHO_T}$ac_cv_search_strerror" >&6 -if test "$ac_cv_search_strerror" != no; then - test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS" - -fi - - -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -main(){exit(0);} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) - -if test $CC != cc ; then -echo "Your $CC failed - restarting with CC=cc" 1>&6 - -echo "" 1>&6 - -CC=cc -export CC -exec $0 $configure_args -fi - -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -main(){exit(0);} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -exec 5>&2 -eval $ac_link -echo "CC=$CC; CFLAGS=$CFLAGS; LIBS=$LIBS;" 1>&6 - -echo "$ac_compile" 1>&6 - -{ { echo "$as_me:$LINENO: error: Can't run the compiler - sorry" >&5 -echo "$as_me: error: Can't run the compiler - sorry" >&2;} - { (exit 1); exit 1; }; } -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -main() -{ - int __something_strange_(); - __something_strange_(0); -} - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - { { echo "$as_me:$LINENO: error: Your compiler does not set the exit status - sorry" >&5 -echo "$as_me: error: Your compiler does not set the exit status - sorry" >&2;} - { (exit 1); exit 1; }; } -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_prog_AWK+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_prog_AWK="$ac_prog" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - echo "$as_me:$LINENO: result: $AWK" >&5 -echo "${ECHO_T}$AWK" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - test -n "$AWK" && break -done - - -ac_aux_dir= -for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do - if test -f $ac_dir/install-sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f $ac_dir/install.sh; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f $ac_dir/shtool; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 -echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} - { (exit 1); exit 1; }; } -fi -ac_config_guess="$SHELL $ac_aux_dir/config.guess" -ac_config_sub="$SHELL $ac_aux_dir/config.sub" -ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# ./install, which can be erroneously created by make from ./install.sh. -echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 -echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 -if test -z "$INSTALL"; then -if test "${ac_cv_path_install+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in - ./ | .// | /cC/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - done - done - ;; -esac -done - - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. We don't cache a - # path for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the path is relative. - INSTALL=$ac_install_sh - fi -fi -echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6 - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - - -if test -f etc/toolcheck; then -{ echo "$as_me:$LINENO: checking for buggy tools..." >&5 -echo "$as_me: checking for buggy tools..." >&6;} -sh etc/toolcheck 1>&6 -fi - - - -echo "$as_me:$LINENO: checking if a system-wide socket dir should be used" >&5 -echo $ECHO_N "checking if a system-wide socket dir should be used... $ECHO_C" >&6 -# Check whether --enable-socket-dir or --disable-socket-dir was given. -if test "${enable_socket_dir+set}" = set; then - enableval="$enable_socket_dir" - - echo "$as_me:$LINENO: result: no. ~/.screen will be used instead." >&5 -echo "${ECHO_T}no. ~/.screen will be used instead." >&6 - -else - - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 - echo "$as_me:$LINENO: checking for the socket dir" >&5 -echo $ECHO_N "checking for the socket dir... $ECHO_C" >&6 - SOCKDIR="(eff_uid ? \"/tmp/uscreens\" : \"/tmp/screens\")" - -# Check whether --with-socket-dir or --without-socket-dir was given. -if test "${with_socket_dir+set}" = set; then - withval="$with_socket_dir" - SOCKDIR="\"${withval}\"" -fi; - echo "$as_me:$LINENO: result: ${SOCKDIR}" >&5 -echo "${ECHO_T}${SOCKDIR}" >&6 - cat >>confdefs.h <<_ACEOF -#define SOCKDIR $SOCKDIR -_ACEOF - - - -fi; - - -if test -n "$ISC"; then - cat >>confdefs.h <<\_ACEOF -#define ISC 1 -_ACEOF - LIBS="$LIBS -linet" -fi - - -if test -f /sysV68 ; then -cat >>confdefs.h <<\_ACEOF -#define sysV68 1 -_ACEOF - -fi - -{ echo "$as_me:$LINENO: checking for MIPS..." >&5 -echo "$as_me: checking for MIPS..." >&6;} -if test -f /lib/libmld.a || test -f /usr/lib/libmld.a || test -f /usr/lib/cmplrs/cc/libmld.a; then -oldlibs="$LIBS" -test -f /bin/mx || LIBS="$LIBS -lmld" # for nlist. But not on alpha. -{ echo "$as_me:$LINENO: checking mld library..." >&5 -echo "$as_me: checking mld library..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -LIBS="$oldlibs" -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -if test -r /dev/ptc; then -cat >>confdefs.h <<\_ACEOF -#define MIPS 1 -_ACEOF - -{ echo "$as_me:$LINENO: checking wait3..." >&5 -echo "$as_me: checking wait3..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -wait3(); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ echo "$as_me:$LINENO: checking wait2..." >&5 -echo "$as_me: checking wait2..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -wait2(); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define USE_WAIT2 1 -_ACEOF - LIBS="$LIBS -lbsd" ; CC="$CC -I/usr/include/bsd" - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -fi - - -{ echo "$as_me:$LINENO: checking for Ultrix..." >&5 -echo "$as_me: checking for Ultrix..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#if defined(ultrix) || defined(__ultrix) - yes; -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then - ULTRIX=1 -fi -rm -f conftest* - - -if test -f /usr/lib/libpyr.a ; then -oldlibs="$LIBS" -LIBS="$LIBS -lpyr" -{ echo "$as_me:$LINENO: checking Pyramid OSX..." >&5 -echo "$as_me: checking Pyramid OSX..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -open_controlling_pty("") - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define OSX 1 -_ACEOF - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -LIBS="$oldlibs" -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi - -{ echo "$as_me:$LINENO: checking for butterfly..." >&5 -echo "$as_me: checking for butterfly..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#if defined(butterfly) - yes; -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then - butterfly=1 -fi -rm -f conftest* - - -if test -z "$butterfly"; then -if test -n "$ULTRIX"; then - test -z "$GCC" && CC="$CC -YBSD" -fi -{ echo "$as_me:$LINENO: checking for POSIX.1..." >&5 -echo "$as_me: checking for POSIX.1..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <sys/types.h> -#include <unistd.h> -main () { -#ifdef _POSIX_VERSION - yes; -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then - echo "- you have a POSIX system" 1>&6 - cat >>confdefs.h <<\_ACEOF -#define POSIX 1 -_ACEOF - posix=1 -fi -rm -f conftest* - -fi - -{ echo "$as_me:$LINENO: checking for System V..." >&5 -echo "$as_me: checking for System V..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <sys/types.h> -#include <signal.h> -#include <fcntl.h> -int -main () -{ -int x = SIGCHLD | FNDELAY; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -cat >>confdefs.h <<\_ACEOF -#define SYSV 1 -_ACEOF - -fi -rm -f conftest.$ac_objext conftest.$ac_ext - -{ echo "$as_me:$LINENO: checking for sequent/ptx..." >&5 -echo "$as_me: checking for sequent/ptx..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef _SEQUENT_ - yes; -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then - LIBS="$LIBS -lsocket -linet";seqptx=1 -fi -rm -f conftest* - - -oldlibs="$LIBS" -LIBS="$LIBS -lelf" -{ echo "$as_me:$LINENO: checking SVR4..." >&5 -echo "$as_me: checking SVR4..." >&6;} -echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 -if test "${ac_cv_header_stdc+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> -#include <float.h> - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_header_stdc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_header_stdc=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <string.h> - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <stdlib.h> - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then - : -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then - : -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <ctype.h> -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - exit(2); - exit (0); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -ac_cv_header_stdc=no -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -fi -fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6 -if test $ac_cv_header_stdc = yes; then - -cat >>confdefs.h <<\_ACEOF -#define STDC_HEADERS 1 -_ACEOF - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. - - - - - - - - - -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_Header=no" -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <utmpx.h> - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - if test "${ac_cv_header_dwarf_h+set}" = set; then - echo "$as_me:$LINENO: checking for dwarf.h" >&5 -echo $ECHO_N "checking for dwarf.h... $ECHO_C" >&6 -if test "${ac_cv_header_dwarf_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_dwarf_h" >&5 -echo "${ECHO_T}$ac_cv_header_dwarf_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking dwarf.h usability" >&5 -echo $ECHO_N "checking dwarf.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <dwarf.h> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking dwarf.h presence" >&5 -echo $ECHO_N "checking dwarf.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <dwarf.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) - { echo "$as_me:$LINENO: WARNING: dwarf.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: dwarf.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: dwarf.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: dwarf.h: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; - no:yes ) - { echo "$as_me:$LINENO: WARNING: dwarf.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: dwarf.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: dwarf.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: dwarf.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: dwarf.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: dwarf.h: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for dwarf.h" >&5 -echo $ECHO_N "checking for dwarf.h... $ECHO_C" >&6 -if test "${ac_cv_header_dwarf_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_dwarf_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_dwarf_h" >&5 -echo "${ECHO_T}$ac_cv_header_dwarf_h" >&6 - -fi -if test $ac_cv_header_dwarf_h = yes; then - cat >>confdefs.h <<\_ACEOF -#define SVR4 1 -_ACEOF - cat >>confdefs.h <<\_ACEOF -#define BUGGYGETLOGIN 1 -_ACEOF - -else - if test "${ac_cv_header_elf_h+set}" = set; then - echo "$as_me:$LINENO: checking for elf.h" >&5 -echo $ECHO_N "checking for elf.h... $ECHO_C" >&6 -if test "${ac_cv_header_elf_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_elf_h" >&5 -echo "${ECHO_T}$ac_cv_header_elf_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking elf.h usability" >&5 -echo $ECHO_N "checking elf.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <elf.h> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking elf.h presence" >&5 -echo $ECHO_N "checking elf.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <elf.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) - { echo "$as_me:$LINENO: WARNING: elf.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: elf.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: elf.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: elf.h: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; - no:yes ) - { echo "$as_me:$LINENO: WARNING: elf.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: elf.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: elf.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: elf.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: elf.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: elf.h: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for elf.h" >&5 -echo $ECHO_N "checking for elf.h... $ECHO_C" >&6 -if test "${ac_cv_header_elf_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_elf_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_elf_h" >&5 -echo "${ECHO_T}$ac_cv_header_elf_h" >&6 - -fi -if test $ac_cv_header_elf_h = yes; then - cat >>confdefs.h <<\_ACEOF -#define SVR4 1 -_ACEOF - cat >>confdefs.h <<\_ACEOF -#define BUGGYGETLOGIN 1 -_ACEOF - -fi - - -fi - - - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -LIBS="$oldlibs" -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - -{ echo "$as_me:$LINENO: checking for Solaris 2.x..." >&5 -echo "$as_me: checking for Solaris 2.x..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#if defined(SVR4) && defined(sun) - yes -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then - LIBS="$LIBS -lsocket -lnsl -lkstat" -fi -rm -f conftest* - - - - -{ echo "$as_me:$LINENO: checking BSD job jontrol..." >&5 -echo "$as_me: checking BSD job jontrol..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <sys/types.h> -#include <sys/ioctl.h> - -int -main () -{ - -#ifdef POSIX -tcsetpgrp(0, 0); -#else -int x = TIOCSPGRP; -#ifdef SYSV -setpgrp(); -#else -int y = TIOCNOTTY; -#endif -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "- you have jobcontrol" 1>&6 - cat >>confdefs.h <<\_ACEOF -#define BSDJOBS 1 -_ACEOF - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -echo "- you don't have jobcontrol" 1>&6 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - -{ echo "$as_me:$LINENO: checking setreuid..." >&5 -echo "$as_me: checking setreuid..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - -#ifdef __hpux -setresuid(0, 0, 0); -#else -setreuid(0, 0); -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_SETREUID 1 -_ACEOF - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -{ echo "$as_me:$LINENO: checking seteuid..." >&5 -echo "$as_me: checking seteuid..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - -#if defined(linux) || defined(NeXT) || defined(_AUX_SOURCE) || defined(AUX) || defined(ultrix) || (defined(sun) && defined(SVR4)) || defined(ISC) || defined(sony_news) -seteuid_is_broken(0); -#else -seteuid(0); -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_SETEUID 1 -_ACEOF - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - - -{ echo "$as_me:$LINENO: checking select..." >&5 -echo "$as_me: checking select..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -select(0, 0, 0, 0, 0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -LIBS="$LIBS -lnet -lnsl" -{ echo "$as_me:$LINENO: checking select with $LIBS..." >&5 -echo "$as_me: checking select with $LIBS..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -select(0, 0, 0, 0, 0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: !!! no select - no screen" >&5 -echo "$as_me: error: !!! no select - no screen" >&2;} - { (exit 1); exit 1; }; } -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - -{ echo "$as_me:$LINENO: checking fifos..." >&5 -echo "$as_me: checking fifos..." >&6;} -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> - -#ifndef O_NONBLOCK -#define O_NONBLOCK O_NDELAY -#endif -#ifndef S_IFIFO -#define S_IFIFO 0010000 -#endif - -char *fin = "/tmp/conftest$$"; - -main() -{ - struct stat stb; -#ifdef FD_SET - fd_set f; -#else - int f; -#endif - - (void)alarm(5); -#ifdef POSIX - if (mkfifo(fin, 0777)) -#else - if (mknod(fin, S_IFIFO|0777, 0)) -#endif - exit(1); - if (stat(fin, &stb) || (stb.st_mode & S_IFIFO) != S_IFIFO) - exit(1); - close(0); -#ifdef __386BSD__ - /* - * The next test fails under 386BSD, but screen works using fifos. - * Fifos in O_RDWR mode are only used for the BROKEN_PIPE case and for - * the select() configuration test. - */ - exit(0); -#endif - if (open(fin, O_RDONLY | O_NONBLOCK)) - exit(1); - if (fork() == 0) - { - close(0); - if (open(fin, O_WRONLY | O_NONBLOCK)) - exit(1); - close(0); - if (open(fin, O_WRONLY | O_NONBLOCK)) - exit(1); - if (write(0, "TEST", 4) == -1) - exit(1); - exit(0); - } -#ifdef FD_SET - FD_SET(0, &f); -#else - f = 1; -#endif - if (select(1, &f, 0, 0, 0) == -1) - exit(1); - exit(0); -} - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "- your fifos are usable" 1>&6 - fifo=1 -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -echo "- your fifos are not usable" 1>&6 - -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -rm -f /tmp/conftest* - -if test -n "$fifo"; then -{ echo "$as_me:$LINENO: checking for broken fifo implementation..." >&5 -echo "$as_me: checking for broken fifo implementation..." >&6;} -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include <sys/types.h> -#include <fcntl.h> -#include <sys/time.h> -#include <sys/stat.h> - -#ifndef O_NONBLOCK -#define O_NONBLOCK O_NDELAY -#endif -#ifndef S_IFIFO -#define S_IFIFO 0010000 -#endif - -char *fin = "/tmp/conftest$$"; - -main() -{ - struct timeval tv; -#ifdef FD_SET - fd_set f; -#else - int f; -#endif - -#ifdef POSIX - if (mkfifo(fin, 0600)) -#else - if (mknod(fin, S_IFIFO|0600, 0)) -#endif - exit(1); - close(0); - if (open(fin, O_RDONLY|O_NONBLOCK)) - exit(1); -#ifdef FD_SET - FD_SET(0, &f); -#else - f = 1; -#endif - tv.tv_sec = 1; - tv.tv_usec = 0; - if (select(1, &f, 0, 0, &tv)) - exit(1); - exit(0); -} - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "- your implementation is ok" 1>&6 - -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -echo "- you have a broken implementation" 1>&6 - cat >>confdefs.h <<\_ACEOF -#define BROKEN_PIPE 1 -_ACEOF - fifobr=1 -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -rm -f /tmp/conftest* -fi - - -{ echo "$as_me:$LINENO: checking sockets..." >&5 -echo "$as_me: checking sockets..." >&6;} -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/un.h> -#include <fcntl.h> - -char *son = "/tmp/conftest$$"; - -main() -{ - int s1, s2, l; - struct sockaddr_un a; -#ifdef FD_SET - fd_set f; -#else - int f; -#endif - - (void)alarm(5); - if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) - exit(1); - a.sun_family = AF_UNIX; - strcpy(a.sun_path, son); - (void) unlink(son); - if (bind(s1, (struct sockaddr *) &a, strlen(son)+2) == -1) - exit(1); - if (listen(s1, 2)) - exit(1); - if (fork() == 0) - { - if ((s2 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) - kill(getppid(), 3); - (void)connect(s2, (struct sockaddr *)&a, strlen(son) + 2); - if (write(s2, "HELLO", 5) == -1) - kill(getppid(), 3); - exit(0); - } - l = sizeof(a); - close(0); - if (accept(s1, &a, &l)) - exit(1); -#ifdef FD_SET - FD_SET(0, &f); -#else - f = 1; -#endif - if (select(1, &f, 0, 0, 0) == -1) - exit(1); - exit(0); -} - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "- your sockets are usable" 1>&6 - sock=1 -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -echo "- your sockets are not usable" 1>&6 - -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -rm -f /tmp/conftest* - -if test -n "$sock"; then -{ echo "$as_me:$LINENO: checking socket implementation..." >&5 -echo "$as_me: checking socket implementation..." >&6;} -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <sys/socket.h> -#include <sys/un.h> - -char *son = "/tmp/conftest$$"; - -main() -{ - int s; - struct stat stb; - struct sockaddr_un a; - if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) - exit(0); - a.sun_family = AF_UNIX; - strcpy(a.sun_path, son); - (void) unlink(son); - if (bind(s, (struct sockaddr *) &a, strlen(son)+2) == -1) - exit(0); - if (stat(son, &stb)) - exit(1); - close(s); - exit(0); -} - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "- you are normal" 1>&6 - -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -echo "- unix domain sockets are not kept in the filesystem" 1>&6 - -cat >>confdefs.h <<\_ACEOF -#define SOCK_NOT_IN_FS 1 -_ACEOF - socknofs=1 -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -rm -f /tmp/conftest* -fi - - -if test -n "$fifo"; then - if test -n "$sock"; then - if test -n "$nore"; then - echo "- hmmm... better take the fifos" 1>&6 - - cat >>confdefs.h <<\_ACEOF -#define NAMEDPIPE 1 -_ACEOF - - elif test -n "$fifobr"; then - echo "- as your fifos are broken lets use the sockets." 1>&6 - - else - echo "- both sockets and fifos usable. let's take fifos." 1>&6 - - cat >>confdefs.h <<\_ACEOF -#define NAMEDPIPE 1 -_ACEOF - - fi - else - echo "- using named pipes" 1>&6 - - cat >>confdefs.h <<\_ACEOF -#define NAMEDPIPE 1 -_ACEOF - - fi -elif test -n "$sock"; then - echo "- using unix-domain sockets" 1>&6 - -else - { { echo "$as_me:$LINENO: error: you have neither usable sockets nor usable pipes -> no screen" >&5 -echo "$as_me: error: you have neither usable sockets nor usable pipes -> no screen" >&2;} - { (exit 1); exit 1; }; } -fi - - -{ echo "$as_me:$LINENO: checking select return value..." >&5 -echo "$as_me: checking select return value..." >&6;} -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> - -char *nam = "/tmp/conftest$$"; - -#ifdef NAMEDPIPE - -#ifndef O_NONBLOCK -#define O_NONBLOCK O_NDELAY -#endif -#ifndef S_IFIFO -#define S_IFIFO 0010000 -#endif - - -main() -{ -#ifdef FD_SET - fd_set f; -#else - int f; -#endif - -#ifdef __FreeBSD__ -/* From Andrew A. Chernov (ache@astral.msk.su): - * opening RDWR fifo fails in BSD 4.4, but select return values are - * right. - */ - exit(0); -#endif - (void)alarm(5); -#ifdef POSIX - if (mkfifo(nam, 0777)) -#else - if (mknod(nam, S_IFIFO|0777, 0)) -#endif - exit(1); - close(0); - if (open(nam, O_RDWR | O_NONBLOCK)) - exit(1); - if (write(0, "TEST", 4) == -1) - exit(1); - -#else - -#include <sys/types.h> -#include <sys/socket.h> -#include <sys/un.h> - -main() -{ - int s1, s2, l; - struct sockaddr_un a; -#ifdef FD_SET - fd_set f; -#else - int f; -#endif - - (void)alarm(5); - if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) - exit(1); - a.sun_family = AF_UNIX; - strcpy(a.sun_path, nam); - (void) unlink(nam); - if (bind(s1, (struct sockaddr *) &a, strlen(nam)+2) == -1) - exit(1); - if (listen(s1, 2)) - exit(1); - if (fork() == 0) - { - if ((s2 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) - kill(getppid(), 3); - (void)connect(s2, (struct sockaddr *)&a, strlen(nam) + 2); - if (write(s2, "HELLO", 5) == -1) - kill(getppid(), 3); - exit(0); - } - l = sizeof(a); - close(0); - if (accept(s1, (struct sockaddr *)&a, &l)) - exit(1); -#endif - - -#ifdef FD_SET - FD_SET(0, &f); -#else - f = 1; -#endif - if (select(1, &f, 0, 0, 0) == -1) - exit(1); - if (select(1, &f, &f, 0, 0) != 2) - exit(1); - exit(0); -} - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "- select is ok" 1>&6 - -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -echo "- select can't count" 1>&6 - cat >>confdefs.h <<\_ACEOF -#define SELECT_BROKEN 1 -_ACEOF - -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - -{ echo "$as_me:$LINENO: checking for tgetent..." >&5 -echo "$as_me: checking for tgetent..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -tgetent((char *)0, (char *)0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -olibs="$LIBS" -LIBS="-lcurses $olibs" -{ echo "$as_me:$LINENO: checking libcurses..." >&5 -echo "$as_me: checking libcurses..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - -#ifdef __hpux -__sorry_hpux_libcurses_is_totally_broken_in_10_10(); -#else -tgetent((char *)0, (char *)0); -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -LIBS="-ltermcap $olibs" -{ echo "$as_me:$LINENO: checking libtermcap..." >&5 -echo "$as_me: checking libtermcap..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -tgetent((char *)0, (char *)0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -LIBS="-ltermlib $olibs" -{ echo "$as_me:$LINENO: checking libtermlib..." >&5 -echo "$as_me: checking libtermlib..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -tgetent((char *)0, (char *)0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -LIBS="-lncurses $olibs" -{ echo "$as_me:$LINENO: checking libncurses..." >&5 -echo "$as_me: checking libncurses..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -tgetent((char *)0, (char *)0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { echo "$as_me:$LINENO: error: !!! no tgetent - no screen" >&5 -echo "$as_me: error: !!! no tgetent - no screen" >&2;} - { (exit 1); exit 1; }; } -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -main() -{ - exit(strcmp(tgoto("%p1%d", 0, 1), "1") ? 0 : 1); -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "- you use the termcap database" 1>&6 - -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -echo "- you use the terminfo database" 1>&6 - cat >>confdefs.h <<\_ACEOF -#define TERMINFO 1 -_ACEOF - -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: checking ospeed..." >&5 -echo "$as_me: checking ospeed..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -extern short ospeed; -int -main () -{ -ospeed=5; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -cat >>confdefs.h <<\_ACEOF -#define NEED_OSPEED 1 -_ACEOF - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - -{ echo "$as_me:$LINENO: checking for /dev/ptc..." >&5 -echo "$as_me: checking for /dev/ptc..." >&6;} -if test -r /dev/ptc; then -cat >>confdefs.h <<\_ACEOF -#define HAVE_DEV_PTC 1 -_ACEOF - -fi - -{ echo "$as_me:$LINENO: checking for SVR4 ptys..." >&5 -echo "$as_me: checking for SVR4 ptys..." >&6;} -sysvr4ptys= -if test -c /dev/ptmx ; then -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -ptsname(0);grantpt(0);unlockpt(0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_SVR4_PTYS 1 -_ACEOF - -sysvr4ptys=1 -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi - - -for ac_func in getpt -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - -if test -z "$sysvr4ptys"; then - -for ac_func in openpty -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -else - echo "$as_me:$LINENO: checking for openpty in -lutil" >&5 -echo $ECHO_N "checking for openpty in -lutil... $ECHO_C" >&6 -if test "${ac_cv_lib_util_openpty+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lutil $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char openpty (); -int -main () -{ -openpty (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_util_openpty=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_util_openpty=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_util_openpty" >&5 -echo "${ECHO_T}$ac_cv_lib_util_openpty" >&6 -if test $ac_cv_lib_util_openpty = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_OPENPTY 1 -_ACEOF - LIBS="$LIBS -lutil" -fi - -fi -done - -fi - -{ echo "$as_me:$LINENO: checking for ptyranges..." >&5 -echo "$as_me: checking for ptyranges..." >&6;} -if test -d /dev/ptym ; then -pdir='/dev/ptym' -else -pdir='/dev' -fi -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef M_UNIX - yes; -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then - ptys=`echo /dev/ptyp??` -else - ptys=`echo $pdir/pty??` -fi -rm -f conftest* - -if test "$ptys" != "$pdir/pty??" ; then -p0=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\).$/\1/g' | sort -u | tr -d '\012'` -p1=`echo $ptys | tr ' ' '\012' | sed -e 's/^.*\(.\)$/\1/g' | sort -u | tr -d '\012'` -cat >>confdefs.h <<_ACEOF -#define PTYRANGE0 "$p0" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PTYRANGE1 "$p1" -_ACEOF - -fi - - -# Check whether --with-pty-mode or --without-pty-mode was given. -if test "${with_pty_mode+set}" = set; then - withval="$with_pty_mode" - ptymode="${withval}" -fi; - -# Check whether --with-pty-group or --without-pty-group was given. -if test "${with_pty_group+set}" = set; then - withval="$with_pty_group" - ptygrp="${withval}" -fi; -test -n "$ptymode" || ptymode=0620 -if test -n "$ptygrp" ; then -cat >>confdefs.h <<_ACEOF -#define PTYMODE $ptymode -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PTYGROUP $ptygrp -_ACEOF - -else - -{ echo "$as_me:$LINENO: checking default tty permissions/group..." >&5 -echo "$as_me: checking default tty permissions/group..." >&6;} -rm -f conftest_grp -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <stdio.h> -main() -{ - struct stat sb; - char *x,*ttyname(); - int om, m; - FILE *fp; - - if (!(x = ttyname(0))) exit(1); - if (stat(x, &sb)) exit(1); - om = sb.st_mode; - if (om & 002) exit(0); - m = system("mesg y"); - if (m == -1 || m == 127) exit(1); - if (stat(x, &sb)) exit(1); - m = sb.st_mode; - if (chmod(x, om)) exit(1); - if (m & 002) exit(0); - if (sb.st_gid == getgid()) exit(1); - if (!(fp=fopen("conftest_grp", "w"))) - exit(1); - fprintf(fp, "%d\n", sb.st_gid); - fclose(fp); - exit(0); -} - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - - if test -f conftest_grp; then - ptygrp=`cat conftest_grp` - echo "- pty mode: $ptymode, group: $ptygrp" 1>&6 - - cat >>confdefs.h <<_ACEOF -#define PTYMODE $ptymode -_ACEOF - - cat >>confdefs.h <<_ACEOF -#define PTYGROUP $ptygrp -_ACEOF - - else - echo "- ptys are world accessable" 1>&6 - - fi - -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) - - WRITEPATH='' - XTERMPATH='' - # Extract the first word of "write", so it can be a program name with args. -set dummy write; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_WRITEPATH+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $WRITEPATH in - [\\/]* | ?:[\\/]*) - ac_cv_path_WRITEPATH="$WRITEPATH" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_WRITEPATH="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - ;; -esac -fi -WRITEPATH=$ac_cv_path_WRITEPATH - -if test -n "$WRITEPATH"; then - echo "$as_me:$LINENO: result: $WRITEPATH" >&5 -echo "${ECHO_T}$WRITEPATH" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - # Extract the first word of "xterm", so it can be a program name with args. -set dummy xterm; ac_word=$2 -echo "$as_me:$LINENO: checking for $ac_word" >&5 -echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 -if test "${ac_cv_path_XTERMPATH+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - case $XTERMPATH in - [\\/]* | ?:[\\/]*) - ac_cv_path_XTERMPATH="$XTERMPATH" # Let the user override the test with a path. - ;; - *) - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then - ac_cv_path_XTERMPATH="$as_dir/$ac_word$ac_exec_ext" - echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done -done - - ;; -esac -fi -XTERMPATH=$ac_cv_path_XTERMPATH - -if test -n "$XTERMPATH"; then - echo "$as_me:$LINENO: result: $XTERMPATH" >&5 -echo "${ECHO_T}$XTERMPATH" >&6 -else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi - - found= - if test -n "$WRITEPATH$XTERMPATH"; then - findfollow= - lsfollow= - found=`find $WRITEPATH $XTERMPATH -follow -print 2>/dev/null` - if test -n "$found"; then - findfollow=-follow - lsfollow=L - fi - if test -n "$XTERMPATH"; then - ptygrpn=`ls -l$lsfollow $XTERMPATH | sed -n -e 1p | $AWK '{print $4}'` - if test tty != "$ptygrpn"; then - XTERMPATH= - fi - fi - fi - if test -n "$WRITEPATH$XTERMPATH"; then - found=`find $WRITEPATH $XTERMPATH $findfollow -perm -2000 -print` - if test -n "$found"; then - ptygrp=`ls -ln$lsfollow $found | sed -n -e 1p | $AWK '{print $4}'` - echo "- pty mode: $ptymode, group: $ptygrp" 1>&6 - - cat >>confdefs.h <<_ACEOF -#define PTYMODE $ptymode -_ACEOF - - cat >>confdefs.h <<_ACEOF -#define PTYGROUP $ptygrp -_ACEOF - - else - echo "- ptys are world accessable" 1>&6 - - fi - else - echo "- can't determine - assume ptys are world accessable" 1>&6 - - fi - - -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest_grp -fi - -{ echo "$as_me:$LINENO: checking getutent..." >&5 -echo "$as_me: checking getutent..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include <time.h> /* to get time_t on SCO */ -#include <sys/types.h> -#if defined(SVR4) && !defined(DGUX) -#include <utmpx.h> -#define utmp utmpx -#else -#include <utmp.h> -#endif -#ifdef __hpux -#define pututline _pututline -#endif - -int -main () -{ -int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent(); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define GETUTENT 1 -_ACEOF - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -olibs="$LIBS" -LIBS="$LIBS -lgen" -{ echo "$as_me:$LINENO: checking getutent with -lgen..." >&5 -echo "$as_me: checking getutent with -lgen..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include <time.h> -#include <sys/types.h> -#if defined(SVR4) && !defined(DGUX) -#include <utmpx.h> -#define utmp utmpx -#else -#include <utmp.h> -#endif -#ifdef __hpux -#define pututline _pututline -#endif - -int -main () -{ -int x = DEAD_PROCESS; pututline((struct utmp *)0); getutent(); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define GETUTENT 1 -_ACEOF - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -LIBS="$olibs" -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -{ echo "$as_me:$LINENO: checking ut_host..." >&5 -echo "$as_me: checking ut_host..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include <time.h> -#include <sys/types.h> -#if defined(SVR4) && !defined(DGUX) -#include <utmpx.h> -#define utmp utmpx -#else -#include <utmp.h> -#endif - -int -main () -{ -struct utmp u; u.ut_host[0] = 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define UTHOST 1 -_ACEOF - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest.$ac_ext -if test "${ac_cv_header_utempter_h+set}" = set; then - echo "$as_me:$LINENO: checking for utempter.h" >&5 -echo $ECHO_N "checking for utempter.h... $ECHO_C" >&6 -if test "${ac_cv_header_utempter_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_utempter_h" >&5 -echo "${ECHO_T}$ac_cv_header_utempter_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking utempter.h usability" >&5 -echo $ECHO_N "checking utempter.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <utempter.h> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking utempter.h presence" >&5 -echo $ECHO_N "checking utempter.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <utempter.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) - { echo "$as_me:$LINENO: WARNING: utempter.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: utempter.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: utempter.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: utempter.h: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; - no:yes ) - { echo "$as_me:$LINENO: WARNING: utempter.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: utempter.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: utempter.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: utempter.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: utempter.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: utempter.h: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for utempter.h" >&5 -echo $ECHO_N "checking for utempter.h... $ECHO_C" >&6 -if test "${ac_cv_header_utempter_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_utempter_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_utempter_h" >&5 -echo "${ECHO_T}$ac_cv_header_utempter_h" >&6 - -fi -if test $ac_cv_header_utempter_h = yes; then - have_utempter=yes -else - have_utempter=no -fi - - -if test "$have_utempter" = yes; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_UTEMPTER 1 -_ACEOF - - LIBS="$LIBS -lutempter" -fi - -{ echo "$as_me:$LINENO: checking for libutil(s)..." >&5 -echo "$as_me: checking for libutil(s)..." >&6;} -test -f /usr/lib/libutils.a && LIBS="$LIBS -lutils" -test -f /usr/lib/libutil.a && LIBS="$LIBS -lutil" - -{ echo "$as_me:$LINENO: checking getloadavg..." >&5 -echo "$as_me: checking getloadavg..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -getloadavg((double *)0, 0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define LOADAV_GETLOADAVG 1 -_ACEOF - load=1 -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -if test -f /usr/lib/libkvm.a ; then -olibs="$LIBS" -LIBS="$LIBS -lkvm" -{ echo "$as_me:$LINENO: checking getloadavg with -lkvm..." >&5 -echo "$as_me: checking getloadavg with -lkvm..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -getloadavg((double *)0, 0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define LOADAV_GETLOADAVG 1 -_ACEOF - load=1 -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -LIBS="$olibs" -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - -if test -z "$load" ; then -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#if defined(NeXT) || defined(apollo) || defined(linux) - yes; -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then - load=1 -fi -rm -f conftest* - -fi -if test -z "$load" ; then -{ echo "$as_me:$LINENO: checking for kernelfile..." >&5 -echo "$as_me: checking for kernelfile..." >&6;} -for core in /unix /vmunix /dynix /hp-ux /xelos /dev/ksyms /kernel/unix /kernel/genunix /unicos /mach /netbsd /386bsd /dgux /bsd /stand/vmunix; do - if test -f $core || test -c $core; then - break - fi -done -if test ! -f $core && test ! -c $core ; then - echo "- no kernelfile found" 1>&6 - -else - echo "- using kernelfile '$core'" 1>&6 - - if test -r $core ; then - cat >>confdefs.h <<_ACEOF -#define LOADAV_UNIX "$core" -_ACEOF - - if test "${ac_cv_header_nlist_h+set}" = set; then - echo "$as_me:$LINENO: checking for nlist.h" >&5 -echo $ECHO_N "checking for nlist.h... $ECHO_C" >&6 -if test "${ac_cv_header_nlist_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -fi -echo "$as_me:$LINENO: result: $ac_cv_header_nlist_h" >&5 -echo "${ECHO_T}$ac_cv_header_nlist_h" >&6 -else - # Is the header compilable? -echo "$as_me:$LINENO: checking nlist.h usability" >&5 -echo $ECHO_N "checking nlist.h usability... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -$ac_includes_default -#include <nlist.h> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_header_compiler=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking nlist.h presence" >&5 -echo $ECHO_N "checking nlist.h presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <nlist.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - ac_header_preproc=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_header_preproc=no -fi -rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) - { echo "$as_me:$LINENO: WARNING: nlist.h: accepted by the compiler, rejected by the preprocessor!" >&5 -echo "$as_me: WARNING: nlist.h: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: nlist.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: nlist.h: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; - no:yes ) - { echo "$as_me:$LINENO: WARNING: nlist.h: present but cannot be compiled" >&5 -echo "$as_me: WARNING: nlist.h: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: nlist.h: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: nlist.h: check for missing prerequisite headers?" >&2;} - { echo "$as_me:$LINENO: WARNING: nlist.h: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: nlist.h: proceeding with the preprocessor's result" >&2;} - ( - cat <<\_ASBOX -## ------------------------------------ ## -## Report this to bug-autoconf@gnu.org. ## -## ------------------------------------ ## -_ASBOX - ) | - sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac -echo "$as_me:$LINENO: checking for nlist.h" >&5 -echo $ECHO_N "checking for nlist.h... $ECHO_C" >&6 -if test "${ac_cv_header_nlist_h+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_cv_header_nlist_h=$ac_header_preproc -fi -echo "$as_me:$LINENO: result: $ac_cv_header_nlist_h" >&5 -echo "${ECHO_T}$ac_cv_header_nlist_h" >&6 - -fi -if test $ac_cv_header_nlist_h = yes; then - cat >>confdefs.h <<\_ACEOF -#define NLIST_STRUCT 1 -_ACEOF - - { echo "$as_me:$LINENO: checking n_un in struct nlist..." >&5 -echo "$as_me: checking n_un in struct nlist..." >&6;} - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <nlist.h> -int -main () -{ -struct nlist n; n.n_un.n_name = 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define NLIST_NAME_UNION 1 -_ACEOF - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi - - - - { echo "$as_me:$LINENO: checking for nlist declaration..." >&5 -echo "$as_me: checking for nlist declaration..." >&6;} - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#ifdef NLIST_STRUCT -# include <nlist.h> -#else -# include <a.out.h> -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "nlist(( | )( | )*.*\(|\()" >/dev/null 2>&1; then - cat >>confdefs.h <<\_ACEOF -#define NLIST_DECLARED 1 -_ACEOF - -fi -rm -f conftest* - - - { echo "$as_me:$LINENO: checking for avenrun symbol..." >&5 -echo "$as_me: checking for avenrun symbol..." >&6;} - nlist64= - for av in avenrun _avenrun _Loadavg avenrun _avenrun _Loadavg; do - if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include <sys/types.h> -#ifdef NLIST_STRUCT -#include <nlist.h> -#else -#include <a.out.h> -#endif - -$nlist64 - -struct nlist nl[2]; - -main() -{ -#if !defined(_AUX_SOURCE) && !defined(AUX) -# ifdef NLIST_NAME_UNION - nl[0].n_un.n_name = "$av"; -# else - nl[0].n_name = "$av"; -# endif -#else - strncpy(nl[0].n_name, "$av", sizeof(nl[0].n_name)); -#endif - nlist(LOADAV_UNIX, nl); - if (nl[0].n_value == 0) - exit(1); - exit(0); -} - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - avensym=$av;break -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - if test "$av" = _Loadavg; then - nlist64='#define nlist nlist64' - fi - done - if test -z "$avensym" ; then - echo "- no avenrun symbol found" 1>&6 - - else - echo "- using avenrun symbol '$avensym'" 1>&6 - - cat >>confdefs.h <<_ACEOF -#define LOADAV_AVENRUN "$avensym" -_ACEOF - - if test -n "$nlist64"; then - echo "- used nlist64 to find it" 1>&6 - - cat >>confdefs.h <<\_ACEOF -#define LOADAV_USE_NLIST64 1 -_ACEOF - - fi - load=1 - fi - else - echo "Can't configure the load average display feature" 1>&6 - - echo "because $core is not readable by you." 1>&6 - - echo "To configure the load average display feature" 1>&6 - - echo "re-run configure as root if possible." 1>&6 - - echo "If you are not the system administrator then disregard" 1>&6 - - echo "this warning. You can still use screen without" 1>&6 - - echo "the load average display feature." 1>&6 - - fi -fi -fi - -cat > conftest.c <<EOF -#include "confdefs.h" - -#include <sys/types.h> -#include <sys/param.h> - -_CUT_HERE_ - -#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 - -EOF -eval "$ac_cpp conftest.c 2>&5 | sed -e '1,/_CUT_HERE_/d' -e 's/ //g' > conftest.out" -. ./conftest.out -rm -f conftest* - - -if test -n "$load" ; then cat >>confdefs.h <<\_ACEOF -#define LOADAV 1 -_ACEOF - fi -if test -n "$loadtype" ; then cat >>confdefs.h <<_ACEOF -#define LOADAV_TYPE $loadtype -_ACEOF - fi -if test -n "$loadnum" ; then cat >>confdefs.h <<_ACEOF -#define LOADAV_NUM $loadnum -_ACEOF - fi -if test -n "$loadscale" ; then cat >>confdefs.h <<_ACEOF -#define LOADAV_SCALE $loadscale -_ACEOF - fi - -if test -n "$posix" ; then - -echo "assuming posix signal definition" 1>&6 - -cat >>confdefs.h <<\_ACEOF -#define SIGVOID 1 -_ACEOF - - -else - -{ echo "$as_me:$LINENO: checking return type of signal handlers..." >&5 -echo "$as_me: checking return type of signal handlers..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <sys/types.h> -#include <signal.h> -#ifdef signal -#undef signal -#endif -extern void (*signal ()) (); -int -main () -{ -int i; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define SIGVOID 1 -_ACEOF - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest.$ac_ext -{ echo "$as_me:$LINENO: checking sigset..." >&5 -echo "$as_me: checking sigset..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include <sys/types.h> -#include <signal.h> - -int -main () -{ - -#ifdef SIGVOID -sigset(0, (void (*)())0); -#else -sigset(0, (int (*)())0); -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define USESIGSET 1 -_ACEOF - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -{ echo "$as_me:$LINENO: checking signal implementation..." >&5 -echo "$as_me: checking signal implementation..." >&6;} -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include <sys/types.h> -#include <signal.h> - -#ifndef SIGCLD -#define SIGCLD SIGCHLD -#endif -#ifdef USESIGSET -#define signal sigset -#endif - -int got; - -#ifdef SIGVOID -void -#endif -hand() -{ - got++; -} - -main() -{ - /* on hpux we use sigvec to get bsd signals */ -#ifdef __hpux - (void)signal(SIGCLD, hand); - kill(getpid(), SIGCLD); - kill(getpid(), SIGCLD); - if (got < 2) - exit(1); -#endif - exit(0); -} - -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -cat >>confdefs.h <<\_ACEOF -#define SYSVSIGS 1 -_ACEOF - -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - -fi - - -{ echo "$as_me:$LINENO: checking for crypt and sec libraries..." >&5 -echo "$as_me: checking for crypt and sec libraries..." >&6;} -test -f /lib/libcrypt_d.a || test -f /usr/lib/libcrypt_d.a && LIBS="$LIBS -lcrypt_d" -oldlibs="$LIBS" -LIBS="$LIBS -lcrypt" -{ echo "$as_me:$LINENO: checking crypt..." >&5 -echo "$as_me: checking crypt..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -LIBS="$oldlibs" -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -test -f /lib/libsec.a || test -f /usr/lib/libsec.a && LIBS="$LIBS -lsec" -test -f /lib/libshadow.a || test -f /usr/lib/libshadow.a && LIBS="$LIBS -lshadow" -oldlibs="$LIBS" -LIBS="$LIBS -lsun" -{ echo "$as_me:$LINENO: checking IRIX sun library..." >&5 -echo "$as_me: checking IRIX sun library..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -LIBS="$oldlibs" -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - -{ echo "$as_me:$LINENO: checking syslog..." >&5 -echo "$as_me: checking syslog..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -closelog(); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -oldlibs="$LIBS" -LIBS="$LIBS -lbsd" -{ echo "$as_me:$LINENO: checking syslog in libbsd.a..." >&5 -echo "$as_me: checking syslog in libbsd.a..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -closelog(); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "- found." 1>&6 - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -LIBS="$oldlibs" -echo "- bad news: syslog missing." 1>&6 - cat >>confdefs.h <<\_ACEOF -#define NOSYSLOG 1 -_ACEOF - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#ifdef M_UNIX - yes; -#endif - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "yes" >/dev/null 2>&1; then - LIBS="$LIBS -lsocket -lcrypt_i" -fi -rm -f conftest* - - -{ echo "$as_me:$LINENO: checking wait union..." >&5 -echo "$as_me: checking wait union..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <sys/types.h> -#include <sys/wait.h> - -int -main () -{ - - union wait x; - int y; -#ifdef WEXITSTATUS - y = WEXITSTATUS(x); -#endif - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define BSDWAIT 1 -_ACEOF - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest.$ac_ext - -if test -z "$butterfly"; then -{ echo "$as_me:$LINENO: checking for termio or termios..." >&5 -echo "$as_me: checking for termio or termios..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <termio.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - cat >>confdefs.h <<\_ACEOF -#define TERMIO 1 -_ACEOF - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - if test -n "$posix"; then -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <termios.h> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } >/dev/null; then - if test -s conftest.err; then - ac_cpp_err=$ac_c_preproc_warn_flag - else - ac_cpp_err= - fi -else - ac_cpp_err=yes -fi -if test -z "$ac_cpp_err"; then - cat >>confdefs.h <<\_ACEOF -#define TERMIO 1 -_ACEOF - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - -fi -rm -f conftest.err conftest.$ac_ext -fi - -fi -rm -f conftest.err conftest.$ac_ext -fi - -{ echo "$as_me:$LINENO: checking getspnam..." >&5 -echo "$as_me: checking getspnam..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <shadow.h> -int -main () -{ -getspnam("x"); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define SHADOWPW 1 -_ACEOF - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - -{ echo "$as_me:$LINENO: checking getttyent..." >&5 -echo "$as_me: checking getttyent..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -getttyent(); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define GETTTYENT 1 -_ACEOF - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - -{ echo "$as_me:$LINENO: checking fdwalk..." >&5 -echo "$as_me: checking fdwalk..." >&6;} -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <stdlib.h> -int -main () -{ -fdwalk(NULL, NULL); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define HAVE_FDWALK 1 -_ACEOF - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - -{ echo "$as_me:$LINENO: checking whether memcpy/memmove/bcopy handles overlapping arguments..." >&5 -echo "$as_me: checking whether memcpy/memmove/bcopy handles overlapping arguments..." >&6;} -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -main() { - char buf[10]; - strcpy(buf, "abcdefghi"); - bcopy(buf, buf + 2, 3); - if (strncmp(buf, "ababcf", 6)) - exit(1); - strcpy(buf, "abcdefghi"); - bcopy(buf + 2, buf, 3); - if (strncmp(buf, "cdedef", 6)) - exit(1); - exit(0); /* libc version works properly. */ -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define USEBCOPY 1 -_ACEOF - -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#define bcopy(s,d,l) memmove(d,s,l) -main() { - char buf[10]; - strcpy(buf, "abcdefghi"); - bcopy(buf, buf + 2, 3); - if (strncmp(buf, "ababcf", 6)) - exit(1); - strcpy(buf, "abcdefghi"); - bcopy(buf + 2, buf, 3); - if (strncmp(buf, "cdedef", 6)) - exit(1); - exit(0); /* libc version works properly. */ -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define USEMEMMOVE 1 -_ACEOF - -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - - -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#define bcopy(s,d,l) memcpy(d,s,l) -main() { - char buf[10]; - strcpy(buf, "abcdefghi"); - bcopy(buf, buf + 2, 3); - if (strncmp(buf, "ababcf", 6)) - exit(1); - strcpy(buf, "abcdefghi"); - bcopy(buf + 2, buf, 3); - if (strncmp(buf, "cdedef", 6)) - exit(1); - exit(0); /* libc version works properly. */ -} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cat >>confdefs.h <<\_ACEOF -#define USEMEMCPY 1 -_ACEOF - -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - -echo "$as_me:$LINENO: checking long file names" >&5 -echo $ECHO_N "checking long file names... $ECHO_C" >&6 -(echo 1 > /tmp/conftest9012345) 2>/dev/null -(echo 2 > /tmp/conftest9012346) 2>/dev/null -val=`cat /tmp/conftest9012345 2>/dev/null` -if test -f /tmp/conftest9012345 && test "$val" = 1; then -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -cat >>confdefs.h <<\_ACEOF -#define NAME_MAX 14 -_ACEOF - -fi -rm -f /tmp/conftest* - -echo "$as_me:$LINENO: checking for vsprintf" >&5 -echo $ECHO_N "checking for vsprintf... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -vsprintf(0,0,0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6;cat >>confdefs.h <<\_ACEOF -#define USEVARARGS 1 -_ACEOF - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - - - - - - -ac_header_dirent=no -for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do - as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 -echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <sys/types.h> -#include <$ac_hdr> - -int -main () -{ -if ((DIR *) 0) -return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_Header=no" -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 -_ACEOF - -ac_header_dirent=$ac_hdr; break -fi - -done -# Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. -if test $ac_header_dirent = dirent.h; then - echo "$as_me:$LINENO: checking for library containing opendir" >&5 -echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 -if test "${ac_cv_search_opendir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_func_search_save_LIBS=$LIBS -ac_cv_search_opendir=no -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char opendir (); -int -main () -{ -opendir (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_opendir="none required" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -if test "$ac_cv_search_opendir" = no; then - for ac_lib in dir; do - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char opendir (); -int -main () -{ -opendir (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_opendir="-l$ac_lib" -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - done -fi -LIBS=$ac_func_search_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 -echo "${ECHO_T}$ac_cv_search_opendir" >&6 -if test "$ac_cv_search_opendir" != no; then - test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" - -fi - -else - echo "$as_me:$LINENO: checking for library containing opendir" >&5 -echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6 -if test "${ac_cv_search_opendir+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_func_search_save_LIBS=$LIBS -ac_cv_search_opendir=no -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char opendir (); -int -main () -{ -opendir (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_opendir="none required" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -if test "$ac_cv_search_opendir" = no; then - for ac_lib in x; do - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char opendir (); -int -main () -{ -opendir (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_opendir="-l$ac_lib" -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - done -fi -LIBS=$ac_func_search_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 -echo "${ECHO_T}$ac_cv_search_opendir" >&6 -if test "$ac_cv_search_opendir" != no; then - test "$ac_cv_search_opendir" = "none required" || LIBS="$ac_cv_search_opendir $LIBS" - -fi - -fi - - -echo "$as_me:$LINENO: checking for setenv" >&5 -echo $ECHO_N "checking for setenv... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -setenv((char *)0,(char *)0);unsetenv((char *)0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6;cat >>confdefs.h <<\_ACEOF -#define USESETENV 1 -_ACEOF - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -echo "$as_me:$LINENO: checking for putenv" >&5 -echo $ECHO_N "checking for putenv... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -int -main () -{ -putenv((char *)0);unsetenv((char *)0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6;cat >>confdefs.h <<\_ACEOF -#define NEEDPUTENV 1 -_ACEOF - - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -echo "$as_me:$LINENO: checking for nl_langinfo(CODESET)" >&5 -echo $ECHO_N "checking for nl_langinfo(CODESET)... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -#include <langinfo.h> - -int -main () -{ -nl_langinfo(CODESET); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6;cat >>confdefs.h <<\_ACEOF -#define HAVE_NL_LANGINFO 1 -_ACEOF - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - -echo "$as_me:$LINENO: checking for library containing gethostname" >&5 -echo $ECHO_N "checking for library containing gethostname... $ECHO_C" >&6 -if test "${ac_cv_search_gethostname+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_func_search_save_LIBS=$LIBS -ac_cv_search_gethostname=no -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char gethostname (); -int -main () -{ -gethostname (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_gethostname="none required" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -if test "$ac_cv_search_gethostname" = no; then - for ac_lib in nsl; do - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char gethostname (); -int -main () -{ -gethostname (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_search_gethostname="-l$ac_lib" -break -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - done -fi -LIBS=$ac_func_search_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_search_gethostname" >&5 -echo "${ECHO_T}$ac_cv_search_gethostname" >&6 -if test "$ac_cv_search_gethostname" != no; then - test "$ac_cv_search_gethostname" = "none required" || LIBS="$ac_cv_search_gethostname $LIBS" - -fi - - - - - - - - - - - - - -for ac_func in rename fchmod fchown strerror lstat _exit utimes vsnprintf getcwd setlocale strftime -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer <limits.h> to <assert.h> if __STDC__ is defined, since - <limits.h> exists even on freestanding compilers. */ -#ifdef __STDC__ -# include <limits.h> -#else -# include <assert.h> -#endif -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - -# Check whether --enable-pam or --disable-pam was given. -if test "${enable_pam+set}" = set; then - enableval="$enable_pam" - -fi; -if test "$enable_pam" = "yes"; then - echo "$as_me:$LINENO: checking for PAM support" >&5 -echo $ECHO_N "checking for PAM support... $ECHO_C" >&6 - oldlibs="$LIBS" - LIBS="$LIBS -lpam" - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include <security/pam_appl.h> -int -main () -{ - - pam_start(0, 0, 0, 0); - pam_authenticate(0, 0); - pam_end(0,0); - - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6;cat >>confdefs.h <<\_ACEOF -#define USE_PAM 1 -_ACEOF - -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6;LIBS="$oldlibs" -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi - -# Check whether --enable-use_locale or --disable-use_locale was given. -if test "${enable_use_locale+set}" = set; then - enableval="$enable_use_locale" - -fi; -if test "$enable_use_locale" = "yes"; then - cat >>confdefs.h <<\_ACEOF -#define USE_LOCALE 1 -_ACEOF - -fi -# Check whether --enable-telnet or --disable-telnet was given. -if test "${enable_telnet+set}" = set; then - enableval="$enable_telnet" - -fi; -if test "$enable_telnet" = "yes"; then - cat >>confdefs.h <<\_ACEOF -#define BUILTIN_TELNET 1 -_ACEOF - -fi -# Check whether --enable-colors256 or --disable-colors256 was given. -if test "${enable_colors256+set}" = set; then - enableval="$enable_colors256" - -fi; -if test "$enable_colors256" = "yes"; then - cat >>confdefs.h <<\_ACEOF -#define COLORS256 1 -_ACEOF - -fi -# Check whether --enable-rxvt_osc or --disable-rxvt_osc was given. -if test "${enable_rxvt_osc+set}" = set; then - enableval="$enable_rxvt_osc" - -fi; -if test "$enable_rxvt_osc" = "yes"; then - cat >>confdefs.h <<\_ACEOF -#define RXVT_OSC 1 -_ACEOF - -fi - -if test -z "$old_CFLAGS"; then - if test "x$CFLAGS" = "x-g"; then - CFLAGS="-O" - fi -fi -test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lnsl -lsec -lseq" - -if test "$cross_compiling" = yes; then - { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling -See \`config.log' for more details." >&5 -echo "$as_me: error: cannot run test program while cross compiling -See \`config.log' for more details." >&2;} - { (exit 1); exit 1; }; } -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -main(){exit(0);} -_ACEOF -rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - : -else - echo "$as_me: program exited with status $ac_status" >&5 -echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -( exit $ac_status ) -{ { echo "$as_me:$LINENO: error: Can't run the compiler - internal error. Sorry." >&5 -echo "$as_me: error: Can't run the compiler - internal error. Sorry." >&2;} - { (exit 1); exit 1; }; } -fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext -fi - -ETCSCREENRC="\"/usr/local/etc/screenrc\"" -if test -n "$prefix"; then -ETCSCREENRC="\"$prefix/etc/screenrc\"" -fi -echo "$as_me:$LINENO: checking for the global screenrc file" >&5 -echo $ECHO_N "checking for the global screenrc file... $ECHO_C" >&6 - -# Check whether --with-sys-screenrc or --without-sys-screenrc was given. -if test "${with_sys_screenrc+set}" = set; then - withval="$with_sys_screenrc" - ETCSCREENRC="\"${withval}\"" -fi; -cat >>confdefs.h <<_ACEOF -#define ETCSCREENRC $ETCSCREENRC -_ACEOF - -echo "$as_me:$LINENO: result: $ETCSCREENRC" >&5 -echo "${ECHO_T}$ETCSCREENRC" >&6 - -SCREENENCODINGS="\"/usr/local/lib/screen/utf8encodings\"" -if test -n "$datadir"; then -eval SCREENENCODINGS="$datadir/screen/utf8encodings" -SCREENENCODINGS="\"$SCREENENCODINGS\"" -fi -echo "$as_me:$LINENO: checking for the utf8-encodings location" >&5 -echo $ECHO_N "checking for the utf8-encodings location... $ECHO_C" >&6 -cat >>confdefs.h <<_ACEOF -#define SCREENENCODINGS $SCREENENCODINGS -_ACEOF - -echo "$as_me:$LINENO: result: $SCREENENCODINGS" >&5 -echo "${ECHO_T}$SCREENENCODINGS" >&6 - - ac_config_files="$ac_config_files Makefile doc/Makefile" - ac_config_commands="$ac_config_commands default" -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -{ - (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) - # `set' does not quote correctly, so add quotes (double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \). - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" - ;; - esac; -} | - sed ' - t clear - : clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if diff $cache_file confcache >/dev/null 2>&1; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" - cat confcache >$cache_file - else - echo "not updating unwritable cache $cache_file" - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}' -fi - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - -: ${CONFIG_STATUS=./config.status} -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 -echo "$as_me: creating $CONFIG_STATUS" >&6;} -cat >$CONFIG_STATUS <<_ACEOF -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false -SHELL=\${CONFIG_SHELL-$SHELL} -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -## --------------------- ## -## M4sh Initialization. ## -## --------------------- ## - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' -elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then - set -o posix -fi - -# Support unset when possible. -if (FOO=FOO; unset FOO) >/dev/null 2>&1; then - as_unset=unset -else - as_unset=false -fi - - -# Work around bugs in pre-3.0 UWIN ksh. -$as_unset ENV MAIL MAILPATH -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -for as_var in \ - LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ - LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ - LC_TELEPHONE LC_TIME -do - if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then - eval $as_var=C; export $as_var - else - $as_unset $as_var - fi -done - -# Required to use basename. -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - - -# Name of the executable. -as_me=`$as_basename "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)$' \| \ - . : '\(.\)' 2>/dev/null || -echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } - /^X\/\(\/\/\)$/{ s//\1/; q; } - /^X\/\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - - -# PATH needs CR, and LINENO needs CR and PATH. -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - echo "#! /bin/sh" >conf$$.sh - echo "exit 0" >>conf$$.sh - chmod +x conf$$.sh - if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' - else - PATH_SEPARATOR=: - fi - rm -f conf$$.sh -fi - - - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" || { - # Find who we are. Look in the path if we contain no path at all - # relative or not. - case $0 in - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break -done - - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for as_base in sh bash ksh sh5; do - case $as_dir in - /*) - if ("$as_dir/$as_base" -c ' - as_lineno_1=$LINENO - as_lineno_2=$LINENO - as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` - test "x$as_lineno_1" != "x$as_lineno_2" && - test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then - $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } - $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } - CONFIG_SHELL=$as_dir/$as_base - export CONFIG_SHELL - exec "$CONFIG_SHELL" "$0" ${1+"$@"} - fi;; - esac - done -done -;; - esac - - # Create $as_me.lineno as a copy of $as_myself, but with $LINENO - # uniformly replaced by the line number. The first 'sed' inserts a - # line-number line before each line; the second 'sed' does the real - # work. The second script uses 'N' to pair each line-number line - # with the numbered line, and appends trailing '-' during - # substitution so that $LINENO is not a special case at line end. - # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the - # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) - sed '=' <$as_myself | - sed ' - N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, - t loop - s,-$,, - s,^['$as_cr_digits']*\n,, - ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} - { (exit 1); exit 1; }; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensible to this). - . ./$as_me.lineno - # Exit status is that of the last command. - exit -} - - -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ECHO_T=' ' ;; - *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; - *) ECHO_N= ECHO_C='\c' ECHO_T= ;; -esac - -if expr a : '\(a\)' >/dev/null 2>&1; then - as_expr=expr -else - as_expr=false -fi - -rm -f conf$$ conf$$.exe conf$$.file -echo >conf$$.file -if ln -s conf$$.file conf$$ 2>/dev/null; then - # We could just check for DJGPP; but this test a) works b) is more generic - # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). - if test -f conf$$.exe; then - # Don't use ln at all; we don't have any links - as_ln_s='cp -p' - else - as_ln_s='ln -s' - fi -elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.file - -if mkdir -p . 2>/dev/null; then - as_mkdir_p=: -else - as_mkdir_p=false -fi - -as_executable_p="test -f" - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" - - -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - -exec 6>&1 - -# Open the log real soon, to keep \$[0] and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - -This file was extended by $as_me, which was -generated by GNU Autoconf 2.57. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 -_ACEOF - -# Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi - -cat >>$CONFIG_STATUS <<\_ACEOF - -ac_cs_usage="\ -\`$as_me' instantiates files from templates according to the -current configuration. - -Usage: $0 [OPTIONS] [FILE]... - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to <bug-autoconf@gnu.org>." -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF -ac_cs_version="\\ -config.status -configured by $0, generated by GNU Autoconf 2.57, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" - -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -INSTALL="$INSTALL" -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF -# If no file are specified by the user, then we need to provide default -# value. By we need to know if files were specified by the user. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` - ac_shift=: - ;; - -*) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; - esac - - case $ac_option in - # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - CONFIG_FILES="$CONFIG_FILES $ac_optarg" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" - ac_need_defaults=false;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; } ;; - - *) ac_config_targets="$ac_config_targets $1" ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -if \$ac_cs_recheck; then - echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 - exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion -fi - -_ACEOF - - - - - -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_config_target in $ac_config_targets -do - case "$ac_config_target" in - # Handling of arguments. - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; - "default" ) CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; - "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; - *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 -echo "$as_me: error: invalid argument: $ac_config_target" >&2;} - { (exit 1); exit 1; }; };; - esac -done - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason to put it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Create a temporary directory, and hook for its removal unless debugging. -$debug || -{ - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 - trap '{ (exit 1); exit 1; }' 1 2 13 15 -} - -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && - test -n "$tmp" && test -d "$tmp" -} || -{ - tmp=./confstat$$-$RANDOM - (umask 077 && mkdir $tmp) -} || -{ - echo "$me: cannot create a temporary directory in ." >&2 - { (exit 1); exit 1; } -} - -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF - -# -# CONFIG_FILES section. -# - -# No need to generate the scripts if there are no CONFIG_FILES. -# This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@VERSION@,$VERSION,;t t -s,@ac_prefix_program@,$ac_prefix_program,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t -s,@AWK@,$AWK,;t t -s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t -s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t -s,@INSTALL_DATA@,$INSTALL_DATA,;t t -s,@WRITEPATH@,$WRITEPATH,;t t -s,@XTERMPATH@,$XTERMPATH,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF - -_ACEOF - - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` - - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_builddir$INSTALL ;; - esac - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo $f;; - *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF - sed "$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -s,@INSTALL@,$ac_INSTALL,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi - -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_HEADER section. -# - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t' - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - - test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo $f;; - *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - -_ACEOF - -# Transform confdefs.h into two sed scripts, `conftest.defines' and -# `conftest.undefs', that substitutes the proper values into -# config.h.in to produce config.h. The first handles `#define' -# templates, and the second `#undef' templates. -# And first: Protect against being on the right side of a sed subst in -# config.status. Protect against being in an unquoted here document -# in config.status. -rm -f conftest.defines conftest.undefs -# Using a here document instead of a string reduces the quoting nightmare. -# Putting comments in sed scripts is not portable. -# -# `end' is used to avoid that the second main sed command (meant for -# 0-ary CPP macros) applies to n-ary macro definitions. -# See the Autoconf documentation for `clear'. -cat >confdef2sed.sed <<\_ACEOF -s/[\\&,]/\\&/g -s,[\\$`],\\&,g -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp -t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp -: end -_ACEOF -# If some macros were called several times there might be several times -# the same #defines, which is useless. Nevertheless, we may not want to -# sort them, since we want the *last* AC-DEFINE to be honored. -uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines -sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs -rm -f confdef2sed.sed - -# This sed command replaces #undef with comments. This is necessary, for -# example, in the case of _POSIX_SOURCE, which is predefined and required -# on some systems where configure will not decide to define it. -cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -_ACEOF - -# Break up conftest.defines because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS -echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS -echo ' :' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.defines >/dev/null -do - # Write a limited-size here document to $tmp/defines.sed. - echo ' cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS - # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/defines.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail - rm -f conftest.defines - mv conftest.tail conftest.defines -done -rm -f conftest.defines -echo ' fi # grep' >>$CONFIG_STATUS -echo >>$CONFIG_STATUS - -# Break up conftest.undefs because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #undef templates' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.undefs >/dev/null -do - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS - # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/undefs.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail - rm -f conftest.undefs - mv conftest.tail conftest.undefs -done -rm -f conftest.undefs - -cat >>$CONFIG_STATUS <<\_ACEOF - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - echo "/* Generated by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in - if test x"$ac_file" != x-; then - if diff $ac_file $tmp/config.h >/dev/null 2>&1; then - { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 -echo "$as_me: $ac_file is unchanged" >&6;} - else - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - - rm -f $ac_file - mv $tmp/config.h $ac_file - fi - else - cat $tmp/config.h - rm -f $tmp/config.h - fi -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - -# -# CONFIG_COMMANDS section. -# -for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue - ac_dest=`echo "$ac_file" | sed 's,:.*,,'` - ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_dir=`(dirname "$ac_dest") 2>/dev/null || -$as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_dest" : 'X\(//\)[^/]' \| \ - X"$ac_dest" : 'X\(//\)$' \| \ - X"$ac_dest" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_dest" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - ac_builddir=. - -if test "$ac_dir" != .; then - ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` - # A "../" for each directory in $ac_dir_suffix. - ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` -else - ac_dir_suffix= ac_top_builddir= -fi - -case $srcdir in - .) # No --srcdir option. We are building in place. - ac_srcdir=. - if test -z "$ac_top_builddir"; then - ac_top_srcdir=. - else - ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` - fi ;; - [\\/]* | ?:[\\/]* ) # Absolute path. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir ;; - *) # Relative path. - ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_builddir$srcdir ;; -esac -# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be -# absolute. -ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` -ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd` -ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` -ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` - - - { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 -echo "$as_me: executing $ac_dest commands" >&6;} - case $ac_dest in - default ) -# a hook for preserving undef directive in config.h -mv config.h conftest -sed -e 's@^\(.*\)defin.\( .*\) .*/\*\(.*KEEP_UNDEF_HERE\)@\1undef\2 /\*\3@' < conftest > config.h -rm -f conftest - ;; - esac -done -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF - -{ (exit 0); exit 0; } -_ACEOF -chmod +x $CONFIG_STATUS -ac_clean_files=$ac_clean_files_save - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || { (exit 1); exit 1; } -fi - - -echo "" -if test -z "$AWK"; then -echo "!!! Since you have no awk you must copy the files 'comm.h.dist'" -echo "!!! and 'term.h.dist' to 'comm.h' and 'term.h'." -echo "!!! Do _not_ change the user configuration section in config.h!" -echo "Please check the pathnames in the Makefile." -else -echo "Now please check the pathnames in the Makefile and in the user" -echo "configuration section in config.h." -fi -echo "Then type 'make' to make screen. Good luck." -echo "" diff --git a/doc/install.sh b/doc/install.sh deleted file mode 120000 index 3f44f99..0000000 --- a/doc/install.sh +++ /dev/null @@ -1 +0,0 @@ -../install.sh
\ No newline at end of file diff --git a/doc/screen.info b/doc/screen.info deleted file mode 100644 index 3a18ff3..0000000 --- a/doc/screen.info +++ /dev/null @@ -1,198 +0,0 @@ -This is screen.info, produced by makeinfo version 4.5 from -./screen.texinfo. - -INFO-DIR-SECTION General Commands -START-INFO-DIR-ENTRY -* Screen: (screen). Full-screen window manager. -END-INFO-DIR-ENTRY - - This file documents the `Screen' virtual terminal manager. - - Copyright (c) 1993-2003 Free Software Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be stated in a -translation approved by the Foundation. - - -Indirect: -screen.info-1: 995 -screen.info-2: 46865 -screen.info-3: 92444 -screen.info-4: 140698 -screen.info-5: 190096 - -Tag Table: -(Indirect) -Node: Top995 -Node: Overview3003 -Node: Getting Started6633 -Node: Invoking Screen8387 -Node: Customization17073 -Node: Startup Files17619 -Node: Source19265 -Node: Colon19950 -Node: Commands20564 -Node: Default Key Bindings21521 -Node: Command Summary27200 -Node: New Window41325 -Node: Chdir42126 -Node: Screen Command43097 -Node: Setenv44798 -Node: Shell45318 -Node: Term46084 -Node: Window Types46865 -Node: Selecting51188 -Node: Next and Previous51818 -Node: Other Window52348 -Node: Select52756 -Node: Windowlist53571 -Node: Session Management54666 -Node: Detach55495 -Node: Power Detach56882 -Node: Lock57523 -Node: Multiuser Session58409 -Node: Multiuser59371 -Node: Acladd59758 -Node: Aclchg60323 -Node: Acldel61730 -Node: Aclgrp62065 -Node: Displays62716 -Node: Umask63010 -Node: Wall63959 -Node: Writelock64196 -Node: Su65092 -Node: Session Name65892 -Node: Suspend66439 -Node: Quit66771 -Node: Regions67195 -Node: Split67762 -Node: Focus68052 -Node: Only68630 -Node: Remove68794 -Node: Resize69002 -Node: Caption69650 -Node: Fit70407 -Node: Window Settings70709 -Node: Naming Windows71444 -Node: Title Command72945 -Node: Dynamic Titles73219 -Node: Title Prompts74755 -Node: Title Screenrc75836 -Node: Console77475 -Node: Kill77918 -Node: Login78807 -Node: Mode79624 -Node: Monitor80022 -Node: Windows81433 -Node: Hardstatus82493 -Node: Virtual Terminal83686 -Node: Control Sequences84744 -Node: Input Translation92444 -Node: Digraph96915 -Node: Bell97707 -Node: Clear99586 -Node: Info99789 -Node: Redisplay101818 -Node: Wrap103121 -Node: Reset103872 -Node: Window Size104190 -Node: Character Processing105043 -Node: Copy and Paste109368 -Node: Copy109973 -Node: Line Termination110820 -Node: Scrollback111229 -Node: Copy Mode Keys111966 -Node: Movement112780 -Node: Marking113985 -Node: Repeat count114360 -Node: Searching114674 -Node: Specials115066 -Node: Paste117020 -Node: Registers120075 -Node: Screen Exchange120868 -Node: History122273 -Node: Subprocess Execution123013 -Node: Exec123377 -Node: Using Exec125123 -Node: Key Binding126962 -Node: Bind127605 -Node: Bind Examples128849 -Node: Command Character129905 -Node: Help131540 -Node: Bindkey132148 -Node: Bindkey Examples133698 -Node: Bindkey Control134587 -Node: Flow Control135184 -Node: Flow Control Summary135760 -Node: Flow138694 -Node: XON/XOFF139468 -Node: Termcap139841 -Node: Window Termcap140698 -Node: Dump Termcap146059 -Node: Termcap Syntax146773 -Node: Termcap Examples148939 -Node: Special Capabilities150980 -Node: Autonuke153755 -Node: Obuflimit154405 -Node: Character Translation155234 -Node: Message Line157848 -Node: Privacy Message158759 -Node: Hardware Status Line159256 -Node: Last Message160959 -Node: Message Wait161386 -Node: Logging161812 -Node: Hardcopy162136 -Node: Log163071 -Node: Startup164848 -Node: echo165255 -Node: sleep165663 -Node: Startup Message166004 -Node: Miscellaneous166277 -Node: At167716 -Node: Break169686 -Node: Debug171332 -Node: License171809 -Node: Nethack172074 -Node: Nonblock172751 -Node: Number173730 -Node: Silence174100 -Node: Time175036 -Node: Verbose175628 -Node: Version175962 -Node: Zombie176171 -Node: Printcmd177225 -Node: Sorendition177931 -Node: Attrcolor178361 -Node: Setsid179411 -Node: Eval179928 -Node: Maxwin180137 -Node: Backtick180407 -Node: Screen Saver181654 -Node: Zmodem182779 -Node: String Escapes183664 -Node: Environment189000 -Node: Files190096 -Node: Credits191184 -Node: Bugs193195 -Node: Known Bugs193665 -Node: Reporting Bugs195759 -Node: Availability196525 -Node: Installation197069 -Node: Socket Directory197459 -Node: Compiling Screen197989 -Node: Concept Index199376 -Node: Command Index201468 -Node: Keystroke Index210715 - -End Tag Table diff --git a/doc/screen.info-1 b/doc/screen.info-1 deleted file mode 100644 index ece1aba..0000000 --- a/doc/screen.info-1 +++ /dev/null @@ -1,1447 +0,0 @@ -This is screen.info, produced by makeinfo version 4.5 from -./screen.texinfo. - -INFO-DIR-SECTION General Commands -START-INFO-DIR-ENTRY -* Screen: (screen). Full-screen window manager. -END-INFO-DIR-ENTRY - - This file documents the `Screen' virtual terminal manager. - - Copyright (c) 1993-2003 Free Software Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be stated in a -translation approved by the Foundation. - - -File: screen.info, Node: Top, Next: Overview, Prev: (dir), Up: (dir) - -Screen -****** - - This file documents the `Screen' virtual terminal manager, version -4.0.2. - -* Menu: - -* Overview:: Preliminary information. -* Getting Started:: An introduction to `screen'. -* Invoking Screen:: Command line options for `screen'. -* Customization:: The `.screenrc' file. -* Commands:: List all of the commands. -* New Window:: Running a program in a new window. -* Selecting:: Selecting a window to display. -* Session Management:: Suspend/detach, grant access, connect sessions. -* Regions:: Split-screen commands. -* Window Settings:: Titles, logging, etc. -* Virtual Terminal:: Controlling the `screen' VT100 emulation. -* Copy and Paste:: Exchanging text between windows and sessions. -* Subprocess Execution:: I/O filtering with `exec'. -* Key Binding:: Binding commands to keys. -* Flow Control:: Trap or pass flow control characters. -* Termcap:: Tweaking your terminal's termcap entry. -* Message Line:: The `screen' message line. -* Logging:: Keeping a record of your session. -* Startup:: Functions only useful at `screen' startup. -* Miscellaneous:: Various other commands. -* String Escapes:: Inserting current information into strings -* Environment:: Environment variables used by `screen'. -* Files:: Files used by `screen'. -* Credits:: Who's who of `screen'. -* Bugs:: What to do if you find a bug. -* Installation:: Getting `screen' running on your system. -* Concept Index:: Index of concepts. -* Command Index:: Index of all `screen' commands. -* Keystroke Index:: Index of default key bindings. - - -File: screen.info, Node: Overview, Next: Getting Started, Prev: Top, Up: Top - -Overview -******** - - Screen is a full-screen window manager that multiplexes a physical -terminal between several processes, typically interactive shells. Each -virtual terminal provides the functions of the DEC VT100 terminal and, -in addition, several control functions from the ISO 6429 (ECMA 48, ANSI -X3.64) and ISO 2022 standards (e.g. insert/delete line and support for -multiple character sets). There is a scrollback history buffer for -each virtual terminal and a copy-and-paste mechanism that allows the -user to move text regions between windows. - - When `screen' is called, it creates a single window with a shell in -it (or the specified command) and then gets out of your way so that you -can use the program as you normally would. Then, at any time, you can -create new (full-screen) windows with other programs in them (including -more shells), kill the current window, view a list of the active -windows, turn output logging on and off, copy text between windows, view -the scrollback history, switch between windows, etc. All windows run -their programs completely independent of each other. Programs continue -to run when their window is currently not visible and even when the -whole screen session is detached from the user's terminal. - - When a program terminates, `screen' (per default) kills the window -that contained it. If this window was in the foreground, the display -switches to the previously displayed window; if none are left, `screen' -exits. - - Everything you type is sent to the program running in the current -window. The only exception to this is the one keystroke that is used to -initiate a command to the window manager. By default, each command -begins with a control-a (abbreviated `C-a' from now on), and is -followed by one other keystroke. The command character (*note Command -Character::) and all the key bindings (*note Key Binding::) can be fully -customized to be anything you like, though they are always two -characters in length. - - `Screen' does not understand the prefix `C-' to mean control. -Please use the caret notation (`^A' instead of `C-a') as arguments to -e.g. the `escape' command or the `-e' option. `Screen' will also print -out control characters in caret notation. - - The standard way to create a new window is to type `C-a c'. This -creates a new window running a shell and switches to that window -immediately, regardless of the state of the process running in the -current window. Similarly, you can create a new window with a custom -command in it by first binding the command to a keystroke (in your -`.screenrc' file or at the `C-a :' command line) and then using it just -like the `C-a c' command. In addition, new windows can be created by -running a command like: - - screen emacs prog.c - -from a shell prompt within a previously created window. This will not -run another copy of `screen', but will instead supply the command name -and its arguments to the window manager (specified in the $STY -environment variable) who will use it to create the new window. The -above example would start the `emacs' editor (editing `prog.c') and -switch to its window. - - If `/etc/utmp' is writable by `screen', an appropriate record will -be written to this file for each window, and removed when the window is -closed. This is useful for working with `talk', `script', `shutdown', -`rsend', `sccs' and other similar programs that use the utmp file to -determine who you are. As long as `screen' is active on your terminal, -the terminal's own record is removed from the utmp file. *Note Login::. - - -File: screen.info, Node: Getting Started, Next: Invoking Screen, Prev: Overview, Up: Top - -Getting Started -*************** - - Before you begin to use `screen' you'll need to make sure you have -correctly selected your terminal type, just as you would for any other -termcap/terminfo program. (You can do this by using `tset', `qterm', -or just `set term=mytermtype', for example.) - - If you're impatient and want to get started without doing a lot more -reading, you should remember this one command: `C-a ?' (*note Key -Binding::). Typing these two characters will display a list of the -available `screen' commands and their bindings. Each keystroke is -discussed in the section on keystrokes (*note Default Key Bindings::). -Another section (*note Customization::) deals with the contents of your -`.screenrc'. - - If your terminal is a "true" auto-margin terminal (it doesn't allow -the last position on the screen to be updated without scrolling the -screen) consider using a version of your terminal's termcap that has -automatic margins turned _off_. This will ensure an accurate and -optimal update of the screen in all circumstances. Most terminals -nowadays have "magic" margins (automatic margins plus usable last -column). This is the VT100 style type and perfectly suited for -`screen'. If all you've got is a "true" auto-margin terminal `screen' -will be content to use it, but updating a character put into the last -position on the screen may not be possible until the screen scrolls or -the character is moved into a safe position in some other way. This -delay can be shortened by using a terminal with insert-character -capability. - - *Note Special Capabilities::, for more information about telling -`screen' what kind of terminal you have. - - -File: screen.info, Node: Invoking Screen, Next: Customization, Prev: Getting Started, Up: Top - -Invoking `Screen' -***************** - - Screen has the following command-line options: - -`-a' - Include _all_ capabilities (with some minor exceptions) in each - window's termcap, even if `screen' must redraw parts of the display - in order to implement a function. - -`-A' - Adapt the sizes of all windows to the size of the display. By - default, `screen' may try to restore its old window sizes when - attaching to resizable terminals (those with `WS' in their - descriptions, e.g. `suncmd' or some varieties of `xterm'). - -`-c FILE' - Use FILE as the user's configuration file instead of the default - of `$HOME/.screenrc'. - -`-d [PID.SESSIONNAME]' -`-D [PID.SESSIONNAME]' - Do not start `screen', but instead detach a `screen' session - running elsewhere (*note Detach::). `-d' has the same effect as - typing `C-a d' from the controlling terminal for the session. - `-D' is the equivalent to the power detach key. If no session can - be detached, this option is ignored. In combination with the - `-r'/`-R' option more powerful effects can be achieved: - - `-d -r' - Reattach a session and if necessary detach it first. - - `-d -R' - Reattach a session and if necessary detach or even create - it first. - - `-d -RR' - Reattach a session and if necessary detach or create it. Use - the first session if more than one session is available. - - `-D -r' - Reattach a session. If necessary detach and logout remotely - first. - - `-D -R' - Attach here and now. In detail this means: If a session is - running, then reattach. If necessary detach and logout - remotely first. If it was not running create it and notify - the user. This is the author's favorite. - - `-D -RR' - Attach here and now. Whatever that means, just do it. - - _Note_: It is a good idea to check the status of your sessions - with `screen -list' before using this option. - -`-e XY' - Set the command character to X, and the character generating a - literal command character (when typed after the command character) - to Y. The defaults are `C-a' and `a', which can be specified as - `-e^Aa'. When creating a `screen' session, this option sets the - default command character. In a multiuser session all users added - will start off with this command character. But when attaching to - an already running session, this option only changes the command - character of the attaching user. This option is equivalent to the - commands `defescape' or `escape' respectively. (*note Command - Character::). - -`-f' -`-fn' -`-fa' - Set flow-control to on, off, or automatic switching mode, - respectively. This option is equivalent to the `defflow' command - (*note Flow Control::). - -`-h NUM' - Set the history scrollback buffer to be NUM lines high. - Equivalent to the `defscrollback' command (*note Copy::). - -`-i' - Cause the interrupt key (usually `C-c') to interrupt the display - immediately when flow control is on. This option is equivalent to - the `interrupt' argument to the `defflow' command (*note Flow - Control::). Its use is discouraged. - -`-l' -`-ln' - Turn login mode on or off (for `/etc/utmp' updating). This option - is equivalent to the `deflogin' command (*note Login::). - -`-ls [MATCH]' -`-list [MATCH]' - Do not start `screen', but instead print a list of session - identification strings (usually of the form PID.TTY.HOST; *note - Session Name::). Sessions marked `detached' can be resumed with - `screen -r'. Those marked `attached' are running and have a - controlling terminal. If the session runs in multiuser mode, it - is marked `multi'. Sessions marked as `unreachable' either live - on a different host or are dead. An unreachable session is - considered dead, when its name matches either the name of the - local host, or the specified parameter, if any. See the `-r' flag - for a description how to construct matches. Sessions marked as - `dead' should be thoroughly checked and removed. Ask your system - administrator if you are not sure. Remove sessions with the - `-wipe' option. - -`-L' - Tell `screen' to turn on automatic output logging for the windows. - -`-m' - Tell `screen' to ignore the `$STY' environment variable. When - this option is used, a new session will always be created, - regardless of whether `screen' is being called from within another - `screen' session or not. This flag has a special meaning in - connection with the `-d' option: - `-d -m' - Start `screen' in _detached_ mode. This creates a new session - but doesn't attach to it. This is useful for system startup - scripts. - - `-D -m' - This also starts `screen' in _detached_ mode, but doesn't fork - a new process. The command exits if the session terminates. - -`-p NAME_OR_NUMBER' - Preselect a window. This is usefull when you want to reattach to a - specific windor or you want to send a command via the `-X' option - to a specific window. As with screen's select commant, `-' selects - the blank window. As a special case for reattach, `=' brings up - the windowlist on the blank window. - -`-q' - Suppress printing of error messages. In combination with `-ls' the - exit value is set as follows: 9 indicates a directory without - sessions. 10 indicates a directory with running but not attachable - sessions. 11 (or more) indicates 1 (or more) usable sessions. In - combination with `-r' the exit value is as follows: 10 indicates - that there is no session to resume. 12 (or more) indicates that - there are 2 (or more) sessions to resume and you should specify - which one to choose. In all other cases `-q' has no effect. - -`-r [PID.SESSIONNAME]' -`-r SESSIONOWNER/[PID.SESSIONNAME]' - Resume a detached `screen' session. No other options (except - combinations with `-d' or `-D') may be specified, though the - session name (*note Session Name::) may be needed to distinguish - between multiple detached `screen' sessions. The second form is - used to connect to another user's screen session which runs in - multiuser mode. This indicates that screen should look for - sessions in another user's directory. This requires setuid-root. - -`-R' - Resume the first appropriate detached `screen' session. If - successful, all other command-line options are ignored. If no - detached session exists, start a new session using the specified - options, just as if `-R' had not been specified. This option is - set by default if screen is run as a login-shell (actually screen - uses `-xRR' in that case). For combinations with the `-D'/`-d' - option see there. - -`-s PROGRAM' - Set the default shell to be PROGRAM. By default, `screen' uses - the value of the environment variable `$SHELL', or `/bin/sh' if it - is not defined. This option is equivalent to the `shell' command - (*note Shell::). - -`-S SESSIONNAME' - Set the name of the new session to SESSIONNAME. This option can - be used to specify a meaningful name for the session in place of - the default TTY.HOST suffix. This name identifies the session for - the `screen -list' and `screen -r' commands. This option is - equivalent to the `sessionname' command (*note Session Name::). - -`-t NAME' - Set the title (name) for the default shell or specified program. - This option is equivalent to the `shelltitle' command (*note - Shell::). - -`-U' - Run screen in UTF-8 mode. This option tells screen that your - terminal sends and understands UTF-8 encoded characters. It also - sets the default encoding for new windows to `utf8'. - -`-v' - Print the version number. - -`-wipe [MATCH]' - List available screens like `screen -ls', but remove destroyed - sessions instead of marking them as `dead'. An unreachable - session is considered dead, when its name matches either the name - of the local host, or the explicitly given parameter, if any. See - the `-r' flag for a description how to construct matches. - -`-x' - Attach to a session which is already attached elsewhere - (multi-display mode). - -`-X' - Send the specified command to a running screen session. You can use - the `-d' or `-r' option to tell screen to look only for attached - or detached screen sessions. Note that this command doesn't work - if the session is password protected. - - - -File: screen.info, Node: Customization, Next: Commands, Prev: Invoking Screen, Up: Top - -Customizing `Screen' -******************** - - You can modify the default settings for `screen' to fit your tastes -either through a personal `.screenrc' file which contains commands to -be executed at startup, or on the fly using the `colon' command. - -* Menu: - -* Startup Files:: The `.screenrc' file. -* Source:: Read commands from a file. -* Colon:: Entering customization commands interactively. - - -File: screen.info, Node: Startup Files, Next: Source, Up: Customization - -The `.screenrc' file -==================== - - When `screen' is invoked, it executes initialization commands from -the files `.screenrc' in the user's home directory and -`/usr/local/etc/screenrc'. These defaults can be overridden in the -following ways: For the global screenrc file `screen' searches for the -environment variable `$SYSSCREENRC' (this override feature may be -disabled at compile-time). The user specific screenrc file is searched -for in `$SCREENRC', then ``$HOME'/.screenrc'. The command line option -`-c' specifies which file to use (*note Invoking Screen::. Commands in -these files are used to set options, bind commands to keys, and to -automatically establish one or more windows at the beginning of your -`screen' session. Commands are listed one per line, with empty lines -being ignored. A command's arguments are separated by tabs or spaces, -and may be surrounded by single or double quotes. A `#' turns the rest -of the line into a comment, except in quotes. Unintelligible lines are -warned about and ignored. Commands may contain references to -environment variables. The syntax is the shell-like `$VAR' or -`${VAR}'. Note that this causes incompatibility with previous `screen' -versions, as now the '$'-character has to be protected with '\' if no -variable substitution is intended. A string in single-quotes is also -protected from variable substitution. - - Two configuration files are shipped as examples with your screen -distribution: `etc/screenrc' and `etc/etcscreenrc'. They contain a -number of useful examples for various commands. - - -File: screen.info, Node: Source, Next: Colon, Prev: Startup Files, Up: Customization - -Source -====== - - - Command: source file - (none) - Read and execute commands from file FILE. Source commands may be - nested to a maximum recursion level of ten. If FILE is not an - absolute path and screen is already processing a source - command, the parent directory of the running source command file - is used to search for the new command file before screen's - current directory. - - Note that termcap/terminfo/termcapinfo commands only work at - startup and reattach time, so they must be reached via the - default screenrc files to have an effect. - - -File: screen.info, Node: Colon, Prev: Source, Up: Customization - -Colon -===== - - Customization can also be done online, with this command: - - - Command: colon - (`C-a :') - Allows you to enter `.screenrc' command lines. Useful for - on-the-fly modification of key bindings, specific window creation - and changing settings. Note that the `set' keyword no longer - exists, as of version 3.3. Change default settings with commands - starting with `def'. You might think of this as the `ex' command - mode of `screen', with `copy' as its `vi' command mode (*note Copy - and Paste::). - - -File: screen.info, Node: Commands, Next: New Window, Prev: Customization, Up: Top - -Commands -******** - - A command in `screen' can either be bound to a key, invoked from a -screenrc file, or called from the `colon' prompt (*note -Customization::). As of version 3.3, all commands can be bound to -keys, although some may be less useful than others. For a number of -real life working examples of the most important commands see the files -`etc/screenrc' and `etc/etcscreenrc' of your screen distribution. - - In this manual, a command definition looks like this: - -- Command: command [-n] ARG1 [ARG2] ... - (KEYBINDINGS) - This command does something, but I can't remember what. - - An argument in square brackets (`[]') is optional. Many commands -take an argument of `on' or `off', which is indicated as STATE in the -definition. - -* Menu: - -* Default Key Bindings:: `screen' keyboard commands. -* Command Summary:: List of all commands. - - -File: screen.info, Node: Default Key Bindings, Next: Command Summary, Up: Commands - -Default Key Bindings -==================== - - As mentioned previously, each keyboard command consists of a `C-a' -followed by one other character. For your convenience, all commands -that are bound to lower-case letters are also bound to their control -character counterparts (with the exception of `C-a a'; see below). -Thus, both `C-a c' and `C-a C-c' can be used to create a window. - - The following table shows the default key bindings: - -`C-a '' - (select) - Prompt for a window identifier and switch. *Note Selecting::. - -`C-a "' - (windowlist -b) - Present a list of all windows for selection. *Note Selecting::. - -`C-a 0...9, -' - (select 0...select 9, select -) - Switch to window number 0...9, or the blank window. *Note - Selecting::. - -`C-a <Tab>' - (focus) - Switch the input focus to the next region. *Note Regions::. - -`C-a C-a' - (other) - Toggle to the window displayed previously. If this window does no - longer exist, `other' has the same effect as `next'. *Note - Selecting::. - -`C-a a' - (meta) - Send the command character (C-a) to window. See `escape' command. - *Note Command Character::. - -`C-a A' - (title) - Allow the user to enter a title for the current window. *Note - Naming Windows::. - -`C-a b' -`C-a C-b' - (break) - Send a break to the tty. *Note Break::. - -`C-a B' - (pow_break) - Close and reopen the tty-line. *Note Break::. - -`C-a c' -`C-a C-c' - (screen) - Create a new window with a shell and switch to that window. *Note - Screen Command::. - -`C-a C' - (clear) - Clear the screen. *Note Clear::. - -`C-a d' -`C-a C-d' - (detach) - Detach `screen' from this terminal. *Note Detach::. - -`C-a D D' - (pow_detach) - Detach and logout. *Note Power Detach::. - -`C-a f' -`C-a C-f' - (flow) - Cycle flow among `on', `off' or `auto'. *Note Flow::. - -`C-a F' - (fit) - Resize the window to the current region size. *Note Window Size::. - -`C-a C-g' - (vbell) - Toggle visual bell mode. *Note Bell::. - -`C-a h' - (hardcopy) - Write a hardcopy of the current window to the file "hardcopy.N". - *Note Hardcopy::. - -`C-a H' - (log) - Toggle logging of the current window to the file "screenlog.N". - *Note Log::. - -`C-a i' -`C-a C-i' - (info) - Show info about the current window. *Note Info::. - -`C-a k' -`C-a C-k' - (kill) - Destroy the current window. *Note Kill::. - -`C-a l' -`C-a C-l' - (redisplay) - Fully refresh the current window. *Note Redisplay::. - -`C-a L' - (login) - Toggle the current window's login state. *Note Login::. - -`C-a m' -`C-a C-m' - (lastmsg) - Repeat the last message displayed in the message line. *Note Last - Message::. - -`C-a M' - (monitor) Toggle monitoring of the current window. *Note - Monitor::. - -`C-a <SPC>' -`C-a n' -`C-a C-n' - (next) - Switch to the next window. *Note Selecting::. - -`C-a N' - (number) - Show the number (and title) of the current window. *Note Number::. - -`C-a p' -`C-a C-p' -`C-a C-h' -`C-a <BackSpace>' - (prev) - Switch to the previous window (opposite of `C-a n'). *Note - Selecting::. - -`C-a q' -`C-a C-q' - (xon) - Send a ^Q (ASCII XON) to the current window. *Note XON/XOFF::. - -`C-a Q' - (only) - Delete all regions but the current one. *Note Regions::. - -`C-a r' -`C-a C-r' - (wrap) - Toggle the current window's line-wrap setting (turn the current - window's automatic margins on or off). *Note Wrap::. - -`C-a s' -`C-a C-s' - (xoff) - Send a ^S (ASCII XOFF) to the current window. *Note XON/XOFF::. - -`C-a S' - (split) - Split the current region into two new ones. *Note Regions::. - -`C-a t' -`C-a C-t' - (time) - Show the load average and xref. *Note Time::. - -`C-a v' - (version) - Display the version and compilation date. *Note Version::. - -`C-a C-v' - (digraph) - Enter digraph. *Note Digraph::. - -`C-a w' -`C-a C-w' - (windows) - Show a list of active windows. *Note Windows::. - -`C-a W' - (width) - Toggle between 80 and 132 columns. *Note Window Size::. - -`C-a x' -`C-a C-x' - (lockscreen) - Lock your terminal. *Note Lock::. - -`C-a X' - (remove) - Kill the current region. *Note Regions::. - -`C-a z' -`C-a C-z' - (suspend) - Suspend `screen'. *Note Suspend::. - -`C-a Z' - (reset) - Reset the virtual terminal to its "power-on" values. *Note - Reset::. - -`C-a .' - (dumptermcap) - Write out a `.termcap' file. *Note Dump Termcap::. - -`C-a ?' - (help) - Show key bindings. *Note Help::. - -`C-a C-\' - (quit) - Kill all windows and terminate `screen'. *Note Quit::. - -`C-a :' - (colon) - Enter a command line. *Note Colon::. - -`C-a [' -`C-a C-[' -`C-a <ESC>' - (copy) - Enter copy/scrollback mode. *Note Copy::. - -`C-a ]' -`C-a C-]' - (paste .) - Write the contents of the paste buffer to the stdin queue of the - current window. *Note Paste::. - -`C-a {' -`C-a }' - (history) - Copy and paste a previous (command) line. *Note History::. - -`C-a >' - (writebuf) - Write the paste buffer out to the screen-exchange file. *Note - Screen Exchange::. - -`C-a <' - (readbuf) - Read the screen-exchange file into the paste buffer. *Note Screen - Exchange::. - -`C-a =' - (removebuf) - Delete the screen-exchange file. *Note Screen Exchange::. - -`C-a _' - (silence) - Start/stop monitoring the current window for inactivity. *Note - Silence::, - -`C-a ,' - (license) - Show the copyright page. - -`C-a *' - (displays) - Show the listing of attached displays. - - -File: screen.info, Node: Command Summary, Prev: Default Key Bindings, Up: Commands - -Command Summary -=============== - -`acladd USERNAMES' - Allow other users in this session. *Note Multiuser Session::. - -`aclchg USERNAMES PERMBITS LIST' - Change a user's permissions. *Note Multiuser Session::. - -`acldel USERNAME' - Disallow other user in this session. *Note Multiuser Session::. - -`aclgrp USRNAME [GROUPNAME]' - Inherit permissions granted to a group leader. *Note Multiuser - Session::. - -`aclumask [USERS]+/-BITS ...' - Predefine access to new windows. *Note Umask::. - -`activity MESSAGE' - Set the activity notification message. *Note Monitor::. - -`addacl USERNAMES' - Synonym to `acladd'. *Note Multiuser Session::. - -`allpartial STATE' - Set all windows to partial refresh. *Note Redisplay::. - -`altscreen STATE' - Enables support for the "alternate screen" terminal capability. - *Note Redisplay::. - -`at [IDENT][#|*|%] COMMAND [ARGS]' - Execute a command at other displays or windows. *Note At::. - -`attrcolor ATTRIB [ATTRIBUTE/COLOR-MODIFIER]' - Map attributes to colors. *Note Attrcolor::. - -`autodetach STATE' - Automatically detach the session on SIGHUP. *Note Detach::. - -`autonuke STATE' - Enable a clear screen to discard unwritten output. *Note - Autonuke::. - -`backtick ID LIFESPAN AUTOREFRESH COMMAND [ARGS]' - Define a command for the backtick string escape. *Note Backtick::. - -`bce [STATE]' - Change background color erase. *Note Character Processing::. - -`bell_msg [MESSAGE]' - Set the bell notification message. *Note Bell::. - -`bind [-c CLASS] KEY [COMMAND [ARGS]]' - Bind a command to a key. *Note Bind::. - -`bindkey [OPTS] [STRING [CMD ARGS]]' - Bind a string to a series of keystrokes. *Note Bindkey::. - -`blanker' - Blank the screen. *Note Screen Saver::. - -`blankerprg' - Define a blanker program. *Note Screen Saver::. - -`break [DURATION]' - Send a break signal to the current window. *Note Break::. - -`breaktype [TCSENDBREAK | TCSBRK | TIOCSBRK]' - Specify how to generate breaks. *Note Break::. - -`bufferfile [EXCHANGE-FILE]' - Select a file for screen-exchange. *Note Screen Exchange::. - -`c1 [STATE]' - Change c1 code processing. *Note Character Processing::. - -`caption MODE [STRING]' - Change caption mode and string. *Note Regions::. - -`chacl USERNAMES PERMBITS LIST' - Synonym to `aclchg'. *Note Multiuser Session::. - -`charset SET' - Change character set slot designation. *Note Character - Processing::. - -`chdir [DIRECTORY]' - Change the current directory for future windows. *Note Chdir::. - -`clear' - Clear the window screen. *Note Clear::. - -`colon' - Enter a `screen' command. *Note Colon::. - -`command [-c CLASS]' - Simulate the screen escape key. *Note Command Character::. - -`compacthist [STATE]' - Selects compaction of trailing empty lines. *Note Scrollback::. - -`console [STATE]' - Grab or ungrab console output. *Note Console::. - -`copy' - Enter copy mode. *Note Copy::. - -`copy_reg [KEY]' - Removed. Use `paste' instead. *Note Registers::. - -`crlf STATE' - Select line break behavior for copying. *Note Line Termination::. - -`debug STATE' - Suppress/allow debugging output. *Note Debug::. - -`defautonuke STATE' - Select default autonuke behavior. *Note Autonuke::. - -`defbce STATE' - Select background color erase. *Note Character Processing::. - -`defbreaktype [TCSENDBREAK | TCSBRK | TIOCSBRK]' - Specify the default for generating breaks. *Note Break::. - -`defc1 STATE' - Select default c1 processing behavior. *Note Character - Processing::. - -`defcharset [SET]' - Change defaul character set slot designation. *Note Character - Processing::. - -`defencoding ENC' - Select default window encoding. *Note Character Processing::. - -`defescape XY' - Set the default command and `meta' characters. *Note Command - Character::. - -`defflow FSTATE' - Select default flow control behavior. *Note Flow::. - -`defgr STATE' - Select default GR processing behavior. *Note Character - Processing::. - -`defhstatus [STATUS]' - Select default window hardstatus line. *Note Hardstatus::. - -`deflog STATE' - Select default window logging behavior. *Note Log::. - -`deflogin STATE' - Select default utmp logging behavior. *Note Login::. - -`defmode MODE' - Select default file mode for ptys. *Note Mode::. - -`defmonitor STATE' - Select default activity monitoring behavior. *Note Monitor::. - -`defnonblock STATE|NUMSECS' - Select default nonblock mode. *Note Nonblock::. - -`defobuflimit LIMIT' - Select default output buffer limit. *Note Obuflimit::. - -`defscrollback NUM' - Set default lines of scrollback. *Note Scrollback::. - -`defshell COMMAND' - Set the default program for new windows. *Note Shell::. - -`defsilence STATE' - Select default idle monitoring behavior. *Note Silence::. - -`defslowpaste MSEC' - Select the default inter-character timeout when pasting. *Note - Paste::. - -`defutf8 STATE' - Select default character encoding. *Note Character Processing::. - -`defwrap STATE' - Set default line-wrapping behavior. *Note Wrap::. - -`defwritelock ON|OFF|AUTO' - Set default writelock behavior. *Note Multiuser Session::. - -`defzombie [KEYS]' - Keep dead windows. *Note Zombie::. - -`detach [-h]' - Disconnect `screen' from the terminal. *Note Detach::. - -`digraph' - Enter digraph sequence. *Note Digraph::. - -`dinfo' - Display terminal information. *Note Info::. - -`displays' - List currently active user interfaces. *Note Displays::. - -`dumptermcap' - Write the window's termcap entry to a file. *Note Dump Termcap::. - -`echo [-n] MESSAGE' - Display a message on startup. *Note Startup::. - -`encoding ENC [DENC]' - Set the encoding of a window. *Note Character Processing::. - -`escape XY' - Set the command and `meta' characters. *Note Command Character::. - -`eval COMMAND1 [COMMAND2 ...]' - Parse and execute each argument. *Note Eval::. - -`exec [[FDPAT] COMMAND [ARGS ...]]' - Run a subprocess (filter). *Note Exec::. - -`fit' - Change window size to current display size. *Note Window Size::. - -`flow [FSTATE]' - Set flow control behavior. *Note Flow::. - -`focus' - Move focus to next region. *Note Regions::. - -`gr [STATE]' - Change GR charset processing. *Note Character Processing::. - -`hardcopy [-h] [FILE]' - Write out the contents of the current window. *Note Hardcopy::. - -`hardcopy_append STATE' - Append to hardcopy files. *Note Hardcopy::. - -`hardcopydir DIRECTORY' - Place, where to dump hardcopy files. *Note Hardcopy::. - -`hardstatus [STATE]' - Use the hardware status line. *Note Hardware Status Line::. - -`height [LINES [COLS]]' - Set display height. *Note Window Size::. - -`help [-c CLASS]' - Display current key bindings. *Note Help::. - -`history' - Find previous command beginning .... *Note History::. - -`hstatus STATUS' - Change the window's hardstatus line. *Note Hardstatus::. - -`idle [TIMEOUT [CMD ARGS]]' - Define a screen saver command. *Note Screen Saver::. - -`ignorecase [STATE]' - Ignore character case in searches. *Note Searching::. - -`info' - Display window settings. *Note Info::. - -`ins_reg [KEY]' - Removed, use `paste' instead. *Note Registers::. - -`kill' - Destroy the current window. *Note Kill::. - -`lastmsg' - Redisplay the last message. *Note Last Message::. - -`license' - Display licensing information. *Note Startup::. - -`lockscreen' - Lock the controlling terminal. *Note Lock::. - -`log [STATE]' - Log all output in the current window. *Note Log::. - -`logfile FILENAME' - Place where to collect logfiles. *Note Log::. - -`login [STATE]' - Log the window in `/etc/utmp'. *Note Login::. - -`logtstamp [STATE]' - Configure logfile time-stamps. *Note Log::. - -`mapdefault' - Use only the default mapping table for the next keystroke. *Note - Bindkey Control::. - -`mapnotnext' - Don't try to do keymapping on the next keystroke. *Note Bindkey - Control::. - -`maptimeout TIMO' - Set the inter-character timeout used for keymapping. *Note Bindkey - Control::. - -`markkeys STRING' - Rebind keys in copy mode. *Note Copy Mode Keys::. - -`maxwin N' - Set the maximum window number. *Note Maxwin::. - -`meta' - Insert the command character. *Note Command Character::. - -`monitor [STATE]' - Monitor activity in window. *Note Monitor::. - -`msgminwait SEC' - Set minimum message wait. *Note Message Wait::. - -`msgwait SEC' - Set default message wait. *Note Message Wait::. - -`multiuser STATE' - Go into single or multi user mode. *Note Multiuser Session::. - -`nethack STATE' - Use `nethack'-like error messages. *Note Nethack::. - -`next' - Switch to the next window. *Note Selecting::. - -`nonblock [STATE|NUMSECS]' - Disable flow control to the current display. *Note - Nonblock::.|NUMSECS] - -`number [N]' - Change/display the current window's number. *Note Number::. - -`obuflimit [LIMIT]' - Select output buffer limit. *Note Obuflimit::. - -`only' - Kill all other regions. *Note Regions::. - -`other' - Switch to the window you were in last. *Note Selecting::. - -`partial STATE' - Set window to partial refresh. *Note Redisplay::. - -`password [CRYPTED_PW]' - Set reattach password. *Note Detach::. - -`paste [SRC_REGS [DEST_REG]]' - Paste contents of paste buffer or registers somewhere. *Note - Paste::. - -`pastefont [STATE]' - Include font information in the paste buffer. *Note Paste::. - -`pow_break' - Close and Reopen the window's terminal. *Note Break::. - -`pow_detach' - Detach and hang up. *Note Power Detach::. - -`pow_detach_msg [MESSAGE]' - Set message displayed on `pow_detach'. *Note Power Detach::. - -`prev' - Switch to the previous window. *Note Selecting::. - -`printcmd [CMD]' - Set a command for VT100 printer port emulation. *Note Printcmd::. - -`process [KEY]' - Treat a register as input to `screen'. *Note Registers::. - -`quit' - Kill all windows and exit. *Note Quit::. - -`readbuf [-e ENCODING] [FILENAME]' - Read the paste buffer from the screen-exchange file. *Note Screen - Exchange::. - -`readreg [-e ENCODING] [REG [FILE]]' - Load a register from paste buffer or file. *Note Registers::. - -`redisplay' - Redisplay the current window. *Note Redisplay::. - -`register [-e ENCODING] KEY STRING' - Store a string to a register. *Note Registers::. - -`remove' - Kill current region. *Note Regions::. - -`removebuf' - Delete the screen-exchange file. *Note Screen Exchange::. - -`reset' - Reset the terminal settings for the window. *Note Reset::. - -`resize [(+/-)lines]' - Grow or shrink a region - -`screen [OPTS] [N] [CMD [ARGS]]' - Create a new window. *Note Screen Command::. - -`scrollback NUM' - Set size of scrollback buffer. *Note Scrollback::. - -`select [N]' - Switch to a specified window. *Note Selecting::. - -`sessionname [NAME]' - Name this session. *Note Session Name::. - -`setenv [VAR [STRING]]' - Set an environment variable for new windows. *Note Setenv::. - -`setsid STATE' - Controll process group creation for windows. *Note Setsid::. - -`shell COMMAND' - Set the default program for new windows. *Note Shell::. - -`shelltitle TITLE' - Set the default name for new windows. *Note Shell::. - -`silence [STATE|SECONDS]' - Monitor a window for inactivity. *Note Silence::. - -`silencewait SECONDS' - Default timeout to trigger an inactivity notify. *Note Silence::. - -`sleep NUM' - Pause during startup. *Note Startup::. - -`slowpaste MSEC' - Slow down pasting in windows. *Note Paste::. - -`source FILE' - Run commands from a file. *Note Source::. - -`sorendition [ATTR [COLOR]]' - Change text highlighting. *Note Sorendition::. - -`split' - Split region into two parts. *Note Regions::. - -`startup_message STATE' - Display copyright notice on startup. *Note Startup::. - -`stuff STRING' - Stuff a string in the input buffer of a window. *Note Paste::. - -`su [USERNAME [PASSWORD [PASSWORD2]]]' - Identify a user. *Note Multiuser Session::. - -`suspend' - Put session in background. *Note Suspend::. - -`term TERM' - Set `$TERM' for new windows. *Note Term::. - -`termcap TERM TERMINAL-TWEAKS [WINDOW-TWEAKS]' - Tweak termcap entries for best performance. *Note Termcap - Syntax::. - -`terminfo TERM TERMINAL-TWEAKS [WINDOW-TWEAKS]' - Ditto, for terminfo systems. *Note Termcap Syntax::. - -`termcapinfo TERM TERMINAL-TWEAKS [WINDOW-TWEAKS]' - Ditto, for both systems. *Note Termcap Syntax::. - -`time [STRING]' - Display time and load average. *Note Time::. - -`title [WINDOWTITLE]' - Set the name of the current window. *Note Title Command::. - -`umask [USERS]+/-BITS ...' - Synonym to `aclumask'. *Note Umask::. - -`unsetenv VAR' - Unset environment variable for new windows. *Note Setenv::. - -`utf8 [STATE [DSTATE]]' - Select character encoding of the current window. *Note Character - Processing::. - -`vbell [STATE]' - Use visual bell. *Note Bell::. - -`vbell_msg [MESSAGE]' - Set vbell message. *Note Bell::. - -`vbellwait SEC' - Set delay for vbell message. *Note Bell::. - -`version' - Display `screen' version. *Note Version::. - -`wall MESSAGE' - Write a message to all displays. *Note Multiuser Session::. - -`width [COLS [LINES]]' - Set the width of the window. *Note Window Size::. - -`windowlist [-b] | string [STRING] | title [TITLE]' - Present a list of all windows for selection. *Note Windowlist::. - -`windows' - List active windows. *Note Windows::. - -`wrap [STATE]' - Control line-wrap behavior. *Note Wrap::. - -`writebuf [-e ENCODING] [FILENAME]' - Write paste buffer to screen-exchange file. *Note Screen - Exchange::. - -`writelock ON|OFF|AUTO' - Grant exclusive write permission. *Note Multiuser Session::. - -`xoff' - Send an XOFF character. *Note XON/XOFF::. - -`xon' - Send an XON character. *Note XON/XOFF::. - -`zmodem [off|auto|catch|pass]' - Define how screen treats zmodem requests. *Note Zmodem::. - -`zombie [KEYS]' - Keep dead windows. *Note Zombie::. - - -File: screen.info, Node: New Window, Next: Selecting, Prev: Commands, Up: Top - -New Window -********** - - This section describes the commands for creating a new window for -running programs. When a new window is created, the first available -number from the range 0...9 is assigned to it. The number of windows -is limited at compile-time by the MAXWIN configuration parameter. - -* Menu: - -* Chdir:: Change the working directory for new windows. -* Screen Command:: Create a new window. -* Setenv:: Set environment variables for new windows. -* Shell:: Parameters for shell windows. -* Term:: Set the terminal type for new windows. -* Window Types:: Creating different types of windows. - - -File: screen.info, Node: Chdir, Next: Screen Command, Up: New Window - -Chdir -===== - - - Command: chdir [directory] - (none) - Change the current directory of `screen' to the specified directory - or, if called without an argument, to your home directory (the - value of the environment variable `$HOME'). All windows that are - created by means of the `screen' command from within `.screenrc' - or by means of `C-a : screen ...' or `C-a c' use this as their - default directory. Without a `chdir' command, this would be the - directory from which `screen' was invoked. Hardcopy and log files - are always written to the _window's_ default directory, _not_ the - current directory of the process running in the window. You can - use this command multiple times in your `.screenrc' to start - various windows in different default directories, but the last - `chdir' value will affect all the windows you create interactively. - - -File: screen.info, Node: Screen Command, Next: Setenv, Prev: Chdir, Up: New Window - -Screen Command -============== - - - Command: screen [opts] [n] [cmd [args]] - (`C-a c', `C-a C-c') - Establish a new window. The flow-control options (`-f', `-fn' and - `-fa'), title option (`-t'), login options (`-l' and `-ln') , - terminal type option (`-T TERM'), the all-capability-flag (`-a') - and scrollback option (`-h NUM') may be specified with each - command. The option (`-M') turns monitoring on for this window. - The option (`-L') turns output logging on for this window. If an - optional number N in the range 0...9 is given, the window number N - is assigned to the newly created window (or, if this number is - already in-use, the next available number). If a command is - specified after `screen', this command (with the given arguments) - is started in the window; otherwise, a shell is created. - - Screen has built in some functionality of `cu' and `telnet'. - *Note Window Types::. - - Thus, if your `.screenrc' contains the lines - - # example for .screenrc: - screen 1 - screen -fn -t foobar 2 -L telnet foobar - -`screen' creates a shell window (in window #1) and a window with a -TELNET connection to the machine foobar (with no flow-control using the -title `foobar' in window #2) and will write a logfile `screenlog.2' of -the telnet session. If you do not include any `screen' commands in -your `.screenrc' file, then `screen' defaults to creating a single -shell window, number zero. When the initialization is completed, -`screen' switches to the last window specified in your .screenrc file -or, if none, it opens default window #0. - - -File: screen.info, Node: Setenv, Next: Shell, Prev: Screen Command, Up: New Window - -Setenv -====== - - - Command: setenv var string - (none) - Set the environment variable VAR to value STRING. If only VAR is - specified, the user will be prompted to enter a value. If no - parameters are specified, the user will be prompted for both - variable and value. The environment is inherited by all - subsequently forked shells. - - - Command: unsetenv var - (none) - Unset an environment variable. - - -File: screen.info, Node: Shell, Next: Term, Prev: Setenv, Up: New Window - -Shell -===== - - - Command: shell command - - Command: defshell command - (none) - Set the command to be used to create a new shell. This overrides - the value of the environment variable `$SHELL'. This is useful if - you'd like to run a tty-enhancer which is expecting to execute the - program specified in `$SHELL'. If the command begins with a `-' - character, the shell will be started as a login-shell. - - `defshell' is currently a synonym to the `shell' command. - - - Command: shelltitle title - (none) - Set the title for all shells created during startup or by the C-a - C-c command. *Note Naming Windows::, for details about what - titles are. - - -File: screen.info, Node: Term, Next: Window Types, Prev: Shell, Up: New Window - -Term -==== - - - Command: term term - (none) - In each window `screen' opens, it sets the `$TERM' variable to - `screen' by default, unless no description for `screen' is - installed in the local termcap or terminfo data base. In that - case it pretends that the terminal emulator is `vt100'. This - won't do much harm, as `screen' is VT100/ANSI compatible. The use - of the `term' command is discouraged for non-default purpose. - That is, one may want to specify special `$TERM' settings (e.g. - vt100) for the next `screen rlogin othermachine' command. Use the - command `screen -T vt100 rlogin othermachine' rather than setting - and resetting the default. - diff --git a/doc/screen.info-2 b/doc/screen.info-2 deleted file mode 100644 index bc2cfdc..0000000 --- a/doc/screen.info-2 +++ /dev/null @@ -1,1171 +0,0 @@ -This is screen.info, produced by makeinfo version 4.5 from -./screen.texinfo. - -INFO-DIR-SECTION General Commands -START-INFO-DIR-ENTRY -* Screen: (screen). Full-screen window manager. -END-INFO-DIR-ENTRY - - This file documents the `Screen' virtual terminal manager. - - Copyright (c) 1993-2003 Free Software Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be stated in a -translation approved by the Foundation. - - -File: screen.info, Node: Window Types, Prev: Term, Up: New Window - -Window Types -============ - - Screen provides three different window types. New windows are created -with `screen''s `screen' command (*note Screen Command::). The first -parameter to the `screen' command defines which type of window is -created. The different window types are all special cases of the normal -type. They have been added in order to allow `screen' to be used -efficiently as a console with 100 or more windows. - * The normal window contains a shell (default, if no parameter is - given) or any other system command that could be executed from a - shell. (e.g. `slogin', etc...). - - * If a tty (character special device) name (e.g. `/dev/ttya') is - specified as the first parameter, then the window is directly - connected to this device. This window type is similar to `screen - cu -l /dev/ttya'. Read and write access is required on the device - node, an exclusive open is attempted on the node to mark the - connection line as busy. An optional parameter is allowed - consisting of a comma separated list of flags in the notation used - by `stty(1)': - `<baud_rate>' - Usually 300, 1200, 9600 or 19200. This affects transmission - as well as receive speed. - - `cs8 or cs7' - Specify the transmission of eight (or seven) bits per byte. - - `ixon or -ixon' - Enables (or disables) software flow-control (CTRL-S/CTRL-Q) - for sending data. - - `ixoff or -ixoff' - Enables (or disables) software flow-control for receiving - data. - - `istrip or -istrip' - Clear (or keep) the eight bit in each received byte. - - You may want to specify as many of these options as applicable. - Unspecified options cause the terminal driver to make up the - parameter values of the connection. These values are system - dependant and may be in defaults or values saved from a previous - connection. - - For tty windows, the `info' command shows some of the modem - control lines in the status line. These may include `RTS', `CTS', - `DTR', `CD' and more. This depends rather on on the available - `ioctl()''s and system header files than on the physical - capabilities of the serial board. The name of a logical low - (inactive) signal is preceded by an exclamation mark (`!'), - otherwise the signal is logical high (active). Unsupported but - shown signals are usually shown low. When the `CLOCAL' status bit - is true, the whole set of modem signals is placed inside curly - braces (`{' and `}'). When the `CRTSCTS' or `TIOCSOFTCAR' bit is - true, the signals `CTS' or `CD' are shown in parenthesis, - respectively. - - For tty windows, the command `break' causes the Data transmission - line (TxD) to go low for a specified period of time. This is - expected to be interpreted as break signal on the other side. No - data is sent and no modem control line is changed when a `break' - is issued. - - * If the first parameter is `//telnet', the second parameter is - expected to be a host name, and an optional third parameter may - specify a TCP port number (default decimal 23). Screen will - connect to a server listening on the remote host and use the - telnet protocol to communicate with that server. - - For telnet windows, the command `info' shows details about the - connection in square brackets (`[' and `]') at the end of the - status line. - `b' - BINARY. The connection is in binary mode. - - `e' - ECHO. Local echo is disabled. - - `c' - SGA. The connection is in `character mode' (default: `line - mode'). - - `t' - TTYPE. The terminal type has been requested by the remote - host. Screen sends the name `screen' unless instructed - otherwise (see also the command `term'). - - `w' - NAWS. The remote site is notified about window size changes. - - `f' - LFLOW. The remote host will send flow control information. - (Ignored at the moment.) - Additional flags for debugging are `x', `t' and `n' (XDISPLOC, - TSPEED and NEWENV). - - For telnet windows, the command `break' sends the telnet code `IAC - BREAK' (decimal 243) to the remote host. - - - -File: screen.info, Node: Selecting, Next: Session Management, Prev: New Window, Up: Top - -Selecting a Window -****************** - - This section describes the commands for switching between windows in -an `screen' session. The windows are numbered from 0 to 9, and are -created in that order by default (*note New Window::). - -* Menu: - -* Next and Previous:: Forward or back one window. -* Other Window:: Switch back and forth between two windows. -* Select:: Switch to a window (and to one after `kill'). -* Windowlist:: Present a list of all windows for selection. - - -File: screen.info, Node: Next and Previous, Next: Other Window, Up: Selecting - -Moving Back and Forth -===================== - - - Command: next - (`C-a <SPC>', `C-a n', `C-a C-n') - Switch to the next window. This command can be used repeatedly to - cycle through the list of windows. (On some terminals, C-<SPC> - generates a NUL character, so you must release the control key - before pressing space.) - - - Command: prev - (`C-a p', `C-a C-p') - Switch to the previous window (the opposite of `C-a n'). - - -File: screen.info, Node: Other Window, Next: Select, Prev: Next and Previous, Up: Selecting - -Other Window -============ - - - Command: other - (`C-a C-a') - Switch to the last window displayed. Note that this command - defaults to the command character typed twice, unless overridden. - For instance, if you use the option `-e]x', this command becomes - `]]' (*note Command Character::). - - -File: screen.info, Node: Select, Next: Windowlist, Prev: Other Window, Up: Selecting - -Select -====== - - - Command: select [n] - (`C-a N', `C-a '') - Switch to the window with the number N. If no window number is - specified, you get prompted for an identifier. This can be a - window name (title) or a number. When a new window is - established, the lowest available number is assigned to this - window. Thus, the first window can be activated by `select 0'; - there can be no more than 10 windows present simultaneously - (unless screen is compiled with a higher MAXWIN setting). There - are two special arguments, `select -' switches to the internal - blank window and `select .' switches to the current window. The - latter is useful if used with screen's `-X' option. - - - -File: screen.info, Node: Windowlist, Prev: Select, Up: Selecting - -Windowlist -========== - - - Command: windowlist [-b] [-m] - - Command: windowlist string [STRING] - - Command: windowlist title [TITLE] - (`C-a "') - Display all windows in a table for visual window selection. The - desired window can be selected via the standard movement keys - (*note Movement::) and activated via the return key. If the `-b' - option is given, screen will switch to the blank window before - presenting the list, so that the current window is also selectable. - The `-m' option changes the order of the windows, instead of - sorting by window numbers screen uses its internal - most-recently-used list. - - The table format can be changed with the string and title option, - the title is displayed as table heading, while the lines are made - by using the string setting. The default setting is `Num - Name%=Flags' for the title and `%3n %t%=%f' for the lines. See the - string escapes chapter (*note String Escapes::) for more codes - (e.g. color settings). - - - -File: screen.info, Node: Session Management, Next: Regions, Prev: Selecting, Up: Top - -Session Management Commands -*************************** - - Perhaps the most useful feature of `screen' is the way it allows the -user to move a session between terminals, by detaching and reattaching. -This also makes life easier for modem users who have to deal with -unexpected loss of carrier. - -* Menu: - -* Detach:: Disconnect `screen' from your terminal. -* Power Detach:: Detach and log out. -* Lock:: Lock your terminal temporarily. -* Multiuser Session:: Changing number of allowed users. -* Session Name:: Rename your session for later reattachment. -* Suspend:: Suspend your session. -* Quit:: Terminate your session. - - -File: screen.info, Node: Detach, Next: Power Detach, Up: Session Management - -Detach -====== - - - Command: autodetach state - (none) - Sets whether `screen' will automatically detach upon hangup, which - saves all your running programs until they are resumed with a - `screen -r' command. When turned off, a hangup signal will - terminate `screen' and all the processes it contains. Autodetach is - on by default. - - - Command: detach - (`C-a d', `C-a C-d') - Detach the `screen' session (disconnect it from the terminal and - put it into the background). A detached `screen' can be resumed by - invoking `screen' with the `-r' option (*note Invoking Screen::). - The `-h' option tells screen to immediately close the connection - to the terminal (`hangup'). - - - Command: password [crypted_pw] - (none) - Present a crypted password in your `.screenrc' file and screen will - ask for it, whenever someone attempts to resume a detached - session. This is useful, if you have privileged programs running - under `screen' and you want to protect your session from reattach - attempts by users that managed to assume your uid. (I.e. any - superuser.) If no crypted password is specified, screen prompts - twice a password and places its encryption in the paste buffer. - Default is `none', which disables password checking. - - -File: screen.info, Node: Power Detach, Next: Lock, Prev: Detach, Up: Session Management - -Power Detach -============ - - - Command: pow_detach - (`C-a D D') - Mainly the same as `detach', but also sends a HANGUP signal to the - parent process of `screen'. - _Caution_: This will result in a logout if `screen' was started - from your login shell. - - - Command: pow_detach_msg [message] - (none) - The MESSAGE specified here is output whenever a power detach is - performed. It may be used as a replacement for a logout message or - to reset baud rate, etc. Without parameter, the current message - is shown. - - -File: screen.info, Node: Lock, Next: Multiuser Session, Prev: Power Detach, Up: Session Management - -Lock -==== - - - Command: lockscreen - (`C-a x', `C-a C-x') - Call a screenlock program (`/local/bin/lck' or `/usr/bin/lock' or - a builtin, if no other is available). Screen does not accept any - command keys until this program terminates. Meanwhile processes in - the windows may continue, as the windows are in the detached state. - The screenlock program may be changed through the environment - variable `$LOCKPRG' (which must be set in the shell from which - `screen' is started) and is executed with the user's uid and gid. - - Warning: When you leave other shells unlocked and have no password - set on `screen', the lock is void: One could easily re-attach from - an unlocked shell. This feature should rather be called - `lockterminal'. - - -File: screen.info, Node: Multiuser Session, Next: Session Name, Prev: Lock, Up: Session Management - -Multiuser Session -================= - - These commands allow other users to gain access to one single -`screen' session. When attaching to a multiuser `screen' the -sessionname is specified as `username/sessionname' to the `-S' command -line option. `Screen' must be compiled with multiuser support to -enable features described here. - -* Menu: - -* Multiuser:: Enable / Disable multiuser mode. -* Acladd:: Enable a specific user. -* Aclchg:: Change a users permissions. -* Acldel:: Disable a specific user. -* Aclgrp:: Grant a user permissions to other users. -* Displays:: List all active users at their displays. -* Umask:: Predefine access to new windows. -* Wall:: Write a message to all users. -* Writelock:: Grant exclusive window access. -* Su:: Substitute user. - - -File: screen.info, Node: Multiuser, Next: Acladd, Up: Multiuser Session - -Multiuser ---------- - - - Command: multiuser STATE - (none) - Switch between single-user and multi-user mode. Standard screen - operation is single-user. In multi-user mode the commands - `acladd', `aclchg' and `acldel' can be used to enable (and - disable) other users accessing this `screen'. - - -File: screen.info, Node: Acladd, Next: Aclchg, Prev: Multiuser, Up: Multiuser Session - -Acladd ------- - - - Command: acladd USERNAMES - - Command: addacl USERNAMES - (none) - Enable users to fully access this screen session. USERNAMES can be - one user or a comma separated list of users. This command enables - to attach to the `screen' session and performs the equivalent of - `aclchg USERNAMES +rwx "#?"'. To add a user with restricted access, - use the `aclchg' command below. `Addacl' is a synonym to `acladd'. - Multi-user mode only. - - -File: screen.info, Node: Aclchg, Next: Acldel, Prev: Acladd, Up: Multiuser Session - -Aclchg ------- - - - Command: aclchg USERNAMES PERMBITS LIST - - Command: chacl USERNAMES PERMBITS LIST - (none) - Change permissions for a comma separated list of users. - Permission bits are represented as `r', `w' and `x'. Prefixing - `+' grants the permission, `-' removes it. The third parameter is - a comma separated list of commands or windows (specified either by - number or title). The special list `#' refers to all windows, `?' - to all commands. If USERNAMES consists of a single `*', all known - users are affected. A command can be executed when the user has - the `x' bit for it. The user can type input to a window when he - has its `w' bit set and no other user obtains a writelock for this - window. Other bits are currently ignored. To withdraw the - writelock from another user in e.g. window 2: `aclchg USERNAME - -w+w 2'. To allow read-only access to the session: `aclchg - USERNAME -w "#"'. As soon as a user's name is known to screen, he - can attach to the session and (per default) has full permissions - for all command and windows. Execution permission for the acl - commands, `at' and others should also be removed or the user may - be able to regain write permission. `Chacl' is a synonym to - `aclchg'. Multi-user mode only. - - -File: screen.info, Node: Acldel, Next: Aclgrp, Prev: Aclchg, Up: Multiuser Session - -Acldel ------- - - - Command: acldel USERNAME - (none) - Remove a user from screen's access control list. If currently - attached, all the user's displays are detached from the session. - He cannot attach again. Multi-user mode only. - - -File: screen.info, Node: Aclgrp, Next: Displays, Prev: Acldel, Up: Multiuser Session - -Aclgrp ------- - - - Command: aclgrp USERNAME [GROUPNAME] - (none) - Creates groups of users that share common access rights. The name - of the group is the username of the group leader. Each member of - the group inherits the permissions that are granted to the - group leader. That means, if a user fails an access check, another - check is made for the group leader. A user is removed from all - groups the special value `none' is used for GROUPNAME. If the - second parameter is omitted all groups the user is in are listed. - - -File: screen.info, Node: Displays, Next: Umask, Prev: Aclgrp, Up: Multiuser Session - -Displays --------- - - - Command: displays - (`C-a *') - Shows a tabular listing of all currently connected user - front-ends (displays). This is most useful for multiuser - sessions. - - -File: screen.info, Node: Umask, Next: Wall, Prev: Displays, Up: Multiuser Session - -aclumask --------- - - - Command: aclumask [USERS]+/-BITS ... - - Command: umask [USERS]+/-BITS ... - (none) - This specifies the access other users have to windows that will - be created by the caller of the command. USERS may be no, one - or a comma separated list of known usernames. If no users are - specified, a list of all currently known users is assumed. BITS - is any combination of access control bits allowed defined - with the `aclchg' command. The special username `?' predefines the - access that not yet known users will be granted to any - window initially. The special username `??' predefines the access - that not yet known users are granted to any command. Rights of - the special username nobody cannot be changed (see the `su' - command). `Umask' is a synonym to `aclumask'. - - -File: screen.info, Node: Wall, Next: Writelock, Prev: Umask, Up: Multiuser Session - -Wall ----- - - - Command: wall MESSAGE - (none) - Write a message to all displays. The message will appear in the - terminal's status line. - - -File: screen.info, Node: Writelock, Next: Su, Prev: Wall, Up: Multiuser Session - -Writelock ---------- - - - Command: writelock ON|OFF|AUTO - (none) - In addition to access control lists, not all users may be able to - write to the same window at once. Per default, writelock is in - `auto' mode and grants exclusive input permission to the user who - is the first to switch to the particular window. When he leaves - the window, other users may obtain the writelock (automatically). - The writelock of the current window is disabled by the command - `writelock off'. If the user issues the command `writelock on' he - keeps the exclusive write permission while switching to other - windows. - - - Command: defwritelock ON|OFF|AUTO - (none) - Sets the default writelock behavior for new windows. Initially all - windows will be created with no writelocks. - - -File: screen.info, Node: Su, Prev: Writelock, Up: Multiuser Session - -Su --- - - - Command: su [USERNAME [PASSWORD [PASSWORD2]]] - (none) - Substitute the user of a display. The command prompts for all - parameters that are omitted. If passwords are specified as - parameters, they have to be specified un-crypted. The first - password is matched against the systems passwd database, the - second password is matched against the `screen' password as - set with the commands `acladd' or `password'. `Su' may be useful - for the `screen' administrator to test multiuser setups. When - the identification fails, the user has access to the commands - available for user `nobody'. These are `detach', `license', - `version', `help' and `displays'. - - -File: screen.info, Node: Session Name, Next: Suspend, Prev: Multiuser Session, Up: Session Management - -Session Name -============ - - - Command: sessionname [NAME] - (none) - Rename the current session. Note that for `screen -list' the name - shows up with the process-id prepended. If the argument NAME is - omitted, the name of this session is displayed. - _Caution_: The `$STY' environment variable still reflects the old - name. This may result in confusion. The default is constructed - from the tty and host names. - - -File: screen.info, Node: Suspend, Next: Quit, Prev: Session Name, Up: Session Management - -Suspend -======= - - - Command: suspend - (`C-a z', `C-a C-z') - Suspend `screen'. The windows are in the detached state while - `screen' is suspended. This feature relies on the parent shell - being able to do job control. - - -File: screen.info, Node: Quit, Prev: Suspend, Up: Session Management - -Quit -==== - - - Command: quit - (`C-a C-\') - Kill all windows and terminate `screen'. Note that on VT100-style - terminals the keys `C-4' and `C-\' are identical. So be careful - not to type `C-a C-4' when selecting window no. 4. Use the empty - bind command (as in `bind "^\"') to remove a key binding (*note - Key Binding::). - - -File: screen.info, Node: Regions, Next: Window Settings, Prev: Session Management, Up: Top - -Regions -******* - - Screen has the ability to display more than one window on the user's -display. This is done by splitting the screen in regions, which can -contain different windows. - -* Menu: - -* Split:: Split a region into two -* Focus:: Change to the next region -* Only:: Delete all other regions -* Remove:: Delete the current region -* Resize:: Grow or shrink a region -* Caption:: Control the window's caption -* Fit:: Resize a window to fit the region - - -File: screen.info, Node: Split, Next: Focus, Up: Regions - -Split -===== - - - Command: split - (`C-a S') - Split the current region into two new ones. All regions on the - display are resized to make room for the new region. The blank - window is displayed on the new region. - - -File: screen.info, Node: Focus, Next: Only, Prev: Split, Up: Regions - -Focus -===== - - - Command: focus - (`C-a <Tab>') - Move the input focus to the next region. This is done in a cyclic - way so that the top region is selected after the bottom one. If no - subcommand is given it defaults to `down'. `up' cycles in the - opposite order, `top' and `bottom' go to the top and bottom region - respectively. Useful bindings are (j and k as in vi) - bind j focus down - bind k focus up - bind t focus top - bind b focus bottom - - -File: screen.info, Node: Only, Next: Remove, Prev: Focus, Up: Regions - -Only -==== - - - Command: only - (`C-a Q') - Kill all regions but the current one. - - -File: screen.info, Node: Remove, Next: Resize, Prev: Only, Up: Regions - -Remove -====== - - - Command: remove - (`C-a X') - Kill the current region. This is a no-op if there is only one - region. - - -File: screen.info, Node: Resize, Next: Caption, Prev: Remove, Up: Regions - -Resize -====== - - - Command: resize [(+/-)LINES] - (none) - Resize the current region. The space will be removed from or added - to the region below or if there's not enough space from the region - above. - resize +N increase current region height by N - resize -N decrease current region height by N - resize N set current region height to N - resize = make all windows equally high - resize max maximize current region height - resize min minimize current region height - - -File: screen.info, Node: Caption, Next: Fit, Prev: Resize, Up: Regions - -Caption -======= - - - Command: caption `always'|`splitonly' [string] - - Command: caption `string' [string] - (none) - This command controls the display of the window captions. Normally - a caption is only used if more than one window is shown on the - display (split screen mode). But if the type is set to `always', - `screen' shows a caption even if only one window is displayed. The - default is `splitonly'. - - The second form changes the text used for the caption. You can use - all string escapes (*note String Escapes::). `Screen' uses a - default of `%3n %t'. - - You can mix both forms by providing the string as an additional - argument. - - -File: screen.info, Node: Fit, Prev: Caption, Up: Regions - -Fit -=== - - - Command: fit - (`C-a F') - Change the window size to the size of the current region. This - command is needed because screen doesn't adapt the window size - automatically if the window is displayed more than once. - - -File: screen.info, Node: Window Settings, Next: Virtual Terminal, Prev: Regions, Up: Top - -Window Settings -*************** - - These commands control the way `screen' treats individual windows in -a session. *Note Virtual Terminal::, for commands to control the -terminal emulation itself. - -* Menu: - -* Naming Windows:: Control the name of the window -* Console:: See the host's console messages -* Kill:: Destroy an unwanted window -* Login:: Control `/etc/utmp' logging -* Mode:: Control the file mode of the pty -* Monitor:: Watch for activity in a window -* Windows:: List the active windows -* Hardstatus:: Set a window's hardstatus line - - -File: screen.info, Node: Naming Windows, Next: Console, Up: Window Settings - -Naming Windows (Titles) -======================= - - You can customize each window's name in the window display (viewed -with the `windows' command (*note Windows::) by setting it with one of -the title commands. Normally the name displayed is the actual command -name of the program created in the window. However, it is sometimes -useful to distinguish various programs of the same name or to change -the name on-the-fly to reflect the current state of the window. - - The default name for all shell windows can be set with the -`shelltitle' command (*note Shell::). You can specify the name you -want for a window with the `-t' option to the `screen' command when the -window is created (*note Screen Command::). To change the name after -the window has been created you can use the title-string escape-sequence -(`<ESC> k NAME <ESC> \') and the `title' command (C-a A). The former -can be output from an application to control the window's name under -software control, and the latter will prompt for a name when typed. -You can also bind predefined names to keys with the `title' command to -set things quickly without prompting. - -* Menu: - -* Title Command:: The `title' command. -* Dynamic Titles:: Make shell windows change titles dynamically. -* Title Prompts:: Set up your shell prompt for dynamic Titles. -* Title Screenrc:: Set up Titles in your `.screenrc'. - - -File: screen.info, Node: Title Command, Next: Dynamic Titles, Up: Naming Windows - -Title Command -------------- - - - Command: title [windowtitle] - (`C-a A') - Set the name of the current window to WINDOWTITLE. If no name is - specified, screen prompts for one. - - -File: screen.info, Node: Dynamic Titles, Next: Title Prompts, Prev: Title Command, Up: Naming Windows - -Dynamic Titles --------------- - - `screen' has a shell-specific heuristic that is enabled by setting -the window's name to SEARCH|NAME and arranging to have a null title -escape-sequence output as a part of your prompt. The SEARCH portion -specifies an end-of-prompt search string, while the NAME portion -specifies the default shell name for the window. If the NAME ends in a -`:' `screen' will add what it believes to be the current command -running in the window to the end of the specified name (e.g. NAME:CMD). -Otherwise the current command name supersedes the shell name while it -is running. - - Here's how it works: you must modify your shell prompt to output a -null title-escape-sequence (<ESC> k <ESC> \) as a part of your prompt. -The last part of your prompt must be the same as the string you -specified for the SEARCH portion of the title. Once this is set up, -`screen' will use the title-escape-sequence to clear the previous -command name and get ready for the next command. Then, when a newline -is received from the shell, a search is made for the end of the prompt. -If found, it will grab the first word after the matched string and use -it as the command name. If the command name begins with `!', `%', or -`^', `screen' will use the first word on the following line (if found) -in preference to the just-found name. This helps csh users get more -accurate titles when using job control or history recall commands. - - -File: screen.info, Node: Title Prompts, Next: Title Screenrc, Prev: Dynamic Titles, Up: Naming Windows - -Setting up your prompt for shell titles ---------------------------------------- - - One thing to keep in mind when adding a null title-escape-sequence -to your prompt is that some shells (like the csh) count all the -non-control characters as part of the prompt's length. If these -invisible characters aren't a multiple of 8 then backspacing over a tab -will result in an incorrect display. One way to get around this is to -use a prompt like this: - - set prompt='[0000mk\% ' - - The escape-sequence `[0000m' not only normalizes the character -attributes, but all the zeros round the length of the invisible -characters up to 8. - - Tcsh handles escape codes in the prompt more intelligently, so you -can specify your prompt like this: - - set prompt="%{\ek\e\\%}\% " - - Bash users will probably want to echo the escape sequence in the -PROMPT_COMMAND: - - PROMPT_COMMAND='echo -n -e "\033k\033\134"' - - (I used `\134' to output a `\' because of a bug in v1.04). - - -File: screen.info, Node: Title Screenrc, Prev: Title Prompts, Up: Naming Windows - -Setting up shell titles in your `.screenrc' -------------------------------------------- - - Here are some .screenrc examples: - - screen -t top 2 nice top - - Adding this line to your .screenrc would start a niced version of the -`top' command in window 2 named `top' rather than `nice'. - - shelltitle '> |csh' - screen 1 - - This file would start a shell using the given shelltitle. The title -specified is an auto-title that would expect the prompt and the typed -command to look something like the following: - - /usr/joe/src/dir> trn - - (it looks after the '> ' for the command name). The window status -would show the name `trn' while the command was running, and revert to -`csh' upon completion. - - bind R screen -t '% |root:' su - - Having this command in your .screenrc would bind the key sequence -`C-a R' to the `su' command and give it an auto-title name of `root:'. -For this auto-title to work, the screen could look something like this: - - % !em - emacs file.c - - Here the user typed the csh history command `!em' which ran the -previously entered `emacs' command. The window status would show -`root:emacs' during the execution of the command, and revert to simply -`root:' at its completion. - - bind o title - bind E title "" - bind u title (unknown) - - The first binding doesn't have any arguments, so it would prompt you -for a title when you type `C-a o'. The second binding would clear an -auto-titles current setting (C-a E). The third binding would set the -current window's title to `(unknown)' (C-a u). - - -File: screen.info, Node: Console, Next: Kill, Prev: Naming Windows, Up: Window Settings - -Console -======= - - - Command: console [STATE] - (none) - Grabs or un-grabs the machines console output to a window. When - the argument is omitted the current state is displayed. _Note_: - Only the owner of `/dev/console' can grab the console output. This - command is only available if the host supports the ioctl - `TIOCCONS'. - - -File: screen.info, Node: Kill, Next: Login, Prev: Console, Up: Window Settings - -Kill -==== - - - Command: kill - (`C-a k', `C-a C-k') - Kill the current window. - If there is an `exec' command running (*note Exec::) then it is - killed. Otherwise the process (e.g. shell) running in the window - receives a `HANGUP' condition, the window structure is removed and - screen (your display) switches to another window. When the last - window is destroyed, `screen' exits. After a kill screen switches - to the previously displayed window. - _Caution_: `emacs' users may find themselves killing their `emacs' - session when trying to delete the current line. For this reason, - it is probably wise to use a different command character (*note - Command Character::) or rebind `kill' to another key sequence, - such as `C-a K' (*note Key Binding::). - - -File: screen.info, Node: Login, Next: Mode, Prev: Kill, Up: Window Settings - -Login -===== - - - Command: deflogin state - (none) - Same as the `login' command except that the default setting for new - windows is changed. This defaults to `on' unless otherwise - specified at compile time (*note Installation::). Both commands - are only present when `screen' has been compiled with utmp support. - - - Command: login [state] - (`C-a L') - Adds or removes the entry in `/etc/utmp' for the current window. - This controls whether or not the window is "logged in". In - addition to this toggle, it is convenient to have "log in" and - "log out" keys. For instance, `bind I login on' and `bind O login - off' will map these keys to be `C-a I' and `C-a O' (*note Key - Binding::). - - -File: screen.info, Node: Mode, Next: Monitor, Prev: Login, Up: Window Settings - -Mode -==== - - - Command: defmode mode - (none) - The mode of each newly allocated pseudo-tty is set to MODE. MODE - is an octal number as used by chmod(1). Defaults to 0622 for - windows which are logged in, 0600 for others (e.g. when `-ln' was - specified for creation, *note Screen Command::). - - -File: screen.info, Node: Monitor, Next: Windows, Prev: Mode, Up: Window Settings - -Monitoring -========== - - - Command: activity message - (none) - When any activity occurs in a background window that is being - monitored, `screen' displays a notification in the message line. - The notification message can be redefined by means of the - `activity' command. Each occurrence of `%' in MESSAGE is replaced - by the number of the window in which activity has occurred, and - each occurrence of `^G' is replaced by the definition for bell in - your termcap (usually an audible bell). The default message is - - 'Activity in window %n' - - Note that monitoring is off for all windows by default, but can be - altered by use of the `monitor' command (`C-a M'). - - - Command: defmonitor state - (none) - Same as the `monitor' command except that the default setting for - new windows is changed. Initial setting is `off'. - - - Command: monitor [state] - (`C-a M') - Toggles monitoring of the current window. When monitoring is - turned on and the affected window is switched into the background, - the activity notification message will be displayed in the status - line at the first sign of output, and the window will also be - marked with an `@' in the window-status display (*note Windows::). - Monitoring defaults to `off' for all windows. - - -File: screen.info, Node: Windows, Next: Hardstatus, Prev: Monitor, Up: Window Settings - -Windows -======= - - - Command: windows - (`C-a w', `C-a C-w') - Uses the message line to display a list of all the windows. Each - window is listed by number with the name of the program running in - the window (or its title). - - The current window is marked with a `*'; the previous window is - marked with a `-'; all the windows that are logged in are marked - with a `$' (*note Login::); a background window that has received - a bell is marked with a `!'; a background window that is being - monitored and has had activity occur is marked with an `@' (*note - Monitor::); a window which has output logging turned on is marked - with `(L)'; windows occupied by other users are marked with `&' or - `&&' if the window is shared by other users; windows in the zombie - state are marked with `Z'. - - If this list is too long to fit on the terminal's status line only - the portion around the current window is displayed. - - -File: screen.info, Node: Hardstatus, Prev: Windows, Up: Window Settings - -Hardstatus -========== - - `Screen' maintains a hardstatus line for every window. If a window -gets selected, the display's hardstatus will be updated to match the -window's hardstatus line. The hardstatus line can be changed with the -ANSI Application Program Command (APC): `ESC_<string>ESC\'. As a -convenience for xterm users the sequence `ESC]0..2;<string>^G' is also -accepted. - - - Command: defhstatus [status] - (none) - The hardstatus line that all new windows will get is set to STATUS. - This command is useful to make the hardstatus of every window - display the window number or title or the like. STATUS may - contain the same directives as in the window messages, but the - directive escape character is `^E' (octal 005) instead of `%'. - This was done to make a misinterpretation of program generated - hardstatus lines impossible. If the parameter STATUS is omitted, - the current default string is displayed. Per default the - hardstatus line of new windows is empty. - - - Command: hstatus status - (none) - Changes the current window's hardstatus line to STATUS. - - -File: screen.info, Node: Virtual Terminal, Next: Copy and Paste, Prev: Window Settings, Up: Top - -Virtual Terminal -**************** - - Each window in a `screen' session emulates a VT100 terminal, with -some extra functions added. The VT100 emulator is hard-coded, no other -terminal types can be emulated. The commands described here modify the -terminal emulation. - -* Menu: - -* Control Sequences:: Details of the internal VT100 emulation. -* Input Translation:: How keystrokes are remapped. -* Digraph:: Entering digraph sequences. -* Bell:: Getting your attention. -* Clear:: Clear the window display. -* Info:: Terminal emulation statistics. -* Redisplay:: When the display gets confusing. -* Wrap:: Automatic margins. -* Reset:: Recovering from ill-behaved applications. -* Window Size:: Changing the size of your terminal. -* Character Processing:: Change the effect of special characters. - - -File: screen.info, Node: Control Sequences, Next: Input Translation, Up: Virtual Terminal - -Control Sequences -================= - - The following is a list of control sequences recognized by `screen'. -`(V)' and `(A)' indicate VT100-specific and ANSI- or ISO-specific -functions, respectively. - - ESC E Next Line - ESC D Index - ESC M Reverse Index - ESC H Horizontal Tab Set - ESC Z Send VT100 Identification String - ESC 7 (V) Save Cursor and Attributes - ESC 8 (V) Restore Cursor and Attributes - ESC [s (A) Save Cursor and Attributes - ESC [u (A) Restore Cursor and Attributes - ESC c Reset to Initial State - ESC g Visual Bell - ESC Pn p Cursor Visibility (97801) - Pn = 6 Invisible - 7 Visible - ESC = (V) Application Keypad Mode - ESC > (V) Numeric Keypad Mode - ESC # 8 (V) Fill Screen with E's - ESC \ (A) String Terminator - ESC ^ (A) Privacy Message String (Message Line) - ESC ! Global Message String (Message Line) - ESC k Title Definition String - ESC P (A) Device Control String - Outputs a string directly to the host - terminal without interpretation. - ESC _ (A) Application Program Command (Hardstatus) - ESC ] 0 ; string ^G (A) Operating System Command (Hardstatus, xterm - title hack) - ESC ] 83 ; cmd ^G (A) Execute screen command. This only works if - multi-user support is compiled into screen. - The pseudo-user ":window:" is used to check - the access control list. Use "addacl :window: - -rwx #?" to create a user with no rights and - allow only the needed commands. - Control-N (A) Lock Shift G1 (SO) - Control-O (A) Lock Shift G0 (SI) - ESC n (A) Lock Shift G2 - ESC o (A) Lock Shift G3 - ESC N (A) Single Shift G2 - ESC O (A) Single Shift G3 - ESC ( Pcs (A) Designate character set as G0 - ESC ) Pcs (A) Designate character set as G1 - ESC * Pcs (A) Designate character set as G2 - ESC + Pcs (A) Designate character set as G3 - ESC [ Pn ; Pn H Direct Cursor Addressing - ESC [ Pn ; Pn f same as above - ESC [ Pn J Erase in Display - Pn = None or 0 From Cursor to End of Screen - 1 From Beginning of Screen to Cursor - 2 Entire Screen - ESC [ Pn K Erase in Line - Pn = None or 0 From Cursor to End of Line - 1 From Beginning of Line to Cursor - 2 Entire Line - ESC [ Pn X Erase character - ESC [ Pn A Cursor Up - ESC [ Pn B Cursor Down - ESC [ Pn C Cursor Right - ESC [ Pn D Cursor Left - ESC [ Pn E Cursor next line - ESC [ Pn F Cursor previous line - ESC [ Pn G Cursor horizontal position - ESC [ Pn ` same as above - ESC [ Pn d Cursor vertical position - ESC [ Ps ;...; Ps m Select Graphic Rendition - Ps = None or 0 Default Rendition - 1 Bold - 2 (A) Faint - 3 (A) Standout Mode (ANSI: Italicized) - 4 Underlined - 5 Blinking - 7 Negative Image - 22 (A) Normal Intensity - 23 (A) Standout Mode off (ANSI: Italicized off) - 24 (A) Not Underlined - 25 (A) Not Blinking - 27 (A) Positive Image - 30 (A) Foreground Black - 31 (A) Foreground Red - 32 (A) Foreground Green - 33 (A) Foreground Yellow - 34 (A) Foreground Blue - 35 (A) Foreground Magenta - 36 (A) Foreground Cyan - 37 (A) Foreground White - 39 (A) Foreground Default - 40 (A) Background Black - ... ... - 49 (A) Background Default - ESC [ Pn g Tab Clear - Pn = None or 0 Clear Tab at Current Position - 3 Clear All Tabs - ESC [ Pn ; Pn r (V) Set Scrolling Region - ESC [ Pn I (A) Horizontal Tab - ESC [ Pn Z (A) Backward Tab - ESC [ Pn L (A) Insert Line - ESC [ Pn M (A) Delete Line - ESC [ Pn @ (A) Insert Character - ESC [ Pn P (A) Delete Character - ESC [ Pn S Scroll Scrolling Region Up - ESC [ Pn T Scroll Scrolling Region Down - ESC [ Pn ^ same as above - ESC [ Ps ;...; Ps h Set Mode - ESC [ Ps ;...; Ps l Reset Mode - Ps = 4 (A) Insert Mode - 20 (A) `Automatic Linefeed' Mode. - 34 Normal Cursor Visibility - ?1 (V) Application Cursor Keys - ?3 (V) Change Terminal Width to 132 columns - ?5 (V) Reverse Video - ?6 (V) `Origin' Mode - ?7 (V) `Wrap' Mode - ?9 X10 mouse tracking - ?25 (V) Visible Cursor - ?47 Alternate Screen (old xterm code) - ?1000 (V) VT200 mouse tracking - ?1047 Alternate Screen (new xterm code) - ?1049 Alternate Screen (new xterm code) - ESC [ 5 i (A) Start relay to printer (ANSI Media Copy) - ESC [ 4 i (A) Stop relay to printer (ANSI Media Copy) - ESC [ 8 ; Ph ; Pw t Resize the window to `Ph' lines and - `Pw' columns (SunView special) - ESC [ c Send VT100 Identification String - ESC [ x (V) Send Terminal Parameter Report - ESC [ > c Send Secondary Device Attributes String - ESC [ 6 n Send Cursor Position Report - diff --git a/doc/screen.info-3 b/doc/screen.info-3 deleted file mode 100644 index 6c78005..0000000 --- a/doc/screen.info-3 +++ /dev/null @@ -1,1255 +0,0 @@ -This is screen.info, produced by makeinfo version 4.5 from -./screen.texinfo. - -INFO-DIR-SECTION General Commands -START-INFO-DIR-ENTRY -* Screen: (screen). Full-screen window manager. -END-INFO-DIR-ENTRY - - This file documents the `Screen' virtual terminal manager. - - Copyright (c) 1993-2003 Free Software Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be stated in a -translation approved by the Foundation. - - -File: screen.info, Node: Input Translation, Next: Digraph, Prev: Control Sequences, Up: Virtual Terminal - -Input Translation -================= - - In order to do a full VT100 emulation `screen' has to detect that a -sequence of characters in the input stream was generated by a keypress -on the user's keyboard and insert the VT100 style escape sequence. -`Screen' has a very flexible way of doing this by making it possible to -map arbitrary commands on arbitrary sequences of characters. For -standard VT100 emulation the command will always insert a string in the -input buffer of the window (see also command `stuff', *note Paste::). -Because the sequences generated by a keypress can change after a -reattach from a different terminal type, it is possible to bind -commands to the termcap name of the keys. `Screen' will insert the -correct binding after each reattach. See *Note Bindkey:: for further -details on the syntax and examples. - - Here is the table of the default key bindings. (A) means that the -command is executed if the keyboard is switched into application mode. - - Key name Termcap name Command - ----------------------------------------------------- - Cursor up ku stuff \033[A - stuff \033OA (A) - Cursor down kd stuff \033[B - stuff \033OB (A) - Cursor right kr stuff \033[C - stuff \033OC (A) - Cursor left kl stuff \033[D - stuff \033OD (A) - Function key 0 k0 stuff \033[10~ - Function key 1 k1 stuff \033OP - Function key 2 k2 stuff \033OQ - Function key 3 k3 stuff \033OR - Function key 4 k4 stuff \033OS - Function key 5 k5 stuff \033[15~ - Function key 6 k6 stuff \033[17~ - Function key 7 k7 stuff \033[18~ - Function key 8 k8 stuff \033[19~ - Function key 9 k9 stuff \033[20~ - Function key 10 k; stuff \033[21~ - Function key 11 F1 stuff \033[23~ - Function key 12 F2 stuff \033[24~ - Home kh stuff \033[1~ - End kH stuff \033[4~ - Insert kI stuff \033[2~ - Delete kD stuff \033[3~ - Page up kP stuff \033[5~ - Page down kN stuff \033[6~ - Keypad 0 f0 stuff 0 - stuff \033Op (A) - Keypad 1 f1 stuff 1 - stuff \033Oq (A) - Keypad 2 f2 stuff 2 - stuff \033Or (A) - Keypad 3 f3 stuff 3 - stuff \033Os (A) - Keypad 4 f4 stuff 4 - stuff \033Ot (A) - Keypad 5 f5 stuff 5 - stuff \033Ou (A) - Keypad 6 f6 stuff 6 - stuff \033Ov (A) - Keypad 7 f7 stuff 7 - stuff \033Ow (A) - Keypad 8 f8 stuff 8 - stuff \033Ox (A) - Keypad 9 f9 stuff 9 - stuff \033Oy (A) - Keypad + f+ stuff + - stuff \033Ok (A) - Keypad - f- stuff - - stuff \033Om (A) - Keypad * f* stuff * - stuff \033Oj (A) - Keypad / f/ stuff / - stuff \033Oo (A) - Keypad = fq stuff = - stuff \033OX (A) - Keypad . f. stuff . - stuff \033On (A) - Keypad , f, stuff , - stuff \033Ol (A) - Keypad enter fe stuff \015 - stuff \033OM (A) - - -File: screen.info, Node: Digraph, Next: Bell, Prev: Input Translation, Up: Virtual Terminal - -Digraph -======= - - - Command: digraph [preset] - (none) - This command prompts the user for a digraph sequence. The next two - characters typed are looked up in a builtin table and the - resulting character is inserted in the input stream. For example, - if the user enters `a"', an a-umlaut will be inserted. If the - first character entered is a 0 (zero), `screen' will treat the - following characters (up to three) as an octal number instead. - The optional argument PRESET is treated as user input, thus one - can create an "umlaut" key. For example the command `bindkey ^K - digraph '"'' enables the user to generate an a-umlaut by typing - `CTRL-K a'. - - -File: screen.info, Node: Bell, Next: Clear, Prev: Digraph, Up: Virtual Terminal - -Bell -==== - - - Command: bell_msg [message] - (none) - When a bell character is sent to a background window, `screen' - displays a notification in the message line. The notification - message can be re-defined by this command. Each occurrence of `%' - in MESSAGE is replaced by the number of the window to which a bell - has been sent, and each occurrence of `^G' is replaced by the - definition for bell in your termcap (usually an audible bell). - The default message is - - 'Bell in window %n' - - An empty message can be supplied to the `bell_msg' command to - suppress output of a message line (`bell_msg ""'). Without - parameter, the current message is shown. - - - Command: vbell [state] - (`C-a C-g') - Sets or toggles the visual bell setting for the current window. If - `vbell' is switched to `on', but your terminal does not support a - visual bell, the visual bell message is displayed in the status - line when the bell character is received. Visual bell support of - a terminal is defined by the termcap variable `vb'. *Note Visual - Bell: (termcap)Bell, for more information on visual bells. The - equivalent terminfo capability is `flash'. - - Per default, `vbell' is `off', thus the audible bell is used. - - - Command: vbell_msg [message] - (none) - Sets the visual bell message. MESSAGE is printed to the status - line if the window receives a bell character (^G), `vbell' is set - to `on' and the terminal does not support a visual bell. The - default message is `Wuff, Wuff!!'. Without parameter, the current - message is shown. - - - Command: vbellwait sec - (none) - Define a delay in seconds after each display of `screen' 's visual - bell message. The default is 1 second. - - -File: screen.info, Node: Clear, Next: Info, Prev: Bell, Up: Virtual Terminal - -Clear -===== - - - Command: clear - (`C-a C') - Clears the screen and saves its contents to the scrollback buffer. - - -File: screen.info, Node: Info, Next: Redisplay, Prev: Clear, Up: Virtual Terminal - -Info -==== - - - Command: info - (`C-a i', `C-a C-i') - Uses the message line to display some information about the current - window: the cursor position in the form `(COLUMN,ROW)' starting - with `(1,1)', the terminal width and height plus the size of the - scrollback buffer in lines, like in `(80,24)+50', the current - state of window XON/XOFF flow control is shown like this (*note - Flow Control::): - +flow automatic flow control, currently on. - -flow automatic flow control, currently off. - +(+)flow flow control enabled. Agrees with automatic control. - -(+)flow flow control disabled. Disagrees with automatic control. - +(-)flow flow control enabled. Disagrees with automatic control. - -(-)flow flow control disabled. Agrees with automatic control. - - The current line wrap setting (`+wrap' indicates enabled, `-wrap' - not) is also shown. The flags `ins', `org', `app', `log', `mon' - and `nored' are displayed when the window is in insert mode, - origin mode, application-keypad mode, has output logging, activity - monitoring or partial redraw enabled. - - The currently active character set (`G0', `G1', `G2', or `G3'), - and in square brackets the terminal character sets that are - currently designated as `G0' through `G3'. If the window is in - UTF-8 mode, the string `UTF-8' is shown instead. Additional modes - depending on the type of the window are displayed at the end of - the status line (*note Window Types::). - - If the state machine of the terminal emulator is in a non-default - state, the info line is started with a string identifying the - current state. - - For system information use `time'. - - - Command: dinfo - (none) - Show what screen thinks about your terminal. Useful if you want to - know why features like color or the alternate charset don't work. - - -File: screen.info, Node: Redisplay, Next: Wrap, Prev: Info, Up: Virtual Terminal - -Redisplay -========= - - - Command: allpartial state - (none) - If set to on, only the current cursor line is refreshed on window - change. This affects all windows and is useful for slow terminal - lines. The previous setting of full/partial refresh for each - window is restored with `allpartial off'. This is a global flag - that immediately takes effect on all windows overriding the - `partial' settings. It does not change the default redraw behavior - of newly created windows. - - - Command: altscreen state - (none) - If set to on, "alternate screen" support is enabled in virtual - terminals, just like in xterm. Initial setting is `off'. - - - Command: partial state - (none) - Defines whether the display should be refreshed (as with - `redisplay') after switching to the current window. This command - only affects the current window. To immediately affect all - windows use the `allpartial' command. Default is `off', of - course. This default is fixed, as there is currently no - `defpartial' command. - - - Command: redisplay - (`C-a l', `C-a C-l') - Redisplay the current window. Needed to get a full redisplay in - partial redraw mode. - - -File: screen.info, Node: Wrap, Next: Reset, Prev: Redisplay, Up: Virtual Terminal - -Wrap -==== - - - Command: wrap state - (`C-a r', `C-a C-r') - Sets the line-wrap setting for the current window. When line-wrap - is on, the second consecutive printable character output at the - last column of a line will wrap to the start of the following - line. As an added feature, backspace (^H) will also wrap through - the left margin to the previous line. Default is `on'. - - - Command: defwrap state - (none) - Same as the `wrap' command except that the default setting for new - windows is changed. Initially line-wrap is on and can be toggled - with the `wrap' command (`C-a r') or by means of "C-a : wrap - on|off". - - -File: screen.info, Node: Reset, Next: Window Size, Prev: Wrap, Up: Virtual Terminal - -Reset -===== - - - Command: reset - (`C-a Z') - Reset the virtual terminal to its "power-on" values. Useful when - strange settings (like scroll regions or graphics character set) - are left over from an application. - - -File: screen.info, Node: Window Size, Next: Character Processing, Prev: Reset, Up: Virtual Terminal - -Window Size -=========== - - - Command: width [`-w'|`-d'] [cols [lines]] - (`C-a W') - Toggle the window width between 80 and 132 columns, or set it to - COLS columns if an argument is specified. This requires a capable - terminal and the termcap entries `Z0' and `Z1'. See the `termcap' - command (*note Termcap::), for more information. You can also - specify a height if you want to change both values. The `-w' - option tells screen to leave the display size unchanged and just - set the window size, `-d' vice versa. - - - Command: height [`-w'|`-d'] [lines [cols]] - (none) - Set the display height to a specified number of lines. When no - argument is given it toggles between 24 and 42 lines display. - - -File: screen.info, Node: Character Processing, Prev: Window Size, Up: Virtual Terminal - -Character Processing -==================== - - - Command: c1 [state] - (none) - Change c1 code processing. `c1 on' tells screen to treat the input - characters between 128 and 159 as control functions. Such an - 8-bit code is normally the same as ESC followed by the - corresponding 7-bit code. The default setting is to process c1 - codes and can be changed with the `defc1' command. Users with - fonts that have usable characters in the c1 positions may want to - turn this off. - - - - Command: gr [state] - (none) - Turn GR charset switching on/off. Whenever screen sees an input - char with an 8th bit set, it will use the charset stored in the GR - slot and print the character with the 8th bit stripped. The - default (see also `defgr') is not to process GR switching because - otherwise the ISO88591 charset would not work. - - - Command: bce [state] - (none) - Change background-color-erase setting. If `bce' is set to on, all - characters cleared by an erase/insert/scroll/clear operation will - be displayed in the current background color. Otherwise the - default background color is used. - - - Command: encoding enc [denc] - (none) - Tell screen how to interpret the input/output. The first argument - sets the encoding of the current window. Each window can emulate - a different encoding. The optional second parameter overwrites the - encoding of the connected terminal. It should never be needed as - screen uses the locale setting to detect the encoding. There is - also a way to select a terminal encoding depending on the terminal - type by using the `KJ' termcap entry. *Note Special Capabilities::. - - Supported encodings are `eucJP', `SJIS', `eucKR', `eucCN', `Big5', - `GBK', `KOI8-R', `CP1251', `UTF-8', `ISO8859-2', `ISO8859-3', - `ISO8859-4', `ISO8859-5', `ISO8859-6', `ISO8859-7', `ISO8859-8', - `ISO8859-9', `ISO8859-10', `ISO8859-15', `jis'. - - See also `defencoding', which changes the default setting of a new - window. - - - Command: charset set - (none) - Change the current character set slot designation and charset - mapping. The first four character of SET are treated as charset - designators while the fifth and sixth character must be in range - `0' to `3' and set the GL/GR charset mapping. On every position a - `.' may be used to indicate that the corresponding charset/mapping - should not be changed (SET is padded to six characters internally - by appending `.' chars). New windows have `BBBB02' as default - charset, unless a `encoding' command is active. - - The current setting can be viewed with the *Note Info:: command. - - - Command: utf8 [state [dstate]] - (none) - Change the encoding used in the current window. If utf8 is - enabled, the strings sent to the window will be UTF-8 encoded and - vice versa. Omitting the parameter toggles the setting. If a - second parameter is given, the display's encoding is also changed - (this should rather be done with screen's `-U' option). See also - `defutf8', which changes the default setting of a new window. - - - Command: defc1 state - (none) - Same as the `c1' command except that the default setting for new - windows is changed. Initial setting is `on'. - - - Command: defgr state - (none) - Same as the `gr' command except that the default setting for new - windows is changed. Initial setting is `off'. - - - Command: defbce state - (none) - Same as the `bce' command except that the default setting for new - windows is changed. Initial setting is `off'. - - - Command: defencoding enc - (none) - Same as the `encoding' command except that the default setting for - new windows is changed. Initial setting is the encoding taken from - the terminal. - - - Command: defcharset [set] - Like the `charset' command except that the default setting for new - windows is changed. Shows current default if called without - argument. - - - Command: defutf8 state - (none) - Same as the `utf8' command except that the default setting for new - windows is changed. Initial setting is `on' if screen was started - with `-U', otherwise `off'. - - -File: screen.info, Node: Copy and Paste, Next: Subprocess Execution, Prev: Virtual Terminal, Up: Top - -Copy and Paste -************** - - For those confined to a hardware terminal, these commands provide a -cut and paste facility more powerful than those provided by most -windowing systems. - -* Menu: - -* Copy:: Copy from scrollback to buffer -* Paste:: Paste from buffer into window -* Registers:: Longer-term storage -* Screen Exchange:: Sharing data between screen users -* History:: Recalling previous input - - -File: screen.info, Node: Copy, Next: Paste, Up: Copy and Paste - -Copying -======= - - - Command: copy - (`C-a [', `C-a C-[', `C-a <ESC>') - Enter copy/scrollback mode. This allows you to copy text from the - current window and its history into the paste buffer. In this mode - a `vi'-like full screen editor is active, with controls as - outlined below. - -* Menu: - -* Line Termination:: End copied lines with CR/LF -* Scrollback:: Set the size of the scrollback buffer -* Copy Mode Keys:: Remap keys in copy mode -* Movement:: Move around in the scrollback buffer -* Marking:: Select the text you want -* Repeat count:: Repeat a command -* Searching:: Find the text you want -* Specials:: Other random keys - - -File: screen.info, Node: Line Termination, Next: Scrollback, Up: Copy - -CR/LF ------ - - - Command: crlf [state] - (none) - This affects the copying of text regions with the `C-a [' command. - If it is set to `on', lines will be separated by the two character - sequence `CR'/`LF'. Otherwise only `LF' is used. `crlf' is off - by default. When no parameter is given, the state is toggled. - - -File: screen.info, Node: Scrollback, Next: Copy Mode Keys, Prev: Line Termination, Up: Copy - -Scrollback ----------- - - - Command: defscrollback num - (none) - Same as the `scrollback' command except that the default setting - for new windows is changed. Defaults to 100. - - - Command: scrollback num - (none) - Set the size of the scrollback buffer for the current window to - NUM lines. The default scrollback is 100 lines. Use `C-a i' to - view the current setting. - - - Command: compacthist [state] - (none) - This tells screen whether to suppress trailing blank lines when - scrolling up text into the history buffer. Turn compacting `on' to - hold more useful lines in your scrollback buffer. - - -File: screen.info, Node: Copy Mode Keys, Next: Movement, Prev: Scrollback, Up: Copy - -markkeys --------- - - - Command: markkeys string - (none) - This is a method of changing the keymap used for copy/history - mode. The string is made up of OLDCHAR=NEWCHAR pairs which are - separated by `:'. Example: The command `markkeys h=^B:l=^F:$=^E' - would set some keys to be more familiar to `emacs' users. If your - terminal sends characters, that cause you to abort copy mode, then - this command may help by binding these characters to do nothing. - The no-op character is `a'nd is used like this: `markkeys @=L=H' - if you do not want to use the `H' or `L' commands any longer. As - shown in this example, multiple keys can be assigned to one - function in a single statement. - - -File: screen.info, Node: Movement, Next: Marking, Prev: Copy Mode Keys, Up: Copy - -Movement Keys -------------- - -`h', `j', `k', `l' move the cursor line by line or column by column. - -`0', `^' and `$' move to the leftmost column or to the first or last -non-whitespace character on the line. - -`H', `M' and `L' move the cursor to the leftmost column of the top, -center or bottom line of the window. - -`+' and `-' move the cursor to the leftmost column of the next or -previous line. - -`G' moves to the specified absolute line (default: end of buffer). - -`|' moves to the specified absolute column. - -`w', `b', `e' move the cursor word by word. - -`B', `E' move the cursor WORD by WORD (as in vi). - -`C-u' and `C-d' scroll the display up/down by the specified amount of -lines while preserving the cursor position. (Default: half screenfull). - -`C-b' and `C-f' move the cursor up/down a full screen. - -`g' moves to the beginning of the buffer. - -`%' jumps to the specified percentage of the buffer. - - Note that Emacs-style movement keys can be specified by a .screenrc -command. (`markkeys "h=^B:l=^F:$=^E"') There is no simple method for a -full emacs-style keymap, however, as this involves multi-character -codes. - - -File: screen.info, Node: Marking, Next: Repeat count, Prev: Movement, Up: Copy - -Marking -------- - - The copy range is specified by setting two marks. The text between -these marks will be highlighted. Press `space' to set the first or -second mark respectively. - -`Y' and `y' can be used to mark one whole line or to mark from start of -line. - -`W' marks exactly one word. - - -File: screen.info, Node: Repeat count, Next: Searching, Prev: Marking, Up: Copy - -Repeat Count ------------- - - Any command in copy mode can be prefixed with a number (by pressing -digits `0...9') which is taken as a repeat count. Example: `C-a C-[ H -10 j 5 Y' will copy lines 11 to 15 into the paste buffer. - - -File: screen.info, Node: Searching, Next: Specials, Prev: Repeat count, Up: Copy - -Searching ---------- - -`/' `vi'-like search forward. - -`?' `vi'-like search backward. - -`C-a s' `emacs' style incremental search forward. - -`C-r' `emacs' style reverse i-search. - - - Command: ignorecase [state] - (none) - Tell screen to ignore the case of characters in searches. Default - is `off'. - - -File: screen.info, Node: Specials, Prev: Searching, Up: Copy - -Specials --------- - - There are, however, some keys that act differently here from in -`vi'. `Vi' does not allow to yank rectangular blocks of text, but -`screen' does. Press - -`c' or `C' to set the left or right margin respectively. If no repeat -count is given, both default to the current cursor position. -Example: Try this on a rather full text screen: `C-a [ M 20 l SPACE c -10 l 5 j C SPACE'. - -This moves one to the middle line of the screen, moves in 20 columns -left, marks the beginning of the paste buffer, sets the left column, -moves 5 columns down, sets the right column, and then marks the end of -the paste buffer. Now try: -`C-a [ M 20 l SPACE 10 l 5 j SPACE' - -and notice the difference in the amount of text copied. - -`J' joins lines. It toggles between 4 modes: lines separated by a -newline character (012), lines glued seamless, lines separated by a -single space or comma separated lines. Note that you can prepend the -newline character with a carriage return character, by issuing a `set -crlf on'. - -`v' is for all the `vi' users who use `:set numbers' - it toggles the -left margin between column 9 and 1. - -`a' before the final space key turns on append mode. Thus the contents -of the paste buffer will not be overwritten, but appended to. - -`A' turns on append mode and sets a (second) mark. - -`>' sets the (second) mark and writes the contents of the paste buffer -to the screen-exchange file (`/tmp/screen-exchange' per default) once -copy-mode is finished. *Note Screen Exchange::. -This example demonstrates how to dump the whole scrollback buffer to -that file: -`C-a [ g SPACE G $ >'. - -`C-g' gives information about the current line and column. - -`x' exchanges the first mark and the current cursor position. You can -use this to adjust an already placed mark. - -`@' does nothing. Absolutely nothing. Does not even exit copy mode. - -All keys not described here exit copy mode. - - -File: screen.info, Node: Paste, Next: Registers, Prev: Copy, Up: Copy and Paste - -Paste -===== - - - Command: paste [registers [destination]] - (`C-a ]', `C-a C-]') - Write the (concatenated) contents of the specified registers to - the stdin stream of the current window. The register `.' is - treated as the paste buffer. If no parameter is specified the user - is prompted to enter a single register. The paste buffer can be - filled with the `copy', `history' and `readbuf' commands. Other - registers can be filled with the `register', `readreg' and `paste' - commands. If `paste' is called with a second argument, the - contents of the specified registers is pasted into the named - destination register rather than the window. If `.' is used as the - second argument, the display's paste buffer is the destination. - Note, that `paste' uses a wide variety of resources: Usually both, - a current window and a current display are required. But whenever - a second argument is specified no current window is needed. When - the source specification only contains registers (not the paste - buffer) then there need not be a current display (terminal - attached), as the registers are a global resource. The paste - buffer exists once for every user. - - - Command: stuff string - (none) - Stuff the string STRING in the input buffer of the current window. - This is like the `paste' command, but with much less overhead. - You cannot paste large buffers with the `stuff' command. It is most - useful for key bindings. *Note Bindkey::. - - - Command: pastefont [state] - Tell screen to include font information in the paste buffer. The - default is not to do so. This command is especially useful for - multi character fonts like kanji. - - - Command: slowpaste msec - - Command: defslowpaste msec - (none) - Define the speed text is inserted in the current window by the - `paste' command. If the slowpaste value is nonzero text is written - character by character. `screen' will pause for MSEC milliseconds - after each write to allow the application to process the input. - only use `slowpaste' if your underlying system exposes flow - control problems while pasting large amounts of text. - `defslowpaste' specifies the default for new windows. - - - Command: readreg [-e encoding] [register [filename]] - (none) - Does one of two things, dependent on number of arguments: with - zero or one arguments it it duplicates the paste buffer contents - into the register specified or entered at the prompt. With two - arguments it reads the contents of the named file into the - register, just as `readbuf' reads the screen-exchange file into - the paste buffer. You can tell screen the encoding of the file - via the `-e' option. The following example will paste the - system's password file into the screen window (using register p, - where a copy remains): - - C-a : readreg p /etc/passwd - C-a : paste p - - -File: screen.info, Node: Registers, Next: Screen Exchange, Prev: Paste, Up: Copy and Paste - -Registers -========= - - - Command: copy_reg [key] - (none) - Removed. Use `readreg' instead. - - - Command: ins_reg [key] - (none) - Removed. Use `paste' instead. - - - Command: process [key] - (none) - Stuff the contents of the specified register into the `screen' - input queue. If no argument is given you are prompted for a - register name. The text is parsed as if it had been typed in from - the user's keyboard. This command can be used to bind multiple - actions to a single key. - - - Command: register [-e encoding] key string - (none) - Save the specified STRING to the register KEY. The encoding of - the string can be specified via the `-e' option. - - -File: screen.info, Node: Screen Exchange, Next: History, Prev: Registers, Up: Copy and Paste - -Screen Exchange -=============== - - - Command: bufferfile [EXCHANGE-FILE] - (none) - Change the filename used for reading and writing with the paste - buffer. If the EXCHANGE-FILE parameter is omitted, `screen' - reverts to the default of `/tmp/screen-exchange'. The following - example will paste the system's password file into the screen - window (using the paste buffer, where a copy remains): - - C-a : bufferfile /etc/passwd - C-a < C-a ] - C-a : bufferfile - - - Command: readbuf [-e ENCODING] [FILENAME] - (`C-a <') - Reads the contents of the specified file into the paste buffer. - You can tell screen the encoding of the file via the `-e' option. - If no file is specified, the screen-exchange filename is used. - - - Command: removebuf - (`C-a =') - Unlinks the screen-exchange file. - - - Command: writebuf [-e ENCODING] [FILENAME] - (`C-a >') - Writes the contents of the paste buffer to the specified file, or - the public accessible screen-exchange file if no filename is given. - This is thought of as a primitive means of communication between - `screen' users on the same host. If an encoding is specified the - paste buffer is recoded on the fly to match the encoding. See also - `C-a <ESC>' (*note Copy::). - - -File: screen.info, Node: History, Prev: Screen Exchange, Up: Copy and Paste - -History -======= - - - Command: history - (`C-a {') - Usually users work with a shell that allows easy access to previous - commands. For example, `csh' has the command `!!' to repeat the - last command executed. `screen' provides a primitive way of - recalling "the command that started ...": You just type the first - letter of that command, then hit `C-a {' and `screen' tries to - find a previous line that matches with the prompt character to the - left of the cursor. This line is pasted into this window's input - queue. Thus you have a crude command history (made up by the - visible window and its scrollback buffer). - - -File: screen.info, Node: Subprocess Execution, Next: Key Binding, Prev: Copy and Paste, Up: Top - -Subprocess Execution -******************** - - Control Input or Output of a window by another filter process. Use -with care! - -* Menu: - -* Exec:: The `exec' command syntax. -* Using Exec:: Weird things that filters can do. - - -File: screen.info, Node: Exec, Next: Using Exec, Up: Subprocess Execution - -Exec -==== - - - Command: exec [[FDPAT] NEWCOMMAND [ARGS ... ]] - (none) - Run a unix subprocess (specified by an executable path NEWCOMMAND - and its optional arguments) in the current window. The flow of - data between newcommands stdin/stdout/stderr, the process - originally started (let us call it "application-process") and - screen itself (window) is controlled by the filedescriptor pattern - FDPAT. This pattern is basically a three character sequence - representing stdin, stdout and stderr of newcommand. A dot (`.') - connects the file descriptor to screen. An exclamation mark (`!') - causes the file descriptor to be connected to the - application-process. A colon (`:') combines both. - User input will go to newcommand unless newcommand receives the - application-process' output (FDPATs first character is `!' or `:') - or a pipe symbol (`|') is added to the end of FDPAT. - Invoking `exec' without arguments shows name and arguments of the - currently running subprocess in this window. Only one subprocess - can be running per window. - When a subprocess is running the `kill' command will affect it - instead of the windows process. Only one subprocess a time can be - running in each window. - Refer to the postscript file `doc/fdpat.ps' for a confusing - illustration of all 21 possible combinations. Each drawing shows - the digits 2, 1, 0 representing the three file descriptors of - newcommand. The box marked `W' is usual pty that has the - application-process on its slave side. The box marked `P' is the - secondary pty that now has screen at its master side. - - -File: screen.info, Node: Using Exec, Prev: Exec, Up: Subprocess Execution - -Using Exec -========== - -Abbreviations: - - * Whitespace between the word `exec' and FDPAT and the command name - can be omitted. - - * Trailing dots and a FDPAT consisting only of dots can be omitted. - - * A simple `|' is synonymous for the `!..|' pattern. - - * The word `exec' can be omitted when the `|' abbreviation is used. - - * The word `exec' can always be replaced by leading `!'. - -Examples: - -`!/bin/sh' -`exec /bin/sh' -`exec ... /bin/sh' - All of the above are equivalent. Creates another shell in the - same window, while the original shell is still running. Output of - both shells is displayed and user input is sent to the new - `/bin/sh'. - -`!!stty 19200' -`exec!stty 19200' -`exec !.. stty 19200' - All of the above are equivalent. Set the speed of the window's - tty. If your stty command operates on stdout, then add another - `!'. This is a useful command, when a screen window is directly - connected to a serial line that needs to be configured. - -`|less' -`exec !..| less' - Both are equivalent. This adds a pager to the window output. The - special character `|' is needed to give the user control over the - pager although it gets its input from the window's process. This - works, because `less' listens on stderr (a behavior that `screen' - would not expect without the `|') when its stdin is not a tty. - `Less' versions newer than 177 fail miserably here; good old `pg' - still works. - -`!:sed -n s/.*Error.*/\007/p' - Sends window output to both, the user and the sed command. The sed - inserts an additional bell character (oct. 007) to the window - output seen by screen. This will cause 'Bell in window x' - messages, whenever the string `Error' appears in the window. - - -File: screen.info, Node: Key Binding, Next: Flow Control, Prev: Subprocess Execution, Up: Top - -Key Binding -*********** - - You may disagree with some of the default bindings (I know I do). -The `bind' command allows you to redefine them to suit your preferences. - -* Menu: - -* Bind:: `bind' syntax. -* Bind Examples:: Using `bind'. -* Command Character:: The character used to start keyboard commands. -* Help:: Show current key bindings. -* Bindkey:: `bindkey' syntax. -* Bindkey Examples:: Some easy examples. -* Bindkey Control:: How to control the bindkey mechanism. - - -File: screen.info, Node: Bind, Next: Bind Examples, Up: Key Binding - -The `bind' command -================== - - - Command: bind [-c class] key [command [args]] - (none) - Bind a command to a key. The KEY argument is either a single - character, a two-character sequence of the form `^x' (meaning - `C-x'), a backslash followed by an octal number (specifying the - ASCII code of the character), or a backslash followed by a second - character, such as `\^' or `\\'. The argument can also be quoted, - if you like. If no further argument is given, any previously - established binding for this key is removed. The COMMAND argument - can be any command (*note Command Index::). - - If a command class is specified via the `-c' option, the key is - bound for the specified class. Use the `command' command to - activate a class. Command classes can be used to create multiple - command keys or multi-character bindings. - - By default, most suitable commands are bound to one or more keys - (*note Default Key Bindings::; for instance, the command to create - a new window is bound to `C-c' and `c'. The `bind' command can be - used to redefine the key bindings and to define new bindings. - - -File: screen.info, Node: Bind Examples, Next: Command Character, Prev: Bind, Up: Key Binding - -Examples of the `bind' command -============================== - -Some examples: - - bind ' ' windows - bind ^f screen telnet foobar - bind \033 screen -ln -t root -h 1000 9 su - -would bind the space key to the command that displays a list of windows -(so that the command usually invoked by `C-a C-w' would also be -available as `C-a space'), bind `C-f' to the command "create a window -with a TELNET connection to foobar", and bind <ESC> to the command that -creates an non-login window with title `root' in slot #9, with a -superuser shell and a scrollback buffer of 1000 lines. - - bind -c demo1 0 select 10 - bind -c demo1 1 select 11 - bind -c demo1 2 select 12 - bindkey "^B" command -c demo1 - makes `C-b 0' select window 10, `C-b 1' window 11, etc. - - bind -c demo2 0 select 10 - bind -c demo2 1 select 11 - bind -c demo2 2 select 12 - bind - command -c demo2 - makes `C-a - 0' select window 10, `C-a - 1' window 11, etc. - - -File: screen.info, Node: Command Character, Next: Help, Prev: Bind Examples, Up: Key Binding - -Command Character -================= - - - Command: escape xy - (none) - Set the command character to X and the character generating a - literal command character (by triggering the `meta' command) to Y - (similar to the `-e' option). Each argument is either a single - character, a two-character sequence of the form `^x' (meaning - `C-x'), a backslash followed by an octal number (specifying the - ASCII code of the character), or a backslash followed by a second - character, such as `\^' or `\\'. The default is `^Aa', but ```' - is recommended by one of the authors. - - - Command: defescape xy - (none) - Set the default command characters. This is equivalent to the - command `escape' except that it is useful for multiuser sessions - only. In a multiuser session `escape' changes the command - character of the calling user, where `defescape' changes the - default command characters for users that will be added later. - - - Command: meta - (`C-a a') - Send the command character (`C-a') to the process in the current - window. The keystroke for this command is the second parameter to - the `-e' command line switch (*note Invoking Screen::), or the - `escape' .screenrc directive. - - - Command: command [-c CLASS] - (none) - This command has the same effect as typing the screen escape - character (`C-a'). It is probably only useful for key bindings. - If the `-c' option is given, select the specified command class. - *Note Bind::, *Note Bindkey::. - - -File: screen.info, Node: Help, Next: Bindkey, Prev: Command Character, Up: Key Binding - -Help -==== - - - Command: help - (`C-a ?') - Displays a help screen showing you all the key bindings. The first - pages list all the internal commands followed by their bindings. - Subsequent pages will display the custom commands, one command per - key. Press space when you're done reading each page, or return to - exit early. All other characters are ignored. If the `-c' option - is given, display all bound commands for the specified command - class. *Note Default Key Bindings::. - - -File: screen.info, Node: Bindkey, Next: Bindkey Examples, Prev: Help, Up: Key Binding - -Bindkey -======= - - - Command: bindkey [OPTS] [STRING [CMD ARGS]] - (none) - This command manages screen's input translation tables. Every - entry in one of the tables tells screen how to react if a certain - sequence of characters is encountered. There are three tables: one - that should contain actions programmed by the user, one for the - default actions used for terminal emulation and one for screen's - copy mode to do cursor movement. See *Note Input Translation:: for - a list of default key bindings. - - If the `-d' option is given, bindkey modifies the default table, - `-m' changes the copy mode table and with neither option the user - table is selected. The argument `string' is the sequence of - characters to which an action is bound. This can either be a fixed - tring or a termcap keyboard capability name (selectable with the - `-k' option). - - Some keys on a VT100 terminal can send a different string if - application mode is turned on (e.g. the cursor keys). Such keys - have two entries in the translation table. You can select the - application mode entry by specifying the `-a' option. - - The `-t' option tells screen not to do inter-character timing. One - cannot turn off the timing if a termcap capability is used. - - `cmd' can be any of screen's commands with an arbitrary number of - `args'. If `cmd' is omitted the key-binding is removed from the - table. - - -File: screen.info, Node: Bindkey Examples, Next: Bindkey Control, Prev: Bindkey, Up: Key Binding - -Bindkey Examples -================ - -Here are some examples of keyboard bindings: - - bindkey -d - -Show all of the default key bindings. The application mode entries are -marked with [A]. - - bindkey -k k1 select 1 - -Make the "F1" key switch to window one. - - bindkey -t foo stuff barfoo - -Make `foo' an abbreviation of the word `barfoo'. Timeout is disabled so -that users can type slowly. - - bindkey "\024" mapdefault - -This key-binding makes `C-t' an escape character for key-bindings. If -you did the above `stuff barfoo' binding, you can enter the word `foo' -by typing `C-t foo'. If you want to insert a `C-t' you have to press -the key twice (i.e. escape the escape binding). - - bindkey -k F1 command - -Make the F11 (not F1!) key an alternative screen escape (besides `C-a'). - - -File: screen.info, Node: Bindkey Control, Prev: Bindkey Examples, Up: Key Binding - -Bindkey Control -=============== - - - Command: mapdefault - (none) - Tell screen that the next input character should only be looked up - in the default bindkey table. - - - Command: mapnotnext - (none) - Like mapdefault, but don't even look in the default bindkey table. - - - Command: maptimeout timo - (none) - Set the intercharacter timer for input sequence detection to a - timeout of TIMO ms. The default timeout is 300ms. Maptimeout with - no arguments shows the current setting. - - -File: screen.info, Node: Flow Control, Next: Termcap, Prev: Key Binding, Up: Top - -Flow Control -************ - - `screen' can trap flow control characters or pass them to the -program, as you see fit. This is useful when your terminal wants to use -XON/XOFF flow control and you are running a program which wants to use -^S/^Q for other purposes (i.e. `emacs'). - -* Menu: - -* Flow Control Summary:: The effect of `screen' flow control -* Flow:: Setting the flow control behavior -* XON/XOFF:: Sending XON or XOFF to the window - - -File: screen.info, Node: Flow Control Summary, Next: Flow, Up: Flow Control - -About `screen' flow control settings -==================================== - - Each window has a flow-control setting that determines how screen -deals with the XON and XOFF characters (and perhaps the interrupt -character). When flow-control is turned off, screen ignores the XON -and XOFF characters, which allows the user to send them to the current -program by simply typing them (useful for the `emacs' editor, for -instance). The trade-off is that it will take longer for output from a -"normal" program to pause in response to an XOFF. With flow-control -turned on, XON and XOFF characters are used to immediately pause the -output of the current window. You can still send these characters to -the current program, but you must use the appropriate two-character -screen commands (typically `C-a q' (xon) and `C-a s' (xoff)). The -xon/xoff commands are also useful for typing C-s and C-q past a -terminal that intercepts these characters. - - Each window has an initial flow-control value set with either the -`-f' option or the `defflow' command. By default the windows are set -to automatic flow-switching. It can then be toggled between the three -states 'fixed on', 'fixed off' and 'automatic' interactively with the -`flow' command bound to `C-a f'. - - The automatic flow-switching mode deals with flow control using the -TIOCPKT mode (like `rlogin' does). If the tty driver does not support -TIOCPKT, screen tries to determine the right mode based on the current -setting of the application keypad -- when it is enabled, flow-control -is turned off and visa versa. Of course, you can still manipulate -flow-control manually when needed. - - If you're running with flow-control enabled and find that pressing -the interrupt key (usually C-c) does not interrupt the display until -another 6-8 lines have scrolled by, try running screen with the -`interrupt' option (add the `interrupt' flag to the `flow' command in -your .screenrc, or use the `-i' command-line option). This causes the -output that `screen' has accumulated from the interrupted program to be -flushed. One disadvantage is that the virtual terminal's memory -contains the non-flushed version of the output, which in rare cases can -cause minor inaccuracies in the output. For example, if you switch -screens and return, or update the screen with `C-a l' you would see the -version of the output you would have gotten without `interrupt' being -on. Also, you might need to turn off flow-control (or use auto-flow -mode to turn it off automatically) when running a program that expects -you to type the interrupt character as input, as the `interrupt' -parameter only takes effect when flow-control is enabled. If your -program's output is interrupted by mistake, a simple refresh of the -screen with `C-a l' will restore it. Give each mode a try, and use -whichever mode you find more comfortable. - - -File: screen.info, Node: Flow, Next: XON/XOFF, Prev: Flow Control Summary, Up: Flow Control - -Flow -==== - - - Command: defflow fstate [interrupt] - (none) - Same as the `flow' command except that the default setting for new - windows is changed. Initial setting is `auto'. Specifying `flow - auto interrupt' has the same effect as the command-line options - `-fa' and `-i'. Note that if `interrupt' is enabled, all existing - displays are changed immediately to forward interrupt signals. - - - Command: flow [fstate] - (`C-a f', `C-a C-f') - Sets the flow-control mode for this window to FSTATE, which can be - `on', `off' or `auto'. Without parameters it cycles the current - window's flow-control setting. Default is set by `defflow'. - - -File: screen.info, Node: XON/XOFF, Prev: Flow, Up: Flow Control - -XON and XOFF -============ - - - Command: xon - (`C-a q', `C-a C-q') - Send a ^Q (ASCII XON) to the program in the current window. - Redundant if flow control is set to `off' or `auto'. - - - Command: xoff - (`C-a s', `C-a C-s') - Send a ^S (ASCII XOFF) to the program in the current window. - - -File: screen.info, Node: Termcap, Next: Message Line, Prev: Flow Control, Up: Top - -Termcap -******* - - `screen' demands the most out of your terminal so that it can -perform its VT100 emulation most efficiently. These functions provide -means for tweaking the termcap entries for both your physical terminal -and the one simulated by `screen'. - -* Menu: - -* Window Termcap:: Choosing a termcap entry for the window. -* Dump Termcap:: Write out a termcap entry for the window. -* Termcap Syntax:: The `termcap' and `terminfo' commands. -* Termcap Examples:: Uses for `termcap'. -* Special Capabilities:: Non-standard capabilities used by `screen'. -* Autonuke:: Flush unseen output -* Obuflimit:: Allow pending output when reading more -* Character Translation:: Emulating fonts and charsets. - diff --git a/doc/screen.info-4 b/doc/screen.info-4 deleted file mode 100644 index 7a778f2..0000000 --- a/doc/screen.info-4 +++ /dev/null @@ -1,1411 +0,0 @@ -This is screen.info, produced by makeinfo version 4.5 from -./screen.texinfo. - -INFO-DIR-SECTION General Commands -START-INFO-DIR-ENTRY -* Screen: (screen). Full-screen window manager. -END-INFO-DIR-ENTRY - - This file documents the `Screen' virtual terminal manager. - - Copyright (c) 1993-2003 Free Software Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be stated in a -translation approved by the Foundation. - - -File: screen.info, Node: Window Termcap, Next: Dump Termcap, Up: Termcap - -Choosing the termcap entry for a window -======================================= - - Usually `screen' tries to emulate as much of the VT100/ANSI standard -as possible. But if your terminal lacks certain capabilities the -emulation may not be complete. In these cases `screen' has to tell the -applications that some of the features are missing. This is no problem -on machines using termcap, because `screen' can use the `$TERMCAP' -variable to customize the standard screen termcap. - - But if you do a rlogin on another machine or your machine supports -only terminfo this method fails. Because of this `screen' offers a way -to deal with these cases. Here is how it works: - - When `screen' tries to figure out a terminal name for itself, it -first looks for an entry named `screen.TERM', where TERM is the -contents of your `$TERM' variable. If no such entry exists, `screen' -tries `screen' (or `screen-w', if the terminal is wide (132 cols or -more)). If even this entry cannot be found, `vt100' is used as a -substitute. - - The idea is that if you have a terminal which doesn't support an -important feature (e.g. delete char or clear to EOS) you can build a new -termcap/terminfo entry for `screen' (named `screen.DUMBTERM') in which -this capability has been disabled. If this entry is installed on your -machines you are able to do a rlogin and still keep the correct -termcap/terminfo entry. The terminal name is put in the `$TERM' -variable of all new windows. `screen' also sets the `$TERMCAP' -variable reflecting the capabilities of the virtual terminal emulated. -Furthermore, the variable `$WINDOW' is set to the window number of each -window. - - The actual set of capabilities supported by the virtual terminal -depends on the capabilities supported by the physical terminal. If, for -instance, the physical terminal does not support underscore mode, -`screen' does not put the `us' and `ue' capabilities into the window's -`$TERMCAP' variable, accordingly. However, a minimum number of -capabilities must be supported by a terminal in order to run `screen'; -namely scrolling, clear screen, and direct cursor addressing (in -addition, `screen' does not run on hardcopy terminals or on terminals -that over-strike). - - Also, you can customize the `$TERMCAP' value used by `screen' by -using the `termcap' command, or by defining the variable `$SCREENCAP' -prior to startup. When the latter defined, its value will be copied -verbatim into each window's `$TERMCAP' variable. This can either be -the full terminal definition, or a filename where the terminal `screen' -(and/or `screen-w') is defined. - - Note that `screen' honors the `terminfo' command if the system uses -the terminfo database rather than termcap. On such machines the -`$TERMCAP' variable has no effect and you must use the `dumptermcap' -command (*note Dump Termcap::) and the `tic' program to generate -terminfo entries for `screen' windows. - - When the boolean `G0' capability is present in the termcap entry for -the terminal on which `screen' has been called, the terminal emulation -of `screen' supports multiple character sets. This allows an -application to make use of, for instance, the VT100 graphics character -set or national character sets. The following control functions from -ISO 2022 are supported: `lock shift G0' (`SI'), `lock shift G1' (`SO'), -`lock shift G2', `lock shift G3', `single shift G2', and `single shift -G3'. When a virtual terminal is created or reset, the ASCII character -set is designated as `G0' through `G3'. When the `G0' capability is -present, screen evaluates the capabilities `S0', `E0', and `C0' if -present. `S0' is the sequence the terminal uses to enable and start the -graphics character set rather than `SI'. `E0' is the corresponding -replacement for `SO'. `C0' gives a character by character translation -string that is used during semi-graphics mode. This string is built -like the `acsc' terminfo capability. - - When the `po' and `pf' capabilities are present in the terminal's -termcap entry, applications running in a `screen' window can send -output to the printer port of the terminal. This allows a user to have -an application in one window sending output to a printer connected to -the terminal, while all other windows are still active (the printer -port is enabled and disabled again for each chunk of output). As a -side-effect, programs running in different windows can send output to -the printer simultaneously. Data sent to the printer is not displayed -in the window. The `info' command displays a line starting with `PRIN' -while the printer is active. - - Some capabilities are only put into the `$TERMCAP' variable of the -virtual terminal if they can be efficiently implemented by the physical -terminal. For instance, `dl' (delete line) is only put into the -`$TERMCAP' variable if the terminal supports either delete line itself -or scrolling regions. Note that this may provoke confusion, when the -session is reattached on a different terminal, as the value of -`$TERMCAP' cannot be modified by parent processes. You can force -`screen' to include all capabilities in `$TERMCAP' with the `-a' -command-line option (*note Invoking Screen::). - - The "alternate screen" capability is not enabled by default. Set -the `altscreen' `.screenrc' command to enable it. - - -File: screen.info, Node: Dump Termcap, Next: Termcap Syntax, Prev: Window Termcap, Up: Termcap - -Write out the window's termcap entry -==================================== - - - Command: dumptermcap - (`C-a .') - Write the termcap entry for the virtual terminal optimized for the - currently active window to the file `.termcap' in the user's - `$HOME/.screen' directory (or wherever `screen' stores its - sockets. *note Files::). This termcap entry is identical to the - value of the environment variable `$TERMCAP' that is set up by - `screen' for each window. For terminfo based systems you will need - to run a converter like `captoinfo' and then compile the entry with - `tic'. - - -File: screen.info, Node: Termcap Syntax, Next: Termcap Examples, Prev: Dump Termcap, Up: Termcap - -The `termcap' command -===================== - - - Command: termcap term terminal-tweaks [window-tweaks] - - Command: terminfo term terminal-tweaks [window-tweaks] - - Command: termcapinfo term terminal-tweaks [window-tweaks] - (none) - Use this command to modify your terminal's termcap entry without - going through all the hassles involved in creating a custom - termcap entry. Plus, you can optionally customize the termcap - generated for the windows. You have to place these commands in - one of the screenrc startup files, as they are meaningless once - the terminal emulator is booted. - - If your system uses the terminfo database rather than termcap, - `screen' will understand the `terminfo' command, which has the - same effects as the `termcap' command. Two separate commands are - provided, as there are subtle syntactic differences, e.g. when - parameter interpolation (using `%') is required. Note that the - termcap names of the capabilities should also be used with the - `terminfo' command. - - In many cases, where the arguments are valid in both terminfo and - termcap syntax, you can use the command `termcapinfo', which is - just a shorthand for a pair of `termcap' and `terminfo' commands - with identical arguments. - - The first argument specifies which terminal(s) should be affected by -this definition. You can specify multiple terminal names by separating -them with `|'s. Use `*' to match all terminals and `vt*' to match all -terminals that begin with `vt'. - - Each TWEAK argument contains one or more termcap defines (separated -by `:'s) to be inserted at the start of the appropriate termcap entry, -enhancing it or overriding existing values. The first tweak modifies -your terminal's termcap, and contains definitions that your terminal -uses to perform certain functions. Specify a null string to leave this -unchanged (e.g. ""). The second (optional) tweak modifies all the -window termcaps, and should contain definitions that screen understands -(*note Virtual Terminal::). - - -File: screen.info, Node: Termcap Examples, Next: Special Capabilities, Prev: Termcap Syntax, Up: Termcap - -Termcap Examples -================ - - Some examples: - - termcap xterm* xn:hs@ - -Informs `screen' that all terminals that begin with `xterm' have firm -auto-margins that allow the last position on the screen to be updated -(xn), but they don't really have a status line (no 'hs' - append `@' to -turn entries off). Note that we assume `xn' for all terminal names -that start with `vt', but only if you don't specify a termcap command -for that terminal. - - termcap vt* xn - termcap vt102|vt220 Z0=\E[?3h:Z1=\E[?3l - -Specifies the firm-margined `xn' capability for all terminals that -begin with `vt', and the second line will also add the escape-sequences -to switch into (Z0) and back out of (Z1) 132-character-per-line mode if -this is a VT102 or VT220. (You must specify Z0 and Z1 in your termcap -to use the width-changing commands.) - - termcap vt100 "" l0=PF1:l1=PF2:l2=PF3:l3=PF4 - -This leaves your vt100 termcap alone and adds the function key labels to -each window's termcap entry. - - termcap h19|z19 am@:im=\E@:ei=\EO dc=\E[P - -Takes a h19 or z19 termcap and turns off auto-margins (am@) and enables -the insert mode (im) and end-insert (ei) capabilities (the `@' in the -`im' string is after the `=', so it is part of the string). Having the -`im' and `ei' definitions put into your terminal's termcap will cause -screen to automatically advertise the character-insert capability in -each window's termcap. Each window will also get the delete-character -capability (dc) added to its termcap, which screen will translate into -a line-update for the terminal (we're pretending it doesn't support -character deletion). - - If you would like to fully specify each window's termcap entry, you -should instead set the `$SCREENCAP' variable prior to running `screen'. -*Note Virtual Terminal::, for the details of the `screen' terminal -emulation. *Note Termcap: (termcap)Top, for more information on -termcap definitions. - - -File: screen.info, Node: Special Capabilities, Next: Autonuke, Prev: Termcap Examples, Up: Termcap - -Special Terminal Capabilities -============================= - - The following table describes all terminal capabilities that are -recognized by `screen' and are not in the termcap manual (*note -Termcap: (termcap)Top.). You can place these capabilities in your -termcap entries (in `/etc/termcap') or use them with the commands -`termcap', `terminfo' and `termcapinfo' in your `screenrc' files. It is -often not possible to place these capabilities in the terminfo database. -`LP' - (bool) - Terminal has VT100 style margins (`magic margins'). Note that this - capability is obsolete -- `screen' now uses the standard `xn' - instead. - -`Z0' - (str) - Change width to 132 columns. - -`Z1' - (str) - Change width to 80 columns. - -`WS' - (str) - Resize display. This capability has the desired width and height as - arguments. SunView(tm) example: `\E[8;%d;%dt'. - -`NF' - (bool) - Terminal doesn't need flow control. Send ^S and ^Q direct to the - application. Same as `flow off'. The opposite of this capability - is `nx'. - -`G0' - (bool) - Terminal can deal with ISO 2022 font selection sequences. - -`S0' - (str) - Switch charset `G0' to the specified charset. Default is `\E(%.'. - -`E0' - (str) - Switch charset `G0' back to standard charset. Default is `\E(B'. - -`C0' - (str) - Use the string as a conversion table for font 0. See the `ac' - capability for more details. - -`CS' - (str) - Switch cursor-keys to application mode. - -`CE' - (str) - Switch cursor-keys to cursor mode. - -`AN' - (bool) - Enable autonuke for displays of this terminal type. (*note - Autonuke::). - -`OL' - (num) - Set the output buffer limit. See the `obuflimit' command (*note - Obuflimit::) for more details. - -`KJ' - (str) - Set the encoding of the terminal. See the `encoding' command - (*note Character Processing::) for valid encodings. - -`AF' - (str) - Change character foreground color in an ANSI conform way. This - capability will almost always be set to `\E[3%dm' (`\E[3%p1%dm' on - terminfo machines). - -`AB' - (str) - Same as `AF', but change background color. - -`AX' - (bool) - Does understand ANSI set default fg/bg color (`\E[39m / \E[49m'). - -`XC' - (str) - Describe a translation of characters to strings depending on the - current font. (*note Character Translation::). - -`XT' - (bool) - Terminal understands special xterm sequences (OSC, mouse tracking). - -`C8' - (bool) - Terminal needs bold to display high-intensity colors (e.g. Eterm). - -`TF' - (bool) - Add missing capabilities to the termcap/info entry. (Set by - default). - - -File: screen.info, Node: Autonuke, Next: Obuflimit, Prev: Special Capabilities, Up: Termcap - -Autonuke -======== - - - Command: autonuke STATE - (none) - Sets whether a clear screen sequence should nuke all the output - that has not been written to the terminal. *Note Obuflimit::. - This property is set per display, not per window. - - - Command: defautonuke STATE - (none) - Same as the `autonuke' command except that the default setting for - new displays is also changed. Initial setting is `off'. Note that - you can use the special `AN' terminal capability if you want to - have a terminal type dependent setting. - - -File: screen.info, Node: Obuflimit, Next: Character Translation, Prev: Autonuke, Up: Termcap - -Obuflimit -========= - - - Command: obuflimit [LIMIT] - (none) - If the output buffer contains more bytes than the specified limit, - no more data will be read from the windows. The default value is - 256. If you have a fast display (like `xterm'), you can set it to - some higher value. If no argument is specified, the current - setting is displayed. This property is set per display, not per - window. - - - Command: defobuflimit LIMIT - (none) - Same as the `obuflimit' command except that the default setting - for new displays is also changed. Initial setting is 256 bytes. - Note that you can use the special `OL' terminal capability if you - want to have a terminal type dependent limit. - - -File: screen.info, Node: Character Translation, Prev: Obuflimit, Up: Termcap - -Character Translation -===================== - - `Screen' has a powerful mechanism to translate characters to -arbitrary strings depending on the current font and terminal type. Use -this feature if you want to work with a common standard character set -(say ISO8851-latin1) even on terminals that scatter the more unusual -characters over several national language font pages. - - Syntax: - - XC=<CHARSET-MAPPING>{,,<CHARSET-MAPPING>} - <CHARSET-MAPPING> := <DESIGNATOR><TEMPLATE>{,<MAPPING>} - <MAPPING> := <CHAR-TO-BE-MAPPED><TEMPLATE-ARG> - - The things in braces may be repeated any number of times. - - A <CHARSET-MAPPING> tells screen how to map characters in font -<DESIGNATOR> (`B': Ascii, `A': UK, `K': german, etc.) to strings. -Every <MAPPING> describes to what string a single character will be -translated. A template mechanism is used, as most of the time the codes -have a lot in common (for example strings to switch to and from another -charset). Each occurrence of `%' in <TEMPLATE> gets substituted with the -TEMPLATE-ARG specified together with the character. If your strings are -not similar at all, then use `%' as a template and place the full -string in <TEMPLATE-ARG>. A quoting mechanism was added to make it -possible to use a real `%'. The `\' character quotes the special -characters `\', `%', and `,'. - - Here is an example: - - termcap hp700 'XC=B\E(K%\E(B,\304[,\326\\\\,\334]' - - This tells `screen', how to translate ISOlatin1 (charset `B') upper -case umlaut characters on a `hp700' terminal that has a german charset. -`\304' gets translated to `\E(K[\E(B' and so on. Note that this line -gets parsed *three* times before the internal lookup table is built, -therefore a lot of quoting is needed to create a single `\'. - - Another extension was added to allow more emulation: If a mapping -translates the unquoted `%' char, it will be sent to the terminal -whenever screen switches to the corresponding <DESIGNATOR>. In this -special case the template is assumed to be just `%' because the charset -switch sequence and the character mappings normally haven't much in -common. - - This example shows one use of the extension: - termcap xterm 'XC=K%,%\E(B,[\304,\\\\\326,]\334' - - Here, a part of the german (`K') charset is emulated on an xterm. -If screen has to change to the `K' charset, `\E(B' will be sent to the -terminal, i.e. the ASCII charset is used instead. The template is just -`%', so the mapping is straightforward: `[' to `\304', `\' to `\326', -and `]' to `\334'. - - -File: screen.info, Node: Message Line, Next: Logging, Prev: Termcap, Up: Top - -The Message Line -**************** - - `screen' displays informational messages and other diagnostics in a -"message line" at the bottom of the screen. If your terminal has a -status line defined in its termcap, screen will use this for displaying -its messages, otherwise the last line of the screen will be temporarily -overwritten and output will be momentarily interrupted. The message -line is automatically removed after a few seconds delay, but it can also -be removed early (on terminals without a status line) by beginning to -type. - -* Menu: - -* Privacy Message:: Using the message line from your program. -* Hardware Status Line:: Use the terminal's hardware status line. -* Last Message:: Redisplay the last message. -* Message Wait:: Control how long messages are displayed. - - -File: screen.info, Node: Privacy Message, Next: Hardware Status Line, Up: Message Line - -Using the message line from your program -======================================== - - The message line facility can be used by an application running in -the current window by means of the ANSI "Privacy message" control -sequence. For instance, from within the shell, try something like: - - echo "^Hello world from window $WINDOW\" - - where `' is ASCII ESC and `^' is a literal caret or up-arrow. - - -File: screen.info, Node: Hardware Status Line, Next: Last Message, Prev: Privacy Message, Up: Message Line - -Hardware Status Line -==================== - - - Command: hardstatus [state] - - Command: hardstatus [`always']`lastline'|`message'|`ignore' [string] - - Command: hardstatus `string' [string] - (none) - This command configures the use and emulation of the terminal's - hardstatus line. The first form toggles whether `screen' will use - the hardware status line to display messages. If the flag is set - to `off', these messages are overlaid in reverse video mode at the - display line. The default setting is `on'. - - The second form tells screen what to do if the terminal doesn't - have a hardstatus line (i.e. the termcap/terminfo capabilities - "hs", "ts", "fs" and "ds" are not set). If the type `lastline' is - used, screen will reserve the last line of the display for the - hardstatus. `message' uses `screen''s message mechanism and - `ignore' tells `screen' never to display the hardstatus. If you - prepend the word `always' to the type (e.g., `alwayslastline'), - `screen' will use the type even if the terminal supports a - hardstatus line. - - The third form specifies the contents of the hardstatus line. - `%h' is used as default string, i.e. the stored hardstatus of the - current window (settable via `ESC]0;^G' or `ESC_\\') is displayed. - You can customize this to any string you like including string - escapes (*note String Escapes::). If you leave out the argument - STRING, the current string is displayed. - - You can mix the second and third form by providing the string as - additional argument. - - -File: screen.info, Node: Last Message, Next: Message Wait, Prev: Hardware Status Line, Up: Message Line - -Display Last Message -==================== - - - Command: lastmsg - (`C-a m', `C-a C-m') - Repeat the last message displayed in the message line. Useful if - you're typing when a message appears, because (unless your - terminal has a hardware status line) the message goes away when - you press a key. - - -File: screen.info, Node: Message Wait, Prev: Last Message, Up: Message Line - -Message Wait -============ - - - Command: msgminwait sec - (none) - Defines the time `screen' delays a new message when another is - currently displayed. Defaults to 1 second. - - - Command: msgwait sec - (none) - Defines the time a message is displayed, if `screen' is not - disturbed by other activity. Defaults to 5 seconds. - - -File: screen.info, Node: Logging, Next: Startup, Prev: Message Line, Up: Top - -Logging -******* - - This section describes the commands for keeping a record of your -session. - -* Menu: - -* Hardcopy:: Dump the current screen to a file -* Log:: Log the output of a window to a file - - -File: screen.info, Node: Hardcopy, Next: Log, Up: Logging - -hardcopy -======== - - - Command: hardcopy [-h] [FILE] - (`C-a h', `C-a C-h') - Writes out the currently displayed image to the file FILE, or, if - no filename is specified, to `hardcopy.N' in the default - directory, where N is the number of the current window. This - either appends or overwrites the file if it exists, as determined - by the `hardcopy_append' command. If the option `-h' is - specified, dump also the contents of the scrollback buffer. - - - Command: hardcopy_append state - (none) - If set to `on', `screen' will append to the `hardcopy.N' files - created by the command `hardcopy'; otherwise, these files are - overwritten each time. - - - Command: hardcopydir directory - (none) - Defines a directory where hardcopy files will be placed. If unset - hardcopys are dumped in screen's current working directory. - - -File: screen.info, Node: Log, Prev: Hardcopy, Up: Logging - -log -=== - - - Command: deflog state - (none) - Same as the `log' command except that the default setting for new - windows is changed. Initial setting is `off'. - - - Command: log [state] - (`C-a H') - Begins/ends logging of the current window to the file - `screenlog.N' in the window's default directory, where N is the - number of the current window. This filename can be changed with - the `logfile' command. If no parameter is given, the logging - state is toggled. The session log is appended to the previous - contents of the file if it already exists. The current contents - and the contents of the scrollback history are not included in the - session log. Default is `off'. - - - Command: logfile filename - - Command: logfile flush secs - (none) - Defines the name the logfiles will get. The default is - `screenlog.%n'. The second form changes the number of seconds - `screen' will wait before flushing the logfile buffer to the - file-system. The default value is 10 seconds. - - - Command: logtstamp [state] - - Command: logtstamp `after' secs - - Command: logtstamp `string' string - (none) - This command controls logfile time-stamp mechanism of screen. If - time-stamps are turned `on', screen adds a string containing the - current time to the logfile after two minutes of inactivity. When - output continues and more than another two minutes have passed, a - second time-stamp is added to document the restart of the output. - You can change this timeout with the second form of the command. - The third form is used for customizing the time-stamp string (`-- - %n:%t -- time-stamp -- %M/%d/%y %c:%s --\n' by default). - - -File: screen.info, Node: Startup, Next: Miscellaneous, Prev: Logging, Up: Top - -Startup -******* - - This section describes commands which are only useful in the -`.screenrc' file, for use at startup. - -* Menu: - -* echo:: Display a message. -* sleep:: Pause execution of the `.screenrc'. -* Startup Message:: Control display of the copyright notice. - - -File: screen.info, Node: echo, Next: sleep, Up: Startup - -echo -==== - - - Command: echo [`-n'] message - (none) - The echo command may be used to annoy `screen' users with a - 'message of the day'. Typically installed in a global screenrc. - The option `-n' may be used to suppress the line feed. See also - `sleep'. Echo is also useful for online checking of environment - variables. - - -File: screen.info, Node: sleep, Next: Startup Message, Prev: echo, Up: Startup - -sleep -===== - - - Command: sleep num - (none) - This command will pause the execution of a .screenrc file for NUM - seconds. Keyboard activity will end the sleep. It may be used to - give users a chance to read the messages output by `echo'. - - -File: screen.info, Node: Startup Message, Prev: sleep, Up: Startup - -Startup Message -=============== - - - Command: startup_message state - (none) - Select whether you want to see the copyright notice during startup. - Default is `on', as you probably noticed. - - -File: screen.info, Node: Miscellaneous, Next: String Escapes, Prev: Startup, Up: Top - -Miscellaneous commands -********************** - - The commands described here do not fit well under any of the other -categories. - -* Menu: - -* At:: Execute a command at other displays or windows. -* Break:: Send a break signal to the window. -* Debug:: Suppress/allow debugging output. -* License:: Display the disclaimer page. -* Nethack:: Use `nethack'-like error messages. -* Nonblock:: Disable flow-control to a display. -* Number:: Change the current window's number. -* Silence:: Notify on inactivity. -* Time:: Display the time and load average. -* Verbose:: Display window creation commands. -* Version:: Display the version of `screen'. -* Zombie:: Keep dead windows. -* Printcmd:: Set command for VT100 printer port emulation. -* Sorendition:: Change the text highlighting method. -* Attrcolor:: Map attributes to colors. -* Setsid:: Change process group management. -* Eval:: Parse and execute arguments. -* Maxwin:: Set the maximum window number. -* Backtick:: Program a command for a backtick string escape. -* Screen Saver:: Define a screen safer. -* Zmodem:: Define how screen treats zmodem requests. - - -File: screen.info, Node: At, Next: Break, Up: Miscellaneous - -At -== - - - Command: at [identifier][#|*|%] command [args] - (none) - Execute a command at other displays or windows as if it had been - entered there. `At' changes the context (the `current window' or - `current display' setting) of the command. If the first parameter - describes a non-unique context, the command will be executed - multiple times. If the first parameter is of the form - `IDENTIFIER*' then identifier is matched against user names. The - command is executed once for each display of the selected user(s). - If the first parameter is of the form `IDENTIFIER%' identifier is - matched against displays. Displays are named after the ttys they - attach. The prefix `/dev/' or `/dev/tty' may be omitted from the - identifier. If IDENTIFIER has a `#' or nothing appended it is - matched against window numbers and titles. Omitting an identifier - in front of the `#', `*' or `%' character selects all users, - displays or windows because a prefix-match is performed. Note that - on the affected display(s) a short message will describe what - happened. Note that the `#' character works as a comment - introducer when it is preceded by whitespace. This can be escaped - by prefixing `#' with a `\'. Permission is checked for the - initiator of the `at' command, not for the owners of the affected - display(s). Caveat: When matching against windows, the command is - executed at least once per window. Commands that change the - internal arrangement of windows (like `other') may be called - again. In shared windows the command will be repeated for each - attached display. Beware, when issuing toggle commands like - `login'! Some commands (e.g. `\*Qprocess') require that a display - is associated with the target windows. These commands may not - work correctly under `at' looping over windows. - - -File: screen.info, Node: Break, Next: Debug, Prev: At, Up: Miscellaneous - -Break -===== - - - Command: break [duration] - (none) - Send a break signal for DURATION*0.25 seconds to this window. For - non-Posix systems the time interval is rounded up to full seconds. - Most useful if a character device is attached to the window rather - than a shell process (*note Window Types::). The maximum duration - of a break signal is limited to 15 seconds. - - - Command: pow_break - (none) - Reopen the window's terminal line and send a break condition. - - - Command: breaktype [tcsendbreak|TIOCSBRK|TCSBRK] - (none) - Choose one of the available methods of generating a break signal - for terminal devices. This command should affect the current - window only. But it still behaves identical to `defbreaktype'. - This will be changed in the future. Calling `breaktype' with no - parameter displays the break setting for the current window. - - - Command: defbreaktype [tcsendbreak|TIOCSBRK|TCSBRK] - (none) - Choose one of the available methods of generating a break signal - for terminal devices opened afterwards. The preferred methods are - `tcsendbreak' and `TIOCSBRK'. The third, `TCSBRK', blocks the - complete `screen' session for the duration of the break, but it - may be the only way to generate long breaks. `tcsendbreak' and - `TIOCSBRK' may or may not produce long breaks with spikes (e.g. 4 - per second). This is not only system dependant, this also differs - between serial board drivers. Calling `defbreaktype' with no - parameter displays the current setting. - - -File: screen.info, Node: Debug, Next: License, Prev: Break, Up: Miscellaneous - -Debug -===== - - - Command: debug [on|off] - (none) - Turns runtime debugging on or off. If `screen' has been compiled - with option `-DDEBUG' debugging is available and is turned on per - default. Note that this command only affects debugging output - from the main `SCREEN' process correctly. Debug output from - attacher processes can only be turned off once and forever. - - -File: screen.info, Node: License, Next: Nethack, Prev: Debug, Up: Miscellaneous - -License -======= - - - Command: license - (none) - Display the disclaimer page. This is done whenever `screen' is - started without options, which should be often enough. - - -File: screen.info, Node: Nethack, Next: Nonblock, Prev: License, Up: Miscellaneous - -Nethack -======= - - - Command: nethack state - (none) - Changes the kind of error messages used by `screen'. When you are - familiar with the game `nethack', you may enjoy the nethack-style - messages which will often blur the facts a little, but are much - funnier to read. Anyway, standard messages often tend to be - unclear as well. - - This option is only available if `screen' was compiled with the - NETHACK flag defined (*note Installation::). The default setting - is then determined by the presence of the environment variable - `$NETHACKOPTIONS'. - - -File: screen.info, Node: Nonblock, Next: Number, Prev: Nethack, Up: Miscellaneous - -Nonblock -======== - - - Command: nonblock [STATE|NUMSECS] - Tell screen how to deal with user interfaces (displays) that cease - to accept output. This can happen if a user presses ^S or a - TCP/modem connection gets cut but no hangup is received. If - nonblock is `off' (this is the default) screen waits until the - display restarts to accept the output. If nonblock is `on', screen - waits until the timeout is reached (`on' is treated as 1s). If the - display still doesn't receive characters, screen will consider it - "blocked" and stop sending characters to it. If at some time it - restarts to accept characters, screen will unblock the display and - redisplay the updated window contents. - - - Command: defnonblock STATE|NUMSECS - Same as the `nonblock' command except that the default setting for - displays is changed. Initial setting is `off'. - - -File: screen.info, Node: Number, Next: Silence, Prev: Nonblock, Up: Miscellaneous - -Number -====== - - - Command: number [N] - (`C-a N') - Change the current window's number. If the given number N is - already used by another window, both windows exchange their - numbers. If no argument is specified, the current window number - (and title) is shown. - - -File: screen.info, Node: Silence, Next: Time, Prev: Number, Up: Miscellaneous - -Silence -======= - - - Command: silence [STATE|SEC] - (none) - Toggles silence monitoring of windows. When silence is turned on - and an affected window is switched into the background, you will - receive the silence notification message in the status line after - a specified period of inactivity (silence). The default timeout - can be changed with the `silencewait' command or by specifying a - number of seconds instead of `on' or `off'. Silence is initially - off for all windows. - - - Command: defsilence state - (none) - Same as the `silence' command except that the default setting for - new windows is changed. Initial setting is `off'. - - - Command: silencewait SECONDS - (none) - Define the time that all windows monitored for silence should wait - before displaying a message. Default is 30 seconds. - - -File: screen.info, Node: Time, Next: Verbose, Prev: Silence, Up: Miscellaneous - -Time -==== - - - Command: time [STRING] - (`C-a t', `C-a C-t') - Uses the message line to display the time of day, the host name, - and the load averages over 1, 5, and 15 minutes (if this is - available on your system). For window-specific information use - `info' (*note Info::). If a STRING is specified, it changes the - format of the time report like it is described in the string - escapes chapter (*note String Escapes::). Screen uses a default of - `%c:%s %M %d %H%? %l%?'. - - -File: screen.info, Node: Verbose, Next: Version, Prev: Time, Up: Miscellaneous - -Verbose -======= - - - Command: verbose [on|off] - If verbose is switched on, the command name is echoed, whenever a - window is created (or resurrected from zombie state). Default is - off. Without parameter, the current setting is shown. - - -File: screen.info, Node: Version, Next: Zombie, Prev: Verbose, Up: Miscellaneous - -Version -======= - - - Command: version - (`C-a v') - Display the version and modification date in the message line. - - -File: screen.info, Node: Zombie, Next: Printcmd, Prev: Version, Up: Miscellaneous - -Zombie -====== - - - Command: zombie [KEYS] - - Command: defzombie [KEYS] - (none) - Per default windows are removed from the window list as soon as the - windows process (e.g. shell) exits. When a string of two keys is - specified to the zombie command, `dead' windows will remain in the - list. The `kill' command may be used to remove the window. - Pressing the first key in the dead window has the same effect. - Pressing the second key, however, screen will attempt to resurrect - the window. The process that was initially running in the window - will be launched again. Calling `zombie' without parameters will - clear the zombie setting, thus making windows disappear when the - process terminates. - - As the zombie setting is affected globally for all windows, this - command should only be called `defzombie'. Until we need this as a - per window setting, the commands `zombie' and `defzombie' are - synonymous. - - -File: screen.info, Node: Printcmd, Next: Sorendition, Prev: Zombie, Up: Miscellaneous - -Printcmd -======== - - - Command: printcmd [CMD] - (none) - If CMD is not an empty string, screen will not use the terminal - capabilities `po/pf' for printing if it detects an ansi print - sequence `ESC [ 5 i', but pipe the output into CMD. This should - normally be a command like `lpr' or `cat > /tmp/scrprint'. - `Printcmd' without an argument displays the current setting. The - ansi sequence `ESC \' ends printing and closes the pipe. - - Warning: Be careful with this command! If other user have write - access to your terminal, they will be able to fire off print - commands. - - -File: screen.info, Node: Sorendition, Next: Attrcolor, Prev: Printcmd, Up: Miscellaneous - -Sorendition -=========== - - - Command: sorendition [ATTR [COLOR]] - (none) - Change the way screen does highlighting for text marking and - printing messages. See the chapter about string escapes (*note - String Escapes::) for the syntax of the modifiers. The default is - currently `=s dd' (standout, default colors). - - -File: screen.info, Node: Attrcolor, Next: Setsid, Prev: Sorendition, Up: Miscellaneous - -Attrcolor -========= - - - Command: attrcolor ATTRIB [ATTRIBUTE/COLOR-MODIFIER] - (none) - This command can be used to highlight attributes by changing the - color of the text. If the attribute ATTRIB is in use, the - specified attribute/color modifier is also applied. If no modifier - is given, the current one is deleted. See the chapter about string - escapes (*note String Escapes::) for the syntax of the modifier. - Screen understands two pseudo-attributes, `i' stands for - high-intensity foreground color and `I' for high-intensity - background color. - - Examples: - `attrcolor b "R"' - Change the color to bright red if bold text is to be printed. - - `attrcolor u "-u b"' - Use blue text instead of underline. - - `attrcolor b ".I"' - Use bright colors for bold text. Most terminal emulators do - this already. - - `attrcolor i "+b"' - Make bright colored text also bold. - - -File: screen.info, Node: Setsid, Next: Eval, Prev: Attrcolor, Up: Miscellaneous - -Setsid -====== - - - Command: setsid state - (none) - Normally screen uses different sessions and process groups for the - windows. If setsid is turned `off', this is not done anymore and - all windows will be in the same process group as the screen - backend process. This also breaks job-control, so be careful. The - default is `on', of course. This command is probably useful only - in rare circumstances. - - -File: screen.info, Node: Eval, Next: Maxwin, Prev: Setsid, Up: Miscellaneous - -Eval -==== - - - Command: eval COMMAND1 [COMMAND2 ...] - (none) - Parses and executes each argument as separate command. - - -File: screen.info, Node: Maxwin, Next: Backtick, Prev: Eval, Up: Miscellaneous - -Maxwin -====== - - - Command: maxwin N - (none) - Set the maximum window number screen will create. Doesn't affect - already existing windows. The number may only be decreased. - - -File: screen.info, Node: Backtick, Next: Screen Saver, Prev: Maxwin, Up: Miscellaneous - -Backtick -======== - - - Command: backtick ID LIFESPAN AUTOREFRESH COMMAND [ARGS] - - Command: backtick ID - (none) - Program the backtick command with the numerical id ID. The output - of such a command is used for substitution of the `%`' string - escape (*note String Escapes::). The specified LIFESPAN is the - number of seconds the output is considered valid. After this time, - the command is run again if a corresponding string escape is - encountered. The AUTOREFRESH parameter triggers an automatic - refresh for caption and hardstatus strings after the specified - number of seconds. Only the last line of output is used for - substitution. - - If both the LIFESPAN and the AUTOREFRESH parameters are zero, the - backtick program is expected to stay in the background and - generate output once in a while. In this case, the command is - executed right away and screen stores the last line of output. If - a new line gets printed screen will automatically refresh the - hardstatus or the captions. - - The second form of the command deletes the backtick command with - the numerical id ID. - - -File: screen.info, Node: Screen Saver, Next: Zmodem, Prev: Backtick, Up: Miscellaneous - -Screen Saver -============ - - - Command: idle [TIMEOUT [CMD ARGS]] - (none) - Sets a command that is run after the specified number of seconds - inactivity is reached. This command will normally be the `blanker' - command to create a screen blanker, but it can be any screen - command. If no command is specified, only the timeout is set. A - timeout of zero (ot the special timeout `off') disables the timer. - If no arguments are given, the current settings are displayed. - - - Command: blanker - (none) - Activate the screen blanker. First the screen is cleared. If no - blanker program is defined, the cursor is turned off, otherwise, - the program is started and it's output is written to the screen. - The screen blanker is killed with the first keypress, the read key - is discarded. - - This command is normally used together with the `idle' command. - - - Command: blankerprg [PROGRAM ARGS] - Defines a blanker program. Disables the blanker program if no - arguments are given. - - -File: screen.info, Node: Zmodem, Prev: Screen Saver, Up: Miscellaneous - -Zmodem -====== - - - Command: zmodem [off|auto|catch|pass] - - Command: zmodem sendcmd [string] - - Command: zmodem recvcmd [string] - (none) - Define zmodem support for screen. Screen understands two different - modes when it detects a zmodem request: `pass' and `catch'. If the - mode is set to `pass', screen will relay all data to the attacher - until the end of the transmission is reached. In `catch' mode - screen acts as a zmodem endpoint and starts the corresponding - rz/sz commands. If the mode is set to `auto', screen will use - `catch' if the window is a tty (e.g. a serial line), otherwise it - will use `pass'. - - You can define the templates screen uses in `catch' mode via the - second and the third form. - - Note also that this is an experimental feature. - - -File: screen.info, Node: String Escapes, Next: Environment, Prev: Miscellaneous, Up: Top - -String Escapes -************** - - Screen provides an escape mechanism to insert information like the -current time into messages or file names. The escape character is `%' -with one exception: inside of a window's hardstatus `^%' (`^E') is used -instead. - - Here is the full list of supported escapes: - -`%' - the escape character itself - -`a' - either `am' or `pm' - -`A' - either `AM' or `PM' - -`c' - current time `HH:MM' in 24h format - -`C' - current time `HH:MM' in 12h format - -`d' - day number - -`D' - weekday name - -`f' - flags of the window - -`F' - sets %? to true if the window has the focus - -`h' - hardstatus of the window - -`H' - hostname of the system - -`l' - current load of the system - -`m' - month number - -`M' - month name - -`n' - window number - -`s' - seconds - -`t' - window title - -`u' - all other users on this window - -`w' - all window numbers and names. With `-' quailifier: up to the - current window; with `+' qualifier: starting with the window after - the current one. - -`W' - all window numbers and names except the current one - -`y' - last two digits of the year number - -`Y' - full year number - -`?' - the part to the next `%?' is displayed only if a `%' escape inside - the part expands to a non-empty string - -`:' - else part of `%?' - -`=' - pad the string to the display's width (like TeX's hfill). If a - number is specified, pad to the percentage of the window's width. - A `0' qualifier tells screen to treat the number as absolute - position. You can specify to pad relative to the last absolute - pad position by adding a `+' qualifier or to pad relative to the - right margin by using `-'. The padding truncates the string if the - specified position lies before the current position. Add the `L' - qualifier to change this. - -`<' - same as `%=' but just do truncation, do not fill with spaces - -`>' - mark the current text position for the next truncation. When - screen needs to do truncation, it tries to do it in a way that the - marked position gets moved to the specified percentage of the - output area. (The area starts from the last absolute pad position - and ends with the position specified by the truncation operator.) - The `L' qualifier tells screen to mark the truncated parts with - `...'. - -`{' - attribute/color modifier string terminated by the next `}' - -``' - Substitute with the output of a `backtick' command. The length - qualifier is misused to identify one of the commands. *Note - Backtick::. - The `c' and `C' escape may be qualified with a `0' to make screen use -zero instead of space as fill character. The `n' and `=' escapes -understand a length qualifier (e.g. `%3n'), `D' and `M' can be prefixed -with `L' to generate long names, `w' and `W' also show the window flags -if `L' is given. - - An attribute/color modifier is is used to change the attributes or -the color settings. Its format is `[attribute modifier] [color -description]'. The attribute modifier must be prefixed by a change type -indicator if it can be confused with a color desciption. The following -change types are known: -`+' - add the specified set to the current attributes - -`-' - remove the set from the current attributes - -`!' - invert the set in the current attributes - -`=' - change the current attributes to the specified set - The attribute set can either be specified as a hexadecimal number or -a combination of the following letters: -`d' - dim - -`u' - underline - -`b' - bold - -`r' - reverse - -`s' - standout - -`B' - blinking - Colors are coded either as a hexadecimal number or two letters -specifying the desired background and foreground color (in that order). -The following colors are known: -`k' - black - -`r' - red - -`g' - green - -`y' - yellow - -`b' - blue - -`m' - magenta - -`c' - cyan - -`w' - white - -`d' - default color - -`.' - leave color unchanged - The capitalized versions of the letter specify bright colors. You -can also use the pseudo-color `i' to set just the brightness and leave -the color unchanged. - - A one digit/letter color description is treated as foreground or -background color dependant on the current attributes: if reverse mode is -set, the background color is changed instead of the foreground color. -If you don't like this, prefix the color with a `.'. If you want the -same behaviour for two-letter color descriptions, also prefix them with -a `.'. - - As a special case, `%{-}' restores the attributes and colors that -were set before the last change was made (i.e. pops one level of the -color-change stack). - -Examples: -`G' - set color to bright green - -`+b r' - use bold red - -`= yd' - clear all attributes, write in default color on yellow background. - -`%-Lw%{= BW}%50>%n%f* %t%{-}%+Lw%<' - The available windows centered at the current win dow and - truncated to the available width. The current window is displayed - white on blue. This can be used with `hardstatus alwayslastline'. - -`%?%F%{.R.}%?%3n %t%? [%h]%?' - The window number and title and the window's hardstatus, if one is - set. Also use a red background if this is the active focus. - Useful for `caption string'. - - -File: screen.info, Node: Environment, Next: Files, Prev: String Escapes, Up: Top - -Environment Variables -********************* - -`COLUMNS' - Number of columns on the terminal (overrides termcap entry). - -`HOME' - Directory in which to look for .screenrc. - -`LINES' - Number of lines on the terminal (overrides termcap entry). - -`LOCKPRG' - Screen lock program. - -`NETHACKOPTIONS' - Turns on `nethack' option. - -`PATH' - Used for locating programs to run. - -`SCREENCAP' - For customizing a terminal's `TERMCAP' value. - -`SCREENDIR' - Alternate socket directory. - -`SCREENRC' - Alternate user screenrc file. - -`SHELL' - Default shell program for opening windows (default `/bin/sh'). - -`STY' - Alternate socket name. If `screen' is invoked, and the environment - variable `STY' is set, then it creates only a window in the - running `screen' session rather than starting a new session. - -`SYSSCREENRC' - Alternate system screenrc file. - -`TERM' - Terminal name. - -`TERMCAP' - Terminal description. - -`WINDOW' - Window number of a window (at creation time). - diff --git a/doc/screen.info-5 b/doc/screen.info-5 deleted file mode 100644 index fff18bd..0000000 --- a/doc/screen.info-5 +++ /dev/null @@ -1,608 +0,0 @@ -This is screen.info, produced by makeinfo version 4.5 from -./screen.texinfo. - -INFO-DIR-SECTION General Commands -START-INFO-DIR-ENTRY -* Screen: (screen). Full-screen window manager. -END-INFO-DIR-ENTRY - - This file documents the `Screen' virtual terminal manager. - - Copyright (c) 1993-2003 Free Software Foundation, Inc. - - Permission is granted to make and distribute verbatim copies of this -manual provided the copyright notice and this permission notice are -preserved on all copies. - - Permission is granted to copy and distribute modified versions of -this manual under the conditions for verbatim copying, provided that -the entire resulting derived work is distributed under the terms of a -permission notice identical to this one. - - Permission is granted to copy and distribute translations of this -manual into another language, under the above conditions for modified -versions, except that this permission notice may be stated in a -translation approved by the Foundation. - - -File: screen.info, Node: Files, Next: Credits, Prev: Environment, Up: Top - -Files Referenced -**************** - -`.../screen-4.?.??/etc/screenrc' -`.../screen-4.?.??/etc/etcscreenrc' - Examples in the `screen' distribution package for private and - global initialization files. - -``$SYSSCREENRC'' -`/local/etc/screenrc' - `screen' initialization commands - -``$SCREENRC'' -``$HOME'/.iscreenrc' -``$HOME'/.screenrc' - Read in after /local/etc/screenrc - -``$SCREENDIR'/S-LOGIN' - -`/local/screens/S-LOGIN' - Socket directories (default) - -`/usr/tmp/screens/S-LOGIN' - Alternate socket directories. - -`SOCKET DIRECTORY/.termcap' - Written by the `dumptermcap' command - -`/usr/tmp/screens/screen-exchange or' -`/tmp/screen-exchange' - `screen' interprocess communication buffer - -`hardcopy.[0-9]' - Screen images created by the hardcopy command - -`screenlog.[0-9]' - Output log files created by the log command - -`/usr/lib/terminfo/?/* or' -`/etc/termcap' - Terminal capability databases - -`/etc/utmp' - Login records - -``$LOCKPRG'' - Program for locking the terminal. - - -File: screen.info, Node: Credits, Next: Bugs, Prev: Files, Up: Top - -Credits -******* - -Authors -======= - - Originally created by Oliver Laumann, this latest version was -produced by Wayne Davison, Juergen Weigert and Michael Schroeder. - -Contributors -============ - - Ken Beal (kbeal@amber.ssd.csd.harris.com), - Rudolf Koenig (rfkoenig@informatik.uni-erlangen.de), - Toerless Eckert (eckert@informatik.uni-erlangen.de), - Wayne Davison (davison@borland.com), - Patrick Wolfe (pat@kai.com, kailand!pat), - Bart Schaefer (schaefer@cse.ogi.edu), - Nathan Glasser (nathan@brokaw.lcs.mit.edu), - Larry W. Virden (lvirden@cas.org), - Howard Chu (hyc@hanauma.jpl.nasa.gov), - Tim MacKenzie (tym@dibbler.cs.monash.edu.au), - Markku Jarvinen (mta@{cc,cs,ee}.tut.fi), - Marc Boucher (marc@CAM.ORG), - Doug Siebert (dsiebert@isca.uiowa.edu), - Ken Stillson (stillson@tsfsrv.mitre.org), - Ian Frechett (frechett@spot.Colorado.EDU), - Brian Koehmstedt (bpk@gnu.ai.mit.edu), - Don Smith (djs6015@ultb.isc.rit.edu), - Frank van der Linden (vdlinden@fwi.uva.nl), - Martin Schweikert (schweik@cpp.ob.open.de), - David Vrona (dave@sashimi.lcu.com), - E. Tye McQueen (tye%spillman.UUCP@uunet.uu.net), - Matthew Green (mrg@eterna.com.au), - Christopher Williams (cgw@pobox.com), - Matt Mosley (mattm@access.digex.net), - Gregory Neil Shapiro (gshapiro@wpi.WPI.EDU), - Jason Merrill (jason@jarthur.Claremont.EDU), - Johannes Zellner (johannes@zellner.org), - Pablo Averbuj (pablo@averbuj.com). - -Version -======= - - This manual describes version 4.0.2 of the `screen' program. Its -roots are a merge of a custom version 2.3PR7 by Wayne Davison and -several enhancements to Oliver Laumann's version 2.0. Note that all -versions numbered 2.x are copyright by Oliver Laumann. - - See also *Note Availability::. - - -File: screen.info, Node: Bugs, Next: Installation, Prev: Credits, Up: Top - -Bugs -**** - - Just like any other significant piece of software, `screen' has a -few bugs and missing features. Please send in a bug report if you have -found a bug not mentioned here. - -* Menu: - -* Known Bugs:: Problems we know about. -* Reporting Bugs:: How to contact the maintainers. -* Availability:: Where to find the lastest screen version. - - -File: screen.info, Node: Known Bugs, Next: Reporting Bugs, Up: Bugs - -Known Bugs -========== - - * `dm' (delete mode) and `xs' are not handled correctly (they are - ignored). `xn' is treated as a magic-margin indicator. - - * `screen' has no clue about double-high or double-wide characters. - But this is the only area where `vttest' is allowed to fail. - - * It is not possible to change the environment variable `$TERMCAP' - when reattaching under a different terminal type. - - * The support of terminfo based systems is very limited. Adding extra - capabilities to `$TERMCAP' may not have any effects. - - * `screen' does not make use of hardware tabs. - - * `screen' must be installed setuid root on most systems in order to - be able to correctly change the owner of the tty device file for - each window. Special permission may also be required to write the - file `/etc/utmp'. - - * Entries in `/etc/utmp' are not removed when `screen' is killed - with SIGKILL. This will cause some programs (like "w" or "rwho") - to advertise that a user is logged on who really isn't. - - * `screen' may give a strange warning when your tty has no utmp - entry. - - * When the modem line was hung up, `screen' may not automatically - detach (or quit) unless the device driver sends a HANGUP signal. - To detach such a `screen' session use the -D or -d command line - option. - - * If a password is set, the command line options -d and -D still - detach a session without asking. - - * Both `breaktype' and `defbreaktype' change the break generating - method used by all terminal devices. The first should change a - window specific setting, where the latter should change only the - default for new windows. - - * When attaching to a multiuser session, the user's `.screenrc' file - is not sourced. Each users personal settings have to be included - in the `.screenrc' file from which the session is booted, or have - to be changed manually. - - * A weird imagination is most useful to gain full advantage of all - the features. - - -File: screen.info, Node: Reporting Bugs, Next: Availability, Prev: Known Bugs, Up: Bugs - -Reporting Bugs -============== - - If you find a bug in `Screen', please send electronic mail to -`screen@uni-erlangen.de', and also to `bug-gnu-utils@prep.ai.mit.edu'. -Include the version number of `Screen' which you are using. Also -include in your message the hardware and operating system, the compiler -used to compile, a description of the bug behavior, and the conditions -that triggered the bug. Please recompile `screen' with the `-DDEBUG' -options enabled, reproduce the bug, and have a look at the debug output -written to the directory `/tmp/debug'. If necessary quote suspect -passages from the debug output and show the contents of your `config.h' -if it matters. - - -File: screen.info, Node: Availability, Prev: Reporting Bugs, Up: Bugs - -Availability -============ - - `Screen' is available under the `GNU' copyleft. - - The latest official release of `screen' available via anonymous ftp -from `prep.ai.mit.edu', `nic.funet.fi' or any other `GNU' distribution -site. The home site of `screen' is `ftp.uni-erlangen.de -(131.188.3.71)', in the directory `pub/utilities/screen'. The -subdirectory `private' contains the latest beta testing release. If -you want to help, send a note to screen@uni-erlangen.de. - - -File: screen.info, Node: Installation, Next: Concept Index, Prev: Bugs, Up: Top - -Installation -************ - - Since `screen' uses pseudo-ttys, the select system call, and -UNIX-domain sockets/named pipes, it will not run under a system that -does not include these features of 4.2 and 4.3 BSD UNIX. - -* Menu: - -* Socket Directory:: Where screen stores its handle. -* Compiling Screen:: - - -File: screen.info, Node: Socket Directory, Next: Compiling Screen, Up: Installation - -Socket Directory -================ - - The socket directory defaults either to `$HOME/.screen' or simply to -`/tmp/screens' or preferably to `/usr/local/screens' chosen at -compile-time. If `screen' is installed setuid root, then the -administrator should compile screen with an adequate (not NFS mounted) -`SOCKDIR'. If `screen' is not running setuid-root, the user can specify -any mode 700 directory in the environment variable `$SCREENDIR'. - - -File: screen.info, Node: Compiling Screen, Prev: Socket Directory, Up: Installation - -Compiling Screen -================ - - To compile and install screen: - - The `screen' package comes with a `GNU Autoconf' configuration -script. Before you compile the package run - - `sh ./configure' - This will create a `config.h' and `Makefile' for your -machine. If `configure' fails for some reason, then look at the -examples and comments found in the `Makefile.in' and `config.h.in' -templates. Rename `config.status' to `config.status.MACHINE' when you -want to keep configuration data for multiple architectures. Running `sh -./config.status.MACHINE' recreates your configuration significantly -faster than rerunning `configure'. -Read through the "User Configuration" section of `config.h', and verify -that it suits your needs. A comment near the top of this section -explains why it's best to install screen setuid to root. Check for the -place for the global `screenrc'-file and for the socket directory. -Check the compiler used in `Makefile', the prefix path where to install -`screen'. Then run - - `make' - If `make' fails to produce one of the files `term.h', `comm.h' -or `tty.c', then use `FILENAME.X.dist' instead. For additional -information about installation of `screen' refer to the file -`INSTALLATION', coming with this package. - - -File: screen.info, Node: Concept Index, Next: Command Index, Prev: Installation, Up: Top - -Concept Index -************* - -* Menu: - -* .screenrc: Startup Files. -* availability: Availability. -* binding: Key Binding. -* bug report: Reporting Bugs. -* bugs: Bugs. -* capabilities: Special Capabilities. -* command character: Command Character. -* command line options: Invoking Screen. -* command summary: Command Summary. -* compiling screen: Compiling Screen. -* control sequences: Control Sequences. -* copy and paste: Copy and Paste. -* customization: Customization. -* environment: Environment. -* escape character: Command Character. -* files: Files. -* flow control: Flow Control. -* input translation: Input Translation. -* installation: Installation. -* introduction: Getting Started. -* invoking: Invoking Screen. -* key binding: Key Binding. -* marking: Copy. -* message line: Message Line. -* multiuser session: Multiuser Session. -* options: Invoking Screen. -* overview: Overview. -* regions: Regions. -* screenrc: Startup Files. -* scrollback: Copy. -* socket directory: Socket Directory. -* string escapes: String Escapes. -* terminal capabilities: Special Capabilities. -* title: Naming Windows. -* window types: Window Types. - - -File: screen.info, Node: Command Index, Next: Keystroke Index, Prev: Concept Index, Up: Top - -Command Index -************* - - This is a list of all the commands supported by `screen'. - -* Menu: - -* acladd: Acladd. -* aclchg: Aclchg. -* acldel: Acldel. -* aclgrp: Aclgrp. -* aclumask: Umask. -* activity: Monitor. -* addacl: Acladd. -* allpartial: Redisplay. -* altscreen: Redisplay. -* at: At. -* attrcolor: Attrcolor. -* autodetach: Detach. -* autonuke: Autonuke. -* backtick: Backtick. -* bce: Character Processing. -* bell_msg: Bell. -* bind: Bind. -* bindkey: Bindkey. -* blanker: Screen Saver. -* blankerprg: Screen Saver. -* break: Break. -* breaktype: Break. -* bufferfile: Screen Exchange. -* c1: Character Processing. -* caption: Caption. -* chacl: Aclchg. -* charset: Character Processing. -* chdir: Chdir. -* clear: Clear. -* colon: Colon. -* command: Command Character. -* compacthist: Scrollback. -* console: Console. -* copy: Copy. -* copy_reg: Registers. -* crlf: Line Termination. -* debug: Debug. -* defautonuke: Autonuke. -* defbce: Character Processing. -* defbreaktype: Break. -* defc1: Character Processing. -* defcharset: Character Processing. -* defencoding: Character Processing. -* defescape: Command Character. -* defflow: Flow. -* defgr: Character Processing. -* defhstatus: Hardstatus. -* deflog: Log. -* deflogin: Login. -* defmode: Mode. -* defmonitor: Monitor. -* defnonblock: Nonblock. -* defobuflimit: Obuflimit. -* defscrollback: Scrollback. -* defshell: Shell. -* defsilence: Silence. -* defslowpaste: Paste. -* defutf8: Character Processing. -* defwrap: Wrap. -* defwritelock: Writelock. -* defzombie: Zombie. -* detach: Detach. -* digraph: Digraph. -* dinfo: Info. -* displays: Displays. -* dumptermcap: Dump Termcap. -* echo: echo. -* encoding: Character Processing. -* escape: Command Character. -* eval: Eval. -* exec: Exec. -* fit: Fit. -* flow: Flow. -* focus: Focus. -* gr: Character Processing. -* hardcopy: Hardcopy. -* hardcopy_append: Hardcopy. -* hardcopydir: Hardcopy. -* hardstatus: Hardware Status Line. -* height: Window Size. -* help: Help. -* history: History. -* hstatus: Hardstatus. -* idle: Screen Saver. -* ignorecase: Searching. -* info: Info. -* ins_reg: Registers. -* kill: Kill. -* lastmsg: Last Message. -* license: License. -* lockscreen: Lock. -* log: Log. -* logfile: Log. -* login: Login. -* logtstamp: Log. -* mapdefault: Bindkey Control. -* mapnotnext: Bindkey Control. -* maptimeout: Bindkey Control. -* markkeys: Copy Mode Keys. -* maxwin: Maxwin. -* meta: Command Character. -* monitor: Monitor. -* msgminwait: Message Wait. -* msgwait: Message Wait. -* multiuser: Multiuser. -* nethack: Nethack. -* next: Next and Previous. -* nonblock: Nonblock. -* number: Number. -* obuflimit: Obuflimit. -* only: Only. -* other: Other Window. -* partial: Redisplay. -* password: Detach. -* paste: Paste. -* pastefont: Paste. -* pow_break: Break. -* pow_detach: Power Detach. -* pow_detach_msg: Power Detach. -* prev: Next and Previous. -* printcmd: Printcmd. -* process: Registers. -* quit: Quit. -* readbuf: Screen Exchange. -* readreg: Paste. -* redisplay: Redisplay. -* register: Registers. -* remove: Remove. -* removebuf: Screen Exchange. -* reset: Reset. -* resize: Resize. -* screen: Screen Command. -* scrollback: Scrollback. -* select: Select. -* sessionname: Session Name. -* setenv: Setenv. -* setsid: Setsid. -* shell: Shell. -* shelltitle: Shell. -* silence: Silence. -* silencewait: Silence. -* sleep: sleep. -* slowpaste: Paste. -* sorendition: Sorendition. -* source: Source. -* split: Split. -* startup_message: Startup Message. -* stuff: Paste. -* su: Su. -* suspend: Suspend. -* term: Term. -* termcap: Termcap Syntax. -* termcapinfo: Termcap Syntax. -* terminfo: Termcap Syntax. -* time: Time. -* title: Title Command. -* umask: Umask. -* unsetenv: Setenv. -* utf8: Character Processing. -* vbell: Bell. -* vbell_msg: Bell. -* vbellwait: Bell. -* verbose: Verbose. -* version: Version. -* wall: Wall. -* width: Window Size. -* windowlist: Windowlist. -* windows: Windows. -* wrap: Wrap. -* writebuf: Screen Exchange. -* writelock: Writelock. -* xoff: XON/XOFF. -* xon: XON/XOFF. -* zmodem: Zmodem. -* zombie: Zombie. - - -File: screen.info, Node: Keystroke Index, Prev: Command Index, Up: Top - -Keystroke Index -*************** - - This is a list of the default key bindings. - - The leading escape character (*note Command Character::) has been -omitted from the key sequences, since it is the same for all bindings. - -* Menu: - -* ": Windowlist. -* ': Select. -* *: Displays. -* .: Dump Termcap. -* 0...9: Select. -* :: Colon. -* <: Screen Exchange. -* =: Screen Exchange. -* >: Screen Exchange. -* ?: Help. -* [: Copy. -* ]: Paste. -* a: Command Character. -* A: Title Command. -* C: Clear. -* c: Screen Command. -* C-[: Copy. -* C-\: Quit. -* C-]: Paste. -* C-a: Other Window. -* C-c: Screen Command. -* C-d: Detach. -* C-f: Flow. -* C-g: Bell. -* C-h: Hardcopy. -* C-i: Info. -* C-k: Kill. -* C-l: Redisplay. -* C-m: Last Message. -* C-n: Next and Previous. -* C-p: Next and Previous. -* C-q: XON/XOFF. -* C-r: Wrap. -* C-s: XON/XOFF. -* C-t: Time. -* C-v: Digraph. -* C-w: Windows. -* C-x: Lock. -* C-z: Suspend. -* D: Power Detach. -* d: Detach. -* ESC: Copy. -* f: Flow. -* F: Fit. -* H: Log. -* h: Hardcopy. -* i: Info. -* k: Kill. -* l: Redisplay. -* L: Login. -* m: Last Message. -* M: Monitor. -* N: Number. -* n: Next and Previous. -* p: Next and Previous. -* q: XON/XOFF. -* Q: Only. -* r: Wrap. -* s: XON/XOFF. -* S: Split. -* SPC: Next and Previous. -* t: Time. -* TAB: Focus. -* v: Version. -* W: Window Size. -* w: Windows. -* X: Remove. -* x: Lock. -* Z: Reset. -* z: Suspend. -* {: History. - - diff --git a/incoming/howto/emulate_vims_help.txt b/incoming/howto/emulate_vims_help.txt new file mode 100644 index 0000000..b7e3c3f --- /dev/null +++ b/incoming/howto/emulate_vims_help.txt @@ -0,0 +1,52 @@ + Date: Mon, 7 Apr 2003 02:01:59 +0000 (UTC) + From: Miciah Dashiel Butler Masters <gcgs-gnu-screen@m.gmane.org> +Subject: Re: HOWTO: emulate vim's :help in a screen window + +In article <20030406193514.4b43c6ba.mramos@adinet.com.uy>, Marcelo Ramos wrote: +> Something interesting and useful developed with Miciah's help a few minutes +> ago in the #screen channel (irc.debian.org): +> +> 1) Create a shell script "showman": +> +> echo -n "What manpage?"; read X; man $X; screen -X eval 'focus bottom' remove +> +> 2) Put the following in your.screenrc: +> +> bindkey "^B" eval split "focus bottom" "screen /path/to/showman" +> +> 3) Now press ^B and enjoy :-) +> +> (^B or the key you prefer) + +You inspired to write a couple of scripts to generalise this process: + +screen-run-program-in-region: + #!/bin/sh + + eval "$*" + echo -n Press any key to close this region... + read throwaway_variable + screen -X eval 'focus bottom' remove + +screen-open-region-with-program: + #!/bin/sh + + screen -X eval \ + "focus bottom" \ + split \ + "focus bottom" \ + "screen screen-run-program-in-region $*" + +Note that enabling zombie-mode will interfere with this script's +operation -- to kill the zombie window, screen-run-program-in-region +would need to also send Screen the 'kill' command. Unfortunately, if you +_disable_ zombie-mode then the 'kill' command would probably kill a +program that you _don't_ want killed. This is why we need a per-window +zombie-setting (*nudge* *nudge*). A way to silence the kill command +would also be nice. + +BTW, I know that 'echo -n' is not portable. Please forgive me. You can +feel free to remove the '-n'. + + -- Miciah <miciah@myrealbox.com> + diff --git a/kmapdef.c.dist b/kmapdef.c.dist deleted file mode 100644 index 71a5b53..0000000 --- a/kmapdef.c.dist +++ /dev/null @@ -1,144 +0,0 @@ -/* - * This file is automagically created from term.c -- DO NOT EDIT - */ - -#include "config.h" - -#ifdef MAPKEYS - -char *kmapdef[] = { -"\033[10~", -"\033OP", -"\033OQ", -"\033OR", -"\033OS", -"\033[15~", -"\033[17~", -"\033[18~", -"\033[19~", -"\033[20~", -"\033[21~", -"\033[23~", -"\033[24~", -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -"\033[1~", -0, -"\033[4~", -0, -"\033[6~", -"\033[5~", -"\033[2~", -"\033[3~", -"\033[A", -"\033[B", -"\033[C", -"\033[D", -"0", -"1", -"2", -"3", -"4", -"5", -"6", -"7", -"8", -"9", -"+", -"-", -"*", -"/", -"=", -".", -",", -"\015" -}; - -char *kmapadef[] = { -"\033OA", -"\033OB", -"\033OC", -"\033OD", -"\033Op", -"\033Oq", -"\033Or", -"\033Os", -"\033Ot", -"\033Ou", -"\033Ov", -"\033Ow", -"\033Ox", -"\033Oy", -"\033Ok", -"\033Om", -"\033Oj", -"\033Oo", -"\033OX", -"\033On", -"\033Ol", -"\033OM" -}; - -char *kmapmdef[] = { -"\004", -0, -0, -"\025", -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -"\201", -0, -"\205", -0, -"\006", -"\002", -0, -0, -"\220", -"\216", -"\206", -"\202" -}; - -#endif diff --git a/mktar.pl b/mktar.pl new file mode 100755 index 0000000..79b1731 --- /dev/null +++ b/mktar.pl @@ -0,0 +1,44 @@ +#! /usr/bin/perl -w +# +# create a tar ball snapshot from cvs repository. +# +# 2005-12-15, jw +# + +use Data::Dumper; + +my $srcdir = 'src'; +my $version_file = "$srcdir/patchlevel.h"; +my %symlinks = +( + 'FAQ' => 'doc/FAQ', + 'doc/install.sh' => '../install.sh' +); + +for my $l (keys %symlinks) + { + my $ll = "$srcdir/$l"; + next if -l $ll; + print "replacing $ll with a symlink to $symlinks{$l}\n"; + unlink $ll; + symlink $symlinks{$l}, $ll; + } + +my %version; +open IN, "<", $version_file or die "unable to read $version_file: $!"; +while (defined(my $line = <IN>)) + { + $version{$1} = (defined $3) ? $3 : $4 if $line =~ m{^#\s*define\s+(\w+)\s+("([^"]*)"|(\S+))}; + } +close IN; + +my $version = "$version{REV}.$version{VERS}.$version{PATCHLEVEL}"; +my $tmpdir = "/tmp/mktar-$^T"; +mkdir $tmpdir or die "cannot mkdir $tmpdir: $!"; +system "cp -a $srcdir $tmpdir" and die "'cp -a $srcdir $tmpdir' failed: $!"; +rename "$tmpdir/$srcdir", "$tmpdir/screen-$version" or die "rename to screen-$version failed: $!"; + +system "tar zcf - -C $tmpdir > screen-$version.tar.gz screen-$version"; +system "rm -rf $tmpdir"; + +print "screen-$version.tar.gz written.\n"; diff --git a/patches/bill_pursell_fFtT_402.patch b/patches/bill_pursell_fFtT_402.patch new file mode 100644 index 0000000..e655643 --- /dev/null +++ b/patches/bill_pursell_fFtT_402.patch @@ -0,0 +1,201 @@ +From screen-users-bounces+jw=cs.fau.de@gnu.org Fri Dec 16 22:23:46 2005 +Received: from faui45.informatik.uni-erlangen.de (IDENT:root@fauern.informatik.uni-erlangen.de [131.188.34.45]) + by faui40.informatik.uni-erlangen.de (8.9.3p3/8.1.49-FAU) with ESMTP id WAA08712 + for <jnweiger@i4.informatik.uni-erlangen.de>; Fri, 16 Dec 2005 22:23:46 +0100 (MET) +Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) + by faui45.informatik.uni-erlangen.de (8.9.3p3/8.1.49-FAU) with ESMTP id WAA28416 + for <jw@cs.fau.de>; Fri, 16 Dec 2005 22:23:45 +0100 (MET) +Received: from localhost ([127.0.0.1] helo=lists.gnu.org) + by lists.gnu.org with esmtp (Exim 4.43) + id 1EnN2o-0003P6-7M + for jw@cs.fau.de; Fri, 16 Dec 2005 16:23:14 -0500 +Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) + id 1EnKWZ-000807-RE + for screen-users@gnu.org; Fri, 16 Dec 2005 13:41:48 -0500 +Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) + id 1EnKWY-0007yj-AQ + for screen-users@gnu.org; Fri, 16 Dec 2005 13:41:47 -0500 +Received: from [199.232.76.173] (helo=monty-python.gnu.org) + by lists.gnu.org with esmtp (Exim 4.43) id 1EnKWX-0007y7-LZ + for screen-users@gnu.org; Fri, 16 Dec 2005 13:41:45 -0500 +Received: from [64.233.162.195] (helo=zproxy.gmail.com) + by monty-python.gnu.org with esmtp (Exim 4.34) id 1EnKZ0-0005Ig-91 + for screen-users@gnu.org; Fri, 16 Dec 2005 13:44:18 -0500 +Received: by zproxy.gmail.com with SMTP id i11so687899nzh + for <screen-users@gnu.org>; Fri, 16 Dec 2005 10:41:00 -0800 (PST) +DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; + h=received:message-id:date:from:user-agent:x-accept-language:mime-version:to:subject:content-type:content-transfer-encoding; + b=htOg5ElAxJoDWlgFSUJd85Bf6mf7Y8FPLZRoIWCdtrnesxVHg1ZMe5zNYUb1pVC9iK8cGKMIAFbgysTC3CeGK9JEJBEk6xNJCs7y5s2vSILQ9zV67ZkkikyK4ke+2rCHmj7xYDlLW+JsdqbbnVJilY7Xl/cxgcy9+MIfOdnucKw= +Received: by 10.65.197.20 with SMTP id z20mr1443729qbp; + Fri, 16 Dec 2005 10:41:00 -0800 (PST) +Received: from ?192.168.1.151? ( [82.24.24.234]) + by mx.gmail.com with ESMTP id q14sm641312qbq.2005.12.16.10.40.58; + Fri, 16 Dec 2005 10:40:59 -0800 (PST) +Message-ID: <43A30A56.1030000@gmail.com> +Date: Fri, 16 Dec 2005 18:41:26 +0000 +From: bill <bill.pursell@gmail.com> +User-Agent: Mozilla Thunderbird 1.0.7-1.1.fc3 (X11/20050929) +X-Accept-Language: en-us, en +MIME-Version: 1.0 +To: Screen Users <screen-users@gnu.org> +Content-Type: text/plain; charset=ISO-8859-1; format=flowed +Content-Transfer-Encoding: 7bit +Subject: fFtT patch +X-BeenThere: screen-users@gnu.org +X-Mailman-Version: 2.1.5 +Precedence: list +List-Id: General GNU Screen discussion <screen-users.gnu.org> +List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/screen-users>, + <mailto:screen-users-request@gnu.org?subject=unsubscribe> +List-Archive: <http://lists.gnu.org/pipermail/screen-users> +List-Post: <mailto:screen-users@gnu.org> +List-Help: <mailto:screen-users-request@gnu.org?subject=help> +List-Subscribe: <http://lists.gnu.org/mailman/listinfo/screen-users>, + <mailto:screen-users-request@gnu.org?subject=subscribe> +Sender: screen-users-bounces+jw=cs.fau.de@gnu.org +Errors-To: screen-users-bounces+jw=cs.fau.de@gnu.org +X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on + faui40.informatik.uni-erlangen.de +X-Spam-Level: +X-Spam-Status: No, hits=-4.8 required=5.0 tests=BAYES_00,RCVD_IN_SORBS + autolearn=no version=2.63 +Status: RO +Content-Length: 4721 +Lines: 145 + +Here's the patch which implements the fFtT;, cursor movements. I'm not +even remotely confident of this: I cut and pasted from a terminal +into thunderbird. + +[reformatted by jw, 2005-12-19] + +--- ./mark.c.orig 2005-12-16 19:48:09.000000000 +0100 ++++ ./mark.c 2005-12-19 12:00:42.795719267 +0100 +@@ -149,6 +149,55 @@ + #define NW_MUSTMOVE (1<<2) + #define NW_BIG (1<<3) + ++static int ++nextchar(int *xp, int *yp, int direction, char target, int num) ++{ /* Set *xp to the num-th occurrence of the target in the line. */ ++ ++ /* Return EXIT_FAILURE if the target doesn't appear num times. ++ Caller could use that to emit a warning. */ ++ ++ int width; /* width of the current window. */ ++ int x; /* x coordinate of the current cursor position. */ ++ int step; /* amount to increment x (+1 or -1) */ ++ int adjust; /* Final adjustment of cursor position. */ ++ char *displayed_line; /* Line in which search takes place. */ ++ ++ debug("nextchar\n"); ++ ++ x = *xp; ++ adjust = 0; ++ width = fore->w_width; ++ displayed_line = WIN(*yp) -> image; ++ ++ switch(direction) { ++ case 't': adjust = -1; /* fall through */ ++ case 'f': step = 1; /* fall through */ ++ break; ++ case 'T': adjust = 1; /* fall through */ ++ case 'F': step = -1; /* fall through */ ++ break; ++ default: ++ ASSERT(0); ++ } ++ ++ x += step; ++ ++ debug1("ml->image = %s\n", displayed_line); ++ debug2("num = %d, width = %d\n",num, width); ++ debug2("x = %d targe = %c\n", x, target ); ++ ++ for ( ;x>=0 && x <= width; x += step) { ++ if (displayed_line[x] == target) { ++ if (--num == 0) { ++ *xp = x + adjust; ++ return EXIT_SUCCESS; ++ } ++ } ++ } ++ return EXIT_FAILURE; ++} ++ ++ + static void + nextword(xp, yp, flags, num) + int *xp, *yp, flags, num; +@@ -534,8 +583,55 @@ + } + cx = markdata->cx; + cy = markdata->cy; ++ ++ if (markdata -> char_search[0]) { ++ debug2("searching for %c:%d\n",od,rep_cnt); ++ markdata->char_search[0] = 0; /* Clear the flag. */ ++ markdata->rep_cnt = 0; ++ ++ if (isgraph (od)) { ++ markdata->char_search[1] = od; ++ rep_cnt = (rep_cnt) ? rep_cnt : 1; ++ nextchar(&cx, &cy, markdata->char_search[2], od, rep_cnt ); ++ revto(cx, cy); ++ continue; ++ } ++ } ++ + switch (od) + { ++ case 'f': /* fall through */ ++ case 'F': /* fall through */ ++ case 't': /* fall through */ ++ case 'T': /* fall through */ ++ markdata -> char_search[0] = markdata->char_search[2] = od; ++ debug("entering char search\n"); ++ continue; ++ /* If we break, rep_cnt will be reset, so we ++ continue instead. It might be cleaner to ++ store the rep_count in char_search and ++ break here so later followon code will be ++ hit. */ ++ case ';': ++ if (!rep_cnt) rep_cnt = 1; ++ nextchar(&cx, &cy, markdata->char_search[2], markdata->char_search[1], rep_cnt ); ++ revto(cx, cy); ++ break; ++ case ',': { ++ int search_dir; ++ if (!rep_cnt) rep_cnt = 1; ++ switch (markdata->char_search[2]) { ++ case 't': search_dir = 'T'; break; ++ case 'T': search_dir = 't'; break; ++ case 'f': search_dir = 'F'; break; ++ case 'F': search_dir = 'f'; break; ++ } ++ nextchar(&cx, &cy, search_dir, markdata->char_search[1], rep_cnt ); ++ ++ revto(cx, cy); ++ break; ++ } ++ + case 'o': + case 'x': + if (!markdata->second) +--- ./mark.h.orig 2005-12-16 19:51:07.000000000 +0100 ++++ ./mark.h 2005-12-19 12:03:10.405928022 +0100 +@@ -41,6 +41,7 @@ + int isdir; /* current search direction */ + int isstartpos; /* position where isearch was started */ + int isstartdir; /* direction when isearch was started */ ++ int char_search[3]; + }; + + + + +_______________________________________________ +screen-users mailing list +screen-users@gnu.org +http://lists.gnu.org/mailman/listinfo/screen-users diff --git a/patches/screen-4.0.2.dif b/patches/screen-4.0.2.dif new file mode 100644 index 0000000..0fd7aec --- /dev/null +++ b/patches/screen-4.0.2.dif @@ -0,0 +1,29 @@ +--- screenrc ++++ screenrc 2000/09/01 14:38:23 +@@ -0,0 +1,4 @@ ++# this is the global screenrc file. Handle with care. ++ ++termcapinfo xterm* G0:is=\E[?4l\E>:ti@:te@ ++termcapinfo linux me=\E[m:AX +--- ./configure.in.orig 2004-02-16 14:48:22.000000000 +0000 ++++ ./configure.in 2004-02-16 14:49:11.000000000 +0000 +@@ -93,7 +93,7 @@ + AC_MSG_RESULT(yes) + AC_MSG_CHECKING(for the socket dir) + SOCKDIR="(eff_uid ? \"/tmp/uscreens\" : \"/tmp/screens\")" +- AC_ARG_WITH(socket-dir, [ --with-socket-dir=path where to put the per-user sockets], [ SOCKDIR="\"${withval}\"" ]) ++ AC_ARG_WITH(socket-dir, [ --with-socket-dir=path where to put the per-user sockets], [ SOCKDIR="${withval}" ]) + AC_MSG_RESULT(${SOCKDIR}) + AC_DEFINE_UNQUOTED(SOCKDIR, $SOCKDIR) + ] +--- ./configure.orig 2004-02-16 14:48:27.000000000 +0000 ++++ ./configure 2004-02-16 14:49:26.000000000 +0000 +@@ -3012,7 +3012,7 @@ + # Check whether --with-socket-dir or --without-socket-dir was given. + if test "${with_socket_dir+set}" = set; then + withval="$with_socket_dir" +- SOCKDIR="\"${withval}\"" ++ SOCKDIR="${withval}" + fi; + echo "$as_me:$LINENO: result: ${SOCKDIR}" >&5 + echo "${ECHO_T}${SOCKDIR}" >&6 diff --git a/patches/screen-__P.diff b/patches/screen-__P.diff new file mode 100644 index 0000000..26138c3 --- /dev/null +++ b/patches/screen-__P.diff @@ -0,0 +1,10 @@ +--- screen.h 2004/09/12 07:24:26 1.1 ++++ screen.h 2004/09/12 07:24:36 +@@ -25,6 +25,7 @@ + + #include "os.h" + ++#undef __P + #if defined(__STDC__) + # ifndef __P + # define __P(a) a diff --git a/patches/screen-gcc4.diff b/patches/screen-gcc4.diff new file mode 100644 index 0000000..6cd39c2 --- /dev/null +++ b/patches/screen-gcc4.diff @@ -0,0 +1,44 @@ +--- screen-4.0.2/fileio.c.xx 2005-04-08 13:37:18.823774606 +0200 ++++ screen-4.0.2/fileio.c 2005-04-08 13:37:25.948324113 +0200 +@@ -779,7 +779,7 @@ + #ifdef SIGPIPE + signal(SIGPIPE, SIG_DFL); + #endif +- execl("/bin/sh", "sh", "-c", cmd, 0); ++ execl("/bin/sh", "sh", "-c", cmd, (char*)0); + Panic(errno, "/bin/sh"); + default: + break; +--- screen-4.0.2/utmp.c.orig 2005-10-28 22:01:14.105418912 +0000 ++++ screen-4.0.2/utmp.c 2005-10-28 22:02:30.065801507 +0000 +@@ -604,6 +604,7 @@ struct utmp *u; + char *line, *user; + int pid; + { ++ time_t t; + u->ut_type = USER_PROCESS; + strncpy(u->ut_user, user, sizeof(u->ut_user)); + /* Now the tricky part... guess ut_id */ +@@ -618,7 +619,8 @@ int pid; + #endif /* sgi */ + strncpy(u->ut_line, line, sizeof(u->ut_line)); + u->ut_pid = pid; +- (void)time((time_t *)&u->ut_time); ++ (void)time(&t); ++ u->ut_time = t; + } + + static slot_t +@@ -726,9 +728,11 @@ struct utmp *u; + char *line, *user; + int pid; + { ++ time_t t; + strncpy(u->ut_line, line, sizeof(u->ut_line)); + strncpy(u->ut_name, user, sizeof(u->ut_name)); +- (void)time((time_t *)&u->ut_time); ++ (void)time(&t); ++ u->ut_time = t; + } + + static slot_t diff --git a/src/.gitignore b/src/.gitignore new file mode 100644 index 0000000..529960c --- /dev/null +++ b/src/.gitignore @@ -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 diff --git a/src/.iscreenrc b/src/.iscreenrc new file mode 100644 index 0000000..802afbd --- /dev/null +++ b/src/.iscreenrc @@ -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" don'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 is'nt 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 non'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 + +# Flowcontrol 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 wonderfull tcsh-prompt: +# set prompt="%{^[k^[\\%}%h %c2(%m)%# " +# +# defining a shellaka that contains a pipe-symbol (|) activites 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 recomended to keep sccs and talk happy. +# (thus we have ^A# or. ^Ac for windowcreation 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 amange 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." diff --git a/src/COPYING b/src/COPYING new file mode 100644 index 0000000..94a9ed0 --- /dev/null +++ b/src/COPYING @@ -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>. diff --git a/ChangeLog b/src/ChangeLog index 2256d80..1b29f87 100644 --- a/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,124 @@ +Version 4.1.0 (??/??/20??): + 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. + + 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: + * 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 diff --git a/src/HACKING b/src/HACKING new file mode 100644 index 0000000..b78d40f --- /dev/null +++ b/src/HACKING @@ -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 procesing 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(). @@ -13,6 +13,9 @@ distributions follows, see the GNU standards document on prep.ai.mit.edu:pub/gnu/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. 1.) configure & config.status ----------------------------- @@ -44,7 +47,7 @@ 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@uni-erlangen.de and use the files ending in .dist +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). diff --git a/Makefile.in b/src/Makefile.in index db683ac..d087311 100644 --- a/Makefile.in +++ b/src/Makefile.in @@ -13,6 +13,8 @@ DESTDIR = 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 @@ -20,12 +22,19 @@ bindir = $(exec_prefix)/bin VERSION = @VERSION@ SCREEN = screen-$(VERSION) -ETCSCREENRC = `sed < config.h -n -e '/define ETCSCREENRC/s/^.*"\([^"]*\)"/\1/p'` -SCREENENCODINGS = `sed < config.h -n -e '/define SCREENENCODINGS/s/^.*"\([^"]*\)"/\1/p'` +GIT_REV = "`git describe --always 2>/dev/null`" +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@ +CPPFLAGS = @CPPFLAGS@ -DETCSCREENRC='"$(ETCSCREENRC)"' \ + -DSCREENENCODINGS='"$(SCREENENCODINGS)"' LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ @@ -55,12 +64,14 @@ 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 + 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 \ - sched.o teln.o nethack.o encoding.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 @@ -68,7 +79,8 @@ screen: $(OFILES) $(CC) $(LDFLAGS) -o $@ $(OFILES) $(LIBS) .c.o: - $(CC) -c -I. -I$(srcdir) $(M_CFLAGS) $(DEFS) $(OPTIONS) $(CFLAGS) $< + $(CC) -c -I. -I$(srcdir) $(M_CFLAGS) $(CPPFLAGS) $(DEFS) \ + $(OPTIONS) $(CFLAGS) $< install_bin: .version screen -if [ -f $(DESTDIR)$(bindir)/$(SCREEN) ] && [ ! -f $(DESTDIR)$(bindir)/$(SCREEN).old ]; \ @@ -78,7 +90,7 @@ install_bin: .version 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 -sf $(SCREEN) screen) + (cd $(DESTDIR)$(bindir) && ln -f -s $(SCREEN) screen) cp $(srcdir)/utf8encodings/?? $(DESTDIR)$(SCREENENCODINGS) ############################################################################### @@ -165,7 +177,7 @@ realclean: .version mostlyclean tags TAGS: $(CFILES) -ctags *.sh $(CFILES) *.h - -ctags -e *.sh $(CFILES) *.h + -etags *.sh $(CFILES) *.h dist: .version $(SCREEN).tar.gz @@ -266,66 +278,79 @@ depend.in: $(CFILES) term.h ############################################################################### ### Dependencies: -screen.o: screen.c config.h screen.h os.h osdef.h ansi.h acls.h \ +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: ansi.c config.h screen.h os.h osdef.h ansi.h acls.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: fileio.c config.h screen.h os.h osdef.h ansi.h acls.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: mark.c config.h screen.h os.h osdef.h ansi.h acls.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: misc.c config.h screen.h os.h osdef.h ansi.h acls.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: resize.c config.h screen.h os.h osdef.h ansi.h acls.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: socket.c config.h screen.h os.h osdef.h ansi.h acls.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: search.c config.h screen.h os.h osdef.h ansi.h acls.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: tty.c config.h screen.h os.h osdef.h ansi.h acls.h comm.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: term.c term.h -window.o: window.c config.h screen.h os.h osdef.h ansi.h acls.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: 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: loadav.c config.h screen.h os.h osdef.h ansi.h acls.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 -putenv.o: putenv.c config.h -help.o: help.c config.h screen.h os.h osdef.h ansi.h acls.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 -termcap.o: termcap.c config.h screen.h os.h osdef.h ansi.h acls.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: input.c config.h screen.h os.h osdef.h ansi.h acls.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: attacher.c config.h screen.h os.h osdef.h ansi.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: pty.c config.h screen.h os.h osdef.h ansi.h acls.h comm.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: process.c config.h screen.h os.h osdef.h ansi.h acls.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: display.c config.h screen.h os.h osdef.h ansi.h acls.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 -comm.o: comm.c config.h acls.h comm.h -kmapdef.o: kmapdef.c config.h -acls.o: acls.c config.h screen.h os.h osdef.h ansi.h acls.h comm.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: braille.c config.h screen.h os.h osdef.h ansi.h acls.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: braille_tsi.c config.h screen.h os.h osdef.h ansi.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: logfile.c config.h screen.h os.h osdef.h ansi.h acls.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: layer.c config.h screen.h os.h osdef.h ansi.h acls.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: sched.c config.h screen.h os.h osdef.h ansi.h acls.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: teln.c config.h screen.h os.h osdef.h ansi.h acls.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: nethack.c config.h screen.h os.h osdef.h ansi.h acls.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: encoding.c config.h screen.h os.h osdef.h ansi.h acls.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 +list_display.o: list_generic.h list_display.c layer.h +list_window.o: list_generic.h list_window.c window.h layer.h + @@ -1,4 +1,18 @@ ------------------------------ + 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 ? ------------------------------ @@ -77,7 +77,7 @@ document. * Screen can now be started detached (screen -d -m -S sockname). - This is usefull if you want to start screen in your /etc/rc file + 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). diff --git a/config.h.in b/src/acconfig.h index 4327855..2e46985 100644 --- a/config.h.in +++ b/src/acconfig.h @@ -5,7 +5,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * 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, @@ -14,12 +14,12 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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: config.h.in,v 1.12 1994/05/31 12:31:36 mlschroe Exp $ FAU + * $Id$ GNU */ @@ -35,7 +35,7 @@ * Maximum of simultaneously allowed windows per screen session. */ #ifndef MAXWIN -# define MAXWIN 40 +# define MAXWIN 100 #endif /* @@ -59,15 +59,6 @@ #define SOCKDIR_IS_LOCAL_TO_HOST /* - * Screen sources two startup files. First a global file with a path - * specified here, second your local $HOME/.screenrc - * Don't define this, if you don't want it. - */ -#ifndef ETCSCREENRC -# define ETCSCREENRC "/usr/local/etc/screenrc" -#endif - -/* * 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). @@ -76,14 +67,6 @@ #define ALLOW_SYSSCREENRC 1 /* - * Screen needs encoding files for the translation of utf8 - * into some encodings, e.g. JIS, BIG5. - * Only needed if FONT, ENCODINGS and UTF8 are defined. - */ -#ifndef SCREENENCODINGS -# define SCREENENCODINGS "/usr/local/lib/screen/encodings" -#endif -/* * Define CHECKLOGIN to force Screen users to enter their Unix password * in addition to the screen password. * @@ -425,12 +408,6 @@ #endif /* - * Define HAVE_DIRENT_H if your system has <dirent.h> instead of - * <sys/dir.h> - */ -#undef HAVE_DIRENT_H - -/* * If your system has getutent(), pututline(), etc. to write to the * utmp file, define GETUTENT. */ @@ -458,6 +435,7 @@ * 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 /* @@ -467,6 +445,11 @@ #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. @@ -515,11 +498,6 @@ #undef USEVARARGS /* - * If your system has strerror() define this. - */ -#undef HAVE_STRERROR - -/* * If the select return value doesn't treat a descriptor that is * usable for reading and writing as two hits, define SELECT_BROKEN. */ @@ -548,73 +526,26 @@ #undef USESETENV /* - * 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 - -/* - * If you are on a SYS V machine that restricts filename length to 14 - * characters, you may need to enforce that by setting NAME_MAX to 14 - */ -#undef NAME_MAX /* KEEP_UNDEF_HERE override system value */ -#undef NAME_MAX - -/* - * define HAVE_RENAME if your system has a rename() function + * If setenv() takes 3 arguments define HAVE_SETENV_3 */ -#undef HAVE_RENAME +#undef HAVE_SETENV_3 /* - * define HAVE__EXIT if your system has the _exit() call. + * If setenv() takes 2 arguments define HAVE_SETENV_2 */ -#undef HAVE__EXIT +#undef HAVE_SETENV_2 /* - * define HAVE_LSTAT if your system has symlinks and the lstat() call. - */ -#undef HAVE_LSTAT - -/* - * define HAVE_UTIMES if your system has the utimes() call. - */ -#undef HAVE_UTIMES - -/* - * define HAVE_FCHOWN if your system has the fchown() call. - */ -#undef HAVE_FCHOWN - -/* - * define HAVE_FCHMOD if your system has the fchmod() call. - */ -#undef HAVE_FCHMOD - -/* - * define HAVE_VSNPRINTF if your system has vsnprintf() (GNU lib). - */ -#undef HAVE_VSNPRINTF - -/* - * define HAVE_GETCWD if your system has the getcwd() call. - */ -#undef HAVE_GETCWD - -/* - * define HAVE_SETLOCALE if your system has the setlocale() call. + * If your system does not come with a setenv()/putenv()/getenv() + * functions, you may bring in our own code by defining NEEDPUTENV. */ -#undef HAVE_SETLOCALE +#undef NEEDPUTENV /* - * define HAVE_STRFTIME if your system has the strftime() call. + * If the passwords are stored in a shadow file and you want the + * builtin lock to work properly, define SHADOWPW. */ -#undef HAVE_STRFTIME +#undef SHADOWPW /* * define HAVE_NL_LANGINFO if your system has the nl_langinfo() call @@ -641,16 +572,6 @@ */ #undef HAVE_SVR4_PTYS -/* - * define HAVE_GETPT if you have the getpt() function. - */ -#undef HAVE_GETPT - -/* - * define HAVE_OPENPTY if your system has the openpty() call. - */ -#undef HAVE_OPENPTY - /* * define PTYRANGE0 and or PTYRANGE1 if you want to adapt screen * to unusual environments. E.g. For SunOs the defaults are "qpr" and @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,17 +19,16 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ -#include <sys/types.h> - #include "config.h" +#include <sys/types.h> /* XXX: WHY IS THIS HERE?? :XXX */ @@ -51,7 +55,7 @@ ************************************************************************/ extern struct comm comms[]; -extern struct win *windows, *wtab[]; +extern struct win *windows, **wtab; extern char NullStr[]; extern char SockPath[]; extern struct display *display, *displays; @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,9 +19,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,9 +19,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -73,8 +78,10 @@ struct mchar mchar_null; struct mchar mchar_blank = {' ' /* , 0, 0, ... */}; struct mchar mchar_so = {' ', A_SO /* , 0, 0, ... */}; +int renditions[NUM_RENDS] = {65529 /* =ub */, 65531 /* =b */, 65533 /* =u */ }; + /* keep string_t and string_t_string in sync! */ -static char *string_t_string[] = +static char *string_t_string[] = { "NONE", "DCS", /* Device control string */ @@ -115,8 +122,8 @@ static void DesignateCharset __P((int, int)); static void MapCharset __P((int)); static void MapCharsetR __P((int)); #endif -static void SaveCursor __P((void)); -static void RestoreCursor __P((void)); +static void SaveCursor __P((struct cursor *)); +static void RestoreCursor __P((struct cursor *)); static void BackSpace __P((void)); static void Return __P((void)); static void LineFeed __P((int)); @@ -193,7 +200,7 @@ register struct win *p; p->w_cursorkeys = 0; p->w_top = 0; p->w_bot = p->w_height - 1; - p->w_saved = 0; + p->w_saved.on = 0; p->w_x = p->w_y = 0; p->w_state = LIT; p->w_StringType = NONE; @@ -315,578 +322,581 @@ register int len; curr->w_monitor = MON_FOUND; } - do + if (cols > 0 && rows > 0) { - c = (unsigned char)*buf++; + do + { + c = (unsigned char)*buf++; #ifdef FONT # ifdef DW_CHARS - if (!curr->w_mbcs) + if (!curr->w_mbcs) # endif - curr->w_rend.font = curr->w_FontL; /* Default: GL */ + curr->w_rend.font = curr->w_FontL; /* Default: GL */ #endif - /* The next part is only for speedup */ - if (curr->w_state == LIT && + /* The next part is only for speedup */ + if (curr->w_state == LIT && #ifdef UTF8 - curr->w_encoding != UTF8 && + curr->w_encoding != UTF8 && #endif #ifdef DW_CHARS - !is_dw_font(curr->w_rend.font) && + !is_dw_font(curr->w_rend.font) && # ifdef ENCODINGS - curr->w_rend.font != KANA && !curr->w_mbcs && + curr->w_rend.font != KANA && !curr->w_mbcs && # endif #endif #ifdef FONT - curr->w_rend.font != '<' && + curr->w_rend.font != '<' && #endif - c >= ' ' && c != 0x7f && - ((c & 0x80) == 0 || ((c >= 0xa0 || !curr->w_c1) && !curr->w_gr)) && !curr->w_ss && - !curr->w_insert && curr->w_x < cols - 1) - { - register int currx = curr->w_x; - char *imp = buf - 1; - - while (currx < cols - 1) + c >= ' ' && c != 0x7f && + ((c & 0x80) == 0 || ((c >= 0xa0 || !curr->w_c1) && !curr->w_gr)) && !curr->w_ss && + !curr->w_insert && curr->w_x < cols - 1) { - currx++; - if (--len == 0) - break; - c = (unsigned char)*buf++; - if (c < ' ' || c == 0x7f || ((c & 0x80) && ((c < 0xa0 && curr->w_c1) || curr->w_gr))) + register int currx = curr->w_x; + char *imp = buf - 1; + + while (currx < cols - 1) + { + currx++; + if (--len == 0) + break; + c = (unsigned char)*buf++; + if (c < ' ' || c == 0x7f || ((c & 0x80) && ((c < 0xa0 && curr->w_c1) || curr->w_gr))) + break; + } + currx -= curr->w_x; + if (currx > 0) + { + MPutStr(curr, imp, currx, &curr->w_rend, curr->w_x, curr->w_y); + LPutStr(&curr->w_layer, imp, currx, &curr->w_rend, curr->w_x, curr->w_y); + curr->w_x += currx; + } + if (len == 0) break; } - currx -= curr->w_x; - if (currx > 0) - { - MPutStr(curr, imp, currx, &curr->w_rend, curr->w_x, curr->w_y); - LPutStr(&curr->w_layer, imp, currx, &curr->w_rend, curr->w_x, curr->w_y); - curr->w_x += currx; - } - if (len == 0) - break; - } - /* end of speedup code */ + /* end of speedup code */ #ifdef UTF8 - if (curr->w_encoding == UTF8) - { - c = FromUtf8(c, &curr->w_decodestate); - if (c == -1) - continue; - if (c == -2) + if (curr->w_encoding == UTF8) { - c = UCS_REPL; - /* try char again */ - buf--; - len++; + c = FromUtf8(c, &curr->w_decodestate); + if (c == -1) + continue; + if (c == -2) + { + c = UCS_REPL; + /* try char again */ + buf--; + len++; + } + if (c > 0xff) + debug1("read UNICODE %04x\n", c); } - if (c > 0xff) - debug1("read UNICODE %04x\n", c); - } #endif - tryagain: - switch (curr->w_state) - { - case PRIN: - switch (c) - { - case '\033': - curr->w_state = PRINESC; - break; - default: - PrintChar(c); - } - break; - case PRINESC: - switch (c) - { - case '[': - curr->w_state = PRINCSI; - break; - default: - PrintChar('\033'); - PrintChar(c); - curr->w_state = PRIN; - } - break; - case PRINCSI: - switch (c) - { - case '4': - curr->w_state = PRIN4; - break; - default: - PrintChar('\033'); - PrintChar('['); - PrintChar(c); - curr->w_state = PRIN; - } - break; - case PRIN4: - switch (c) + tryagain: + switch (curr->w_state) { - case 'i': - curr->w_state = LIT; - PrintFlush(); - if (curr->w_pdisplay && curr->w_pdisplay->d_printfd >= 0) + case PRIN: + switch (c) { - close(curr->w_pdisplay->d_printfd); - curr->w_pdisplay->d_printfd = -1; + case '\033': + curr->w_state = PRINESC; + break; + default: + PrintChar(c); } - curr->w_pdisplay = 0; - break; - default: - PrintChar('\033'); - PrintChar('['); - PrintChar('4'); - PrintChar(c); - curr->w_state = PRIN; - } - break; - case ASTR: - if (c == 0) - break; - if (c == '\033') - { - curr->w_state = STRESC; break; - } - /* special xterm hack: accept SetStatus sequence. Yucc! */ - /* allow ^E for title escapes */ - if (!(curr->w_StringType == OSC && c < ' ' && c != '\005')) - if (!curr->w_c1 || c != ('\\' ^ 0xc0)) - { - StringChar(c); - break; - } - c = '\\'; - /* FALLTHROUGH */ - case STRESC: - switch (c) - { - case '\\': - if (StringEnd() == 0 || len <= 1) - break; - /* check if somewhere a status is displayed */ - for (cv = curr->w_layer.l_cvlist; cv; cv = cv->c_lnext) - { - display = cv->c_display; - if (D_status == STATUS_ON_WIN) - break; - } - if (cv) + case PRINESC: + switch (c) { - if (len > IOSIZE + 1) - len = IOSIZE + 1; - curr->w_outlen = len - 1; - bcopy(buf, curr->w_outbuf, len - 1); - return; /* wait till status is gone */ + case '[': + curr->w_state = PRINCSI; + break; + default: + PrintChar('\033'); + PrintChar(c); + curr->w_state = PRIN; } break; - case '\033': - StringChar('\033'); - break; - default: - curr->w_state = ASTR; - StringChar('\033'); - StringChar(c); - break; - } - break; - case ESC: - switch (c) - { - case '[': - curr->w_NumArgs = 0; - curr->w_intermediate = 0; - bzero((char *) curr->w_args, MAXARGS * sizeof(int)); - curr->w_state = CSI; - break; - case ']': - StringStart(OSC); - break; - case '_': - StringStart(APC); - break; - case 'P': - StringStart(DCS); - break; - case '^': - StringStart(PM); - break; - case '!': - StringStart(GM); - break; - case '"': - case 'k': - StringStart(AKA); - break; - default: - if (Special(c)) - { - curr->w_state = LIT; + case PRINCSI: + switch (c) + { + case '4': + curr->w_state = PRIN4; break; + default: + PrintChar('\033'); + PrintChar('['); + PrintChar(c); + curr->w_state = PRIN; } - debug1("not special. c = %x\n", c); - if (c >= ' ' && c <= '/') + break; + case PRIN4: + switch (c) { - if (curr->w_intermediate) + case 'i': + curr->w_state = LIT; + PrintFlush(); + if (curr->w_pdisplay && curr->w_pdisplay->d_printfd >= 0) { -#ifdef DW_CHARS - if (curr->w_intermediate == '$') - c |= '$' << 8; - else -#endif - c = -1; + close(curr->w_pdisplay->d_printfd); + curr->w_pdisplay->d_printfd = -1; } - curr->w_intermediate = c; + curr->w_pdisplay = 0; + break; + default: + PrintChar('\033'); + PrintChar('['); + PrintChar('4'); + PrintChar(c); + curr->w_state = PRIN; } - else if (c >= '0' && c <= '~') + break; + case ASTR: + if (c == 0) + break; + if (c == '\033') { - DoESC(c, curr->w_intermediate); - curr->w_state = LIT; + curr->w_state = STRESC; + break; } - else + /* special xterm hack: accept SetStatus sequence. Yucc! */ + /* allow ^E for title escapes */ + if (!(curr->w_StringType == OSC && c < ' ' && c != '\005')) + if (!curr->w_c1 || c != ('\\' ^ 0xc0)) + { + StringChar(c); + break; + } + c = '\\'; + /* FALLTHROUGH */ + case STRESC: + switch (c) { - curr->w_state = LIT; - goto tryagain; + case '\\': + if (StringEnd() == 0 || len <= 1) + break; + /* check if somewhere a status is displayed */ + for (cv = curr->w_layer.l_cvlist; cv; cv = cv->c_lnext) + { + display = cv->c_display; + if (D_status == STATUS_ON_WIN) + break; + } + if (cv) + { + if (len > IOSIZE + 1) + len = IOSIZE + 1; + curr->w_outlen = len - 1; + bcopy(buf, curr->w_outbuf, len - 1); + return; /* wait till status is gone */ + } + break; + case '\033': + StringChar('\033'); + break; + default: + curr->w_state = ASTR; + StringChar('\033'); + StringChar(c); + break; } - } - break; - case CSI: - switch (c) - { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - if (curr->w_NumArgs < MAXARGS) + break; + case ESC: + switch (c) { - if (curr->w_args[curr->w_NumArgs] < 100000000) - curr->w_args[curr->w_NumArgs] = - 10 * curr->w_args[curr->w_NumArgs] + (c - '0'); + case '[': + curr->w_NumArgs = 0; + curr->w_intermediate = 0; + bzero((char *) curr->w_args, MAXARGS * sizeof(int)); + curr->w_state = CSI; + break; + case ']': + StringStart(OSC); + break; + case '_': + StringStart(APC); + break; + case 'P': + StringStart(DCS); + break; + case '^': + StringStart(PM); + break; + case '!': + StringStart(GM); + break; + case '"': + case 'k': + StringStart(AKA); + break; + default: + if (Special(c)) + { + curr->w_state = LIT; + break; + } + debug1("not special. c = %x\n", c); + if (c >= ' ' && c <= '/') + { + if (curr->w_intermediate) + { +#ifdef DW_CHARS + if (curr->w_intermediate == '$') + c |= '$' << 8; + else +#endif + c = -1; + } + curr->w_intermediate = c; + } + else if (c >= '0' && c <= '~') + { + DoESC(c, curr->w_intermediate); + curr->w_state = LIT; + } + else + { + curr->w_state = LIT; + goto tryagain; + } } break; - case ';': - case ':': - if (curr->w_NumArgs < MAXARGS) - curr->w_NumArgs++; - break; - default: - if (Special(c)) - break; - if (c >= '@' && c <= '~') + case CSI: + switch (c) { + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + if (curr->w_NumArgs < MAXARGS) + { + if (curr->w_args[curr->w_NumArgs] < 100000000) + curr->w_args[curr->w_NumArgs] = + 10 * curr->w_args[curr->w_NumArgs] + (c - '0'); + } + break; + case ';': + case ':': if (curr->w_NumArgs < MAXARGS) curr->w_NumArgs++; - DoCSI(c, curr->w_intermediate); - if (curr->w_state != PRIN) - curr->w_state = LIT; - } - else if ((c >= ' ' && c <= '/') || (c >= '<' && c <= '?')) - curr->w_intermediate = curr->w_intermediate ? -1 : c; - else - { - curr->w_state = LIT; - goto tryagain; + break; + default: + if (Special(c)) + break; + if (c >= '@' && c <= '~') + { + if (curr->w_NumArgs < MAXARGS) + curr->w_NumArgs++; + DoCSI(c, curr->w_intermediate); + if (curr->w_state != PRIN) + curr->w_state = LIT; + } + else if ((c >= ' ' && c <= '/') || (c >= '<' && c <= '?')) + curr->w_intermediate = curr->w_intermediate ? -1 : c; + else + { + curr->w_state = LIT; + goto tryagain; + } } - } - break; - case LIT: - default: + break; + case LIT: + default: #ifdef DW_CHARS - if (curr->w_mbcs) - if (c <= ' ' || c == 0x7f || (c >= 0x80 && c < 0xa0 && curr->w_c1)) - curr->w_mbcs = 0; + if (curr->w_mbcs) + if (c <= ' ' || c == 0x7f || (c >= 0x80 && c < 0xa0 && curr->w_c1)) + curr->w_mbcs = 0; #endif - if (c < ' ') - { - if (c == '\033') + if (c < ' ') { - curr->w_intermediate = 0; - curr->w_state = ESC; - if (curr->w_autoaka < 0) - curr->w_autoaka = 0; + if (c == '\033') + { + curr->w_intermediate = 0; + curr->w_state = ESC; + if (curr->w_autoaka < 0) + curr->w_autoaka = 0; + } + else + Special(c); + break; } - else - Special(c); - break; - } - if (c >= 0x80 && c < 0xa0 && curr->w_c1) + if (c >= 0x80 && c < 0xa0 && curr->w_c1) #ifdef FONT - if ((curr->w_FontR & 0xf0) != 0x20 + if ((curr->w_FontR & 0xf0) != 0x20 # ifdef UTF8 - || curr->w_encoding == UTF8 + || curr->w_encoding == UTF8 # endif - ) + ) #endif - { - switch (c) { - case 0xc0 ^ 'D': - case 0xc0 ^ 'E': - case 0xc0 ^ 'H': - case 0xc0 ^ 'M': - case 0xc0 ^ 'N': /* SS2 */ - case 0xc0 ^ 'O': /* SS3 */ - DoESC(c ^ 0xc0, 0); - break; - case 0xc0 ^ '[': - if (curr->w_autoaka < 0) - curr->w_autoaka = 0; - curr->w_NumArgs = 0; - curr->w_intermediate = 0; - bzero((char *) curr->w_args, MAXARGS * sizeof(int)); - curr->w_state = CSI; - break; - case 0xc0 ^ 'P': - StringStart(DCS); - break; - default: + switch (c) + { + case 0xc0 ^ 'D': + case 0xc0 ^ 'E': + case 0xc0 ^ 'H': + case 0xc0 ^ 'M': + case 0xc0 ^ 'N': /* SS2 */ + case 0xc0 ^ 'O': /* SS3 */ + DoESC(c ^ 0xc0, 0); + break; + case 0xc0 ^ '[': + if (curr->w_autoaka < 0) + curr->w_autoaka = 0; + curr->w_NumArgs = 0; + curr->w_intermediate = 0; + bzero((char *) curr->w_args, MAXARGS * sizeof(int)); + curr->w_state = CSI; + break; + case 0xc0 ^ 'P': + StringStart(DCS); + break; + default: + break; + } break; } - break; - } #ifdef FONT # ifdef DW_CHARS - if (!curr->w_mbcs) - { + if (!curr->w_mbcs) + { # endif - if (c < 0x80 || curr->w_gr == 0) - curr->w_rend.font = curr->w_FontL; + if (c < 0x80 || curr->w_gr == 0) + curr->w_rend.font = curr->w_FontL; # ifdef ENCODINGS - else if (curr->w_gr == 2 && !curr->w_ss) - curr->w_rend.font = curr->w_FontE; + else if (curr->w_gr == 2 && !curr->w_ss) + curr->w_rend.font = curr->w_FontE; # endif - else - curr->w_rend.font = curr->w_FontR; + else + curr->w_rend.font = curr->w_FontR; # ifdef DW_CHARS - } + } # endif # ifdef UTF8 - if (curr->w_encoding == UTF8) - { - if (curr->w_rend.font == '0') + if (curr->w_encoding == UTF8) { - struct mchar mc, *mcp; - - debug1("SPECIAL %x\n", c); - mc.image = c; - mc.mbcs = 0; - mc.font = '0'; - mcp = recode_mchar(&mc, 0, UTF8); - debug2("%02x %02x\n", mcp->image, mcp->font); - c = mcp->image | mcp->font << 8; + if (curr->w_rend.font == '0') + { + struct mchar mc, *mcp; + + debug1("SPECIAL %x\n", c); + mc.image = c; + mc.mbcs = 0; + mc.font = '0'; + mcp = recode_mchar(&mc, 0, UTF8); + debug2("%02x %02x\n", mcp->image, mcp->font); + c = mcp->image | mcp->font << 8; + } + curr->w_rend.font = 0; } - curr->w_rend.font = 0; - } # ifdef DW_CHARS - if (curr->w_encoding == UTF8 && c >= 0x1100 && utf8_isdouble(c)) - curr->w_mbcs = 0xff; + if (curr->w_encoding == UTF8 && utf8_isdouble(c)) + curr->w_mbcs = 0xff; # endif - if (curr->w_encoding == UTF8 && c >= 0x0300 && utf8_iscomb(c)) - { - int ox, oy; - struct mchar omc; - - ox = curr->w_x - 1; - oy = curr->w_y; - if (ox < 0) - { - ox = curr->w_width - 1; - oy--; - } - if (oy < 0) - oy = 0; - copy_mline2mchar(&omc, &curr->w_mlines[oy], ox); - if (omc.image == 0xff && omc.font == 0xff) + if (curr->w_encoding == UTF8 && c >= 0x0300 && utf8_iscomb(c)) { - ox--; + int ox, oy; + struct mchar omc; + + ox = curr->w_x - 1; + oy = curr->w_y; + if (ox < 0) + { + ox = curr->w_width - 1; + oy--; + } + if (oy < 0) + oy = 0; + copy_mline2mchar(&omc, &curr->w_mlines[oy], ox); + if (omc.image == 0xff && omc.font == 0xff) + { + ox--; + if (ox >= 0) + { + copy_mline2mchar(&omc, &curr->w_mlines[oy], ox); + omc.mbcs = 0xff; + } + } if (ox >= 0) { - copy_mline2mchar(&omc, &curr->w_mlines[oy], ox); - omc.mbcs = 0xff; + utf8_handle_comb(c, &omc); + MFixLine(curr, oy, &omc); + copy_mchar2mline(&omc, &curr->w_mlines[oy], ox); + LPutChar(&curr->w_layer, &omc, ox, oy); + LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); } + break; } - if (ox >= 0) - { - utf8_handle_comb(c, &omc); - MFixLine(curr, oy, &omc); - copy_mchar2mline(&omc, &curr->w_mlines[oy], ox); - LPutChar(&curr->w_layer, &omc, ox, oy); - LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); - } - break; - } - font = curr->w_rend.font; + font = curr->w_rend.font; # endif # ifdef DW_CHARS # ifdef ENCODINGS - if (font == KANA && curr->w_encoding == SJIS && curr->w_mbcs == 0) - { - /* Lets see if it is the first byte of a kanji */ - debug1("%x may be first of SJIS\n", c); - if ((0x81 <= c && c <= 0x9f) || (0xe0 <= c && c <= 0xef)) + if (font == KANA && curr->w_encoding == SJIS && curr->w_mbcs == 0) { - debug("YES!\n"); - curr->w_mbcs = c; - break; + /* Lets see if it is the first byte of a kanji */ + debug1("%x may be first of SJIS\n", c); + if ((0x81 <= c && c <= 0x9f) || (0xe0 <= c && c <= 0xef)) + { + debug("YES!\n"); + curr->w_mbcs = c; + break; + } } - } # endif - if (font == 031 && c == 0x80 && !curr->w_mbcs) - font = curr->w_rend.font = 0; - if (is_dw_font(font) && c == ' ') - font = curr->w_rend.font = 0; - if (is_dw_font(font) || curr->w_mbcs) - { - int t = c; - if (curr->w_mbcs == 0) + if (font == 031 && c == 0x80 && !curr->w_mbcs) + font = curr->w_rend.font = 0; + if (is_dw_font(font) && c == ' ') + font = curr->w_rend.font = 0; + if (is_dw_font(font) || curr->w_mbcs) { - curr->w_mbcs = c; - break; - } - if (curr->w_x == cols - 1) - { - curr->w_x += curr->w_wrap ? 1 : -1; - debug1("Patched w_x to %d\n", curr->w_x); - } + int t = c; + if (curr->w_mbcs == 0) + { + curr->w_mbcs = c; + break; + } + if (curr->w_x == cols - 1) + { + curr->w_x += curr->w_wrap ? 1 : -1; + debug1("Patched w_x to %d\n", curr->w_x); + } # ifdef UTF8 - if (curr->w_encoding != UTF8) + if (curr->w_encoding != UTF8) # endif - { - c = curr->w_mbcs; -# ifdef ENCODINGS - if (font == KANA && curr->w_encoding == SJIS) { - debug2("SJIS !! %x %x\n", c, t); - /* - * SJIS -> EUC mapping: - * First byte: - * 81,82...9f -> 21,23...5d - * e0,e1...ef -> 5f,61...7d - * Second byte: - * 40-7e -> 21-5f - * 80-9e -> 60-7e - * 9f-fc -> 21-7e (increment first byte!) - */ - if (0x40 <= t && t <= 0xfc && t != 0x7f) + c = curr->w_mbcs; +# ifdef ENCODINGS + if (font == KANA && curr->w_encoding == SJIS) { - if (c <= 0x9f) c = (c - 0x81) * 2 + 0x21; - else c = (c - 0xc1) * 2 + 0x21; - if (t <= 0x7e) t -= 0x1f; - else if (t <= 0x9e) t -= 0x20; - else t -= 0x7e, c++; - curr->w_rend.font = KANJI; + debug2("SJIS !! %x %x\n", c, t); + /* + * SJIS -> EUC mapping: + * First byte: + * 81,82...9f -> 21,23...5d + * e0,e1...ef -> 5f,61...7d + * Second byte: + * 40-7e -> 21-5f + * 80-9e -> 60-7e + * 9f-fc -> 21-7e (increment first byte!) + */ + if (0x40 <= t && t <= 0xfc && t != 0x7f) + { + if (c <= 0x9f) c = (c - 0x81) * 2 + 0x21; + else c = (c - 0xc1) * 2 + 0x21; + if (t <= 0x7e) t -= 0x1f; + else if (t <= 0x9e) t -= 0x20; + else t -= 0x7e, c++; + curr->w_rend.font = KANJI; + } + else + { + /* Incomplete shift-jis - skip first byte */ + c = t; + t = 0; + } + debug2("SJIS after %x %x\n", c, t); } - else +# endif + if (t && curr->w_gr && font != 030 && font != 031) { - /* Incomplete shift-jis - skip first byte */ - c = t; - t = 0; + t &= 0x7f; + if (t < ' ') + goto tryagain; } - debug2("SJIS after %x %x\n", c, t); - } -# endif - if (t && curr->w_gr && font != 030 && font != 031) - { - t &= 0x7f; - if (t < ' ') - goto tryagain; + if (t == '\177') + break; + curr->w_mbcs = t; } - if (t == '\177') - break; - curr->w_mbcs = t; } - } # endif /* DW_CHARS */ - if (font == '<' && c >= ' ') - { - font = curr->w_rend.font = 0; - c |= 0x80; - } + if (font == '<' && c >= ' ') + { + font = curr->w_rend.font = 0; + c |= 0x80; + } # ifdef UTF8 - else if (curr->w_gr && curr->w_encoding != UTF8) + else if (curr->w_gr && curr->w_encoding != UTF8) # else - else if (curr->w_gr) + else if (curr->w_gr) # endif - { + { #ifdef ENCODINGS - if (c == 0x80 && font == 0 && curr->w_encoding == GBK) - c = 0xa4; - else - c &= 0x7f; - if (c < ' ' && font != 031) - goto tryagain; + if (c == 0x80 && font == 0 && curr->w_encoding == GBK) + c = 0xa4; + else + c &= 0x7f; + if (c < ' ' && font != 031) + goto tryagain; #else - c &= 0x7f; - if (c < ' ') /* this is ugly but kanji support */ - goto tryagain; /* prevents nicer programming */ + c &= 0x7f; + if (c < ' ') /* this is ugly but kanji support */ + goto tryagain; /* prevents nicer programming */ #endif - } + } #endif /* FONT */ - if (c == '\177') - break; - curr->w_rend.image = c; + if (c == '\177') + break; + curr->w_rend.image = c; #ifdef UTF8 - if (curr->w_encoding == UTF8) - curr->w_rend.font = c >> 8; + if (curr->w_encoding == UTF8) + curr->w_rend.font = c >> 8; #endif #ifdef DW_CHARS - curr->w_rend.mbcs = curr->w_mbcs; + curr->w_rend.mbcs = curr->w_mbcs; #endif - if (curr->w_x < cols - 1) - { - if (curr->w_insert) + if (curr->w_x < cols - 1) { - save_mline(&curr->w_mlines[curr->w_y], cols); - MInsChar(curr, &curr->w_rend, curr->w_x, curr->w_y); - LInsChar(&curr->w_layer, &curr->w_rend, curr->w_x, curr->w_y, &mline_old); - curr->w_x++; + if (curr->w_insert) + { + save_mline(&curr->w_mlines[curr->w_y], cols); + MInsChar(curr, &curr->w_rend, curr->w_x, curr->w_y); + LInsChar(&curr->w_layer, &curr->w_rend, curr->w_x, curr->w_y, &mline_old); + curr->w_x++; + } + else + { + MPutChar(curr, &curr->w_rend, curr->w_x, curr->w_y); + LPutChar(&curr->w_layer, &curr->w_rend, curr->w_x, curr->w_y); + curr->w_x++; + } } - else + else if (curr->w_x == cols - 1) { MPutChar(curr, &curr->w_rend, curr->w_x, curr->w_y); LPutChar(&curr->w_layer, &curr->w_rend, curr->w_x, curr->w_y); - curr->w_x++; + if (curr->w_wrap) + curr->w_x++; + } + else + { + MWrapChar(curr, &curr->w_rend, curr->w_y, curr->w_top, curr->w_bot, curr->w_insert); + LWrapChar(&curr->w_layer, &curr->w_rend, curr->w_y, curr->w_top, curr->w_bot, curr->w_insert); + if (curr->w_y != curr->w_bot && curr->w_y != curr->w_height - 1) + curr->w_y++; + curr->w_x = 1; } - } - else if (curr->w_x == cols - 1) - { - MPutChar(curr, &curr->w_rend, curr->w_x, curr->w_y); - LPutChar(&curr->w_layer, &curr->w_rend, curr->w_x, curr->w_y); - if (curr->w_wrap) - curr->w_x++; - } - else - { - MWrapChar(curr, &curr->w_rend, curr->w_y, curr->w_top, curr->w_bot, curr->w_insert); - LWrapChar(&curr->w_layer, &curr->w_rend, curr->w_y, curr->w_top, curr->w_bot, curr->w_insert); - if (curr->w_y != curr->w_bot && curr->w_y != curr->w_height - 1) - curr->w_y++; - curr->w_x = 1; - } #ifdef FONT # ifdef DW_CHARS - if (curr->w_mbcs) - { - curr->w_rend.mbcs = curr->w_mbcs = 0; - curr->w_x++; - } + if (curr->w_mbcs) + { + curr->w_rend.mbcs = curr->w_mbcs = 0; + curr->w_x++; + } # endif - if (curr->w_ss) - { - curr->w_FontL = curr->w_charsets[curr->w_Charset]; - curr->w_FontR = curr->w_charsets[curr->w_CharsetR]; - curr->w_rend.font = curr->w_FontL; - LSetRendition(&curr->w_layer, &curr->w_rend); - curr->w_ss = 0; - } + if (curr->w_ss) + { + curr->w_FontL = curr->w_charsets[curr->w_Charset]; + curr->w_FontR = curr->w_charsets[curr->w_CharsetR]; + curr->w_rend.font = curr->w_FontL; + LSetRendition(&curr->w_layer, &curr->w_rend); + curr->w_ss = 0; + } #endif /* FONT */ - break; + break; + } } + while (--len); } - while (--len); if (!printcmd && curr->w_state == PRIN) PrintFlush(); } @@ -930,6 +940,7 @@ register int c; case '\n': if (curr->w_autoaka) FindAKA(); + case '\013': /* Vertical tab is the same as Line Feed */ LineFeed(0); return 1; case '\007': @@ -976,10 +987,10 @@ int c, intermediate; Report("\033[?%d;%dc", 1, 2); break; case '7': - SaveCursor(); + SaveCursor(&curr->w_saved); break; case '8': - RestoreCursor(); + RestoreCursor(&curr->w_saved); break; case 'c': ClearScreen(); @@ -1222,24 +1233,48 @@ int c, intermediate; LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); break; case 's': - SaveCursor(); + SaveCursor(&curr->w_saved); break; case 't': - if (a1 != 8) - break; - a1 = curr->w_args[2]; - if (a1 < 1) - a1 = curr->w_width; - if (a2 < 1) - a2 = curr->w_height; - if (a1 > 10000 || a2 > 10000) - break; - WChangeSize(curr, a1, a2); - cols = curr->w_width; - rows = curr->w_height; + switch(a1) + { + case 11: + if (curr->w_layer.l_cvlist) + Report("\033[1t", 0, 0); + else + Report("\033[2t", 0, 0); + break; + case 7: + LRefreshAll(&curr->w_layer, 0); + break; + case 21: + a1 = strlen(curr->w_title); + if ((unsigned)(curr->w_inlen + 5 + a1) <= sizeof(curr->w_inbuf)) + { + bcopy("\033]l", curr->w_inbuf + curr->w_inlen, 3); + bcopy(curr->w_title, curr->w_inbuf + curr->w_inlen + 3, a1); + bcopy("\033\\", curr->w_inbuf + curr->w_inlen + 3 + a1, 2); + curr->w_inlen += 5 + a1; + } + break; + case 8: + a1 = curr->w_args[2]; + if (a1 < 1) + a1 = curr->w_width; + if (a2 < 1) + a2 = curr->w_height; + if (a1 > 10000 || a2 > 10000) + break; + WChangeSize(curr, a1, a2); + cols = curr->w_width; + rows = curr->w_height; + break; + default: + break; + } break; case 'u': - RestoreCursor(); + RestoreCursor(&curr->w_saved); break; case 'I': if (!a1) @@ -1340,6 +1375,9 @@ int c, intermediate; break; case 3: /* COLM: column mode */ i = (i ? Z0width : Z1width); + ClearScreen(); + curr->w_x = 0; + curr->w_y = 0; WChangeSize(curr, i, curr->w_height); cols = curr->w_width; rows = curr->w_height; @@ -1393,15 +1431,28 @@ int c, intermediate; if (use_altscreen) { if (i) - EnterAltScreen(curr); + { + if (!curr->w_alt.on) + SaveCursor(&curr->w_alt.cursor); + EnterAltScreen(curr); + } else - LeaveAltScreen(curr); + { + LeaveAltScreen(curr); + RestoreCursor(&curr->w_alt.cursor); + } if (a1 == 47 && !i) - curr->w_saved = 0; + curr->w_saved.on = 0; LRefreshAll(&curr->w_layer, 0); LGotoPos(&curr->w_layer, curr->w_x, curr->w_y); } break; + case 1048: + if (i) + SaveCursor(&curr->w_saved); + else + RestoreCursor(&curr->w_saved); + break; /* case 66: NKM: Numeric keypad appl mode */ /* case 68: KBUM: Keyboard usage mode (data process) */ case 1000: /* VT200 mouse tracking */ @@ -1496,7 +1547,7 @@ StringEnd() } #endif #ifdef RXVT_OSC - if (typ == 0 || typ == 1 || typ == 20 || typ == 39 || typ == 49) + if (typ == 0 || typ == 1 || typ == 2 || typ == 20 || typ == 39 || typ == 49) { int typ2; typ2 = typ / 10; @@ -1506,7 +1557,7 @@ StringEnd() { strncpy(curr->w_xtermosc[typ2], p, sizeof(curr->w_xtermosc[typ2]) - 1); curr->w_xtermosc[typ2][sizeof(curr->w_xtermosc[typ2]) - 1] = 0; - + for (display = displays; display; display = display->d_next) { if (!D_CXT) @@ -1640,7 +1691,7 @@ PrintFlush() AddCStr(D_PO); AddStrn(curr->w_string, curr->w_stringp - curr->w_string); AddCStr(D_PF); - Flush(); + Flush(3); } curr->w_stringp = curr->w_string; } @@ -1717,34 +1768,36 @@ int n; #endif /* FONT */ static void -SaveCursor() +SaveCursor(cursor) +struct cursor *cursor; { - curr->w_saved = 1; - curr->w_Saved_x = curr->w_x; - curr->w_Saved_y = curr->w_y; - curr->w_SavedRend = curr->w_rend; + cursor->on = 1; + cursor->x = curr->w_x; + cursor->y = curr->w_y; + cursor->Rend = curr->w_rend; #ifdef FONT - curr->w_SavedCharset = curr->w_Charset; - curr->w_SavedCharsetR = curr->w_CharsetR; - bcopy((char *) curr->w_charsets, (char *) curr->w_SavedCharsets, + cursor->Charset = curr->w_Charset; + cursor->CharsetR = curr->w_CharsetR; + bcopy((char *) curr->w_charsets, (char *) cursor->Charsets, 4 * sizeof(int)); #endif } static void -RestoreCursor() +RestoreCursor(cursor) +struct cursor *cursor; { - if (!curr->w_saved) + if (!cursor->on) return; - LGotoPos(&curr->w_layer, curr->w_Saved_x, curr->w_Saved_y); - curr->w_x = curr->w_Saved_x; - curr->w_y = curr->w_Saved_y; - curr->w_rend = curr->w_SavedRend; + LGotoPos(&curr->w_layer, cursor->x, cursor->y); + curr->w_x = cursor->x; + curr->w_y = cursor->y; + curr->w_rend = cursor->Rend; #ifdef FONT - bcopy((char *) curr->w_SavedCharsets, (char *) curr->w_charsets, + bcopy((char *) cursor->Charsets, (char *) curr->w_charsets, 4 * sizeof(int)); - curr->w_Charset = curr->w_SavedCharset; - curr->w_CharsetR = curr->w_SavedCharsetR; + curr->w_Charset = cursor->Charset; + curr->w_CharsetR = cursor->CharsetR; curr->w_ss = 0; curr->w_FontL = curr->w_charsets[curr->w_Charset]; curr->w_FontR = curr->w_charsets[curr->w_CharsetR]; @@ -2268,10 +2321,23 @@ int n1, n2; sprintf(rbuf, fmt, n1, n2); len = strlen(rbuf); - if ((unsigned)(curr->w_inlen + len) <= sizeof(curr->w_inbuf)) +#ifdef PSEUDOS + if (W_UWP(curr)) { - bcopy(rbuf, curr->w_inbuf + curr->w_inlen, len); - curr->w_inlen += len; + if ((unsigned)(curr->w_pwin->p_inlen + len) <= sizeof(curr->w_pwin->p_inbuf)) + { + bcopy(rbuf, curr->w_pwin->p_inbuf + curr->w_pwin->p_inlen, len); + curr->w_pwin->p_inlen += len; + } + } + else +#endif + { + if ((unsigned)(curr->w_inlen + len) <= sizeof(curr->w_inbuf)) + { + bcopy(rbuf, curr->w_inbuf + curr->w_inlen, len); + curr->w_inlen += len; + } } } @@ -2297,18 +2363,17 @@ struct mchar *mc; struct mline *ml = &p->w_mlines[y]; if (mc->attr && ml->attr == null) { - if ((ml->attr = (unsigned char *)malloc(p->w_width + 1)) == 0) + if ((ml->attr = (unsigned char *)calloc(p->w_width + 1, 1)) == 0) { ml->attr = null; mc->attr = p->w_rend.attr = 0; WMsg(p, 0, "Warning: no space for attr - turned off"); } - bzero((char *)ml->attr, p->w_width + 1); } #ifdef FONT if (mc->font && ml->font == null) { - if ((ml->font = (unsigned char *)malloc(p->w_width + 1)) == 0) + if ((ml->font = (unsigned char *)calloc(p->w_width + 1, 1)) == 0) { ml->font = null; p->w_FontL = p->w_charsets[p->w_ss ? p->w_ss : p->w_Charset] = 0; @@ -2316,30 +2381,27 @@ struct mchar *mc; mc->font = p->w_rend.font = 0; WMsg(p, 0, "Warning: no space for font - turned off"); } - bzero((char *)ml->font, p->w_width + 1); } #endif #ifdef COLOR if (mc->color && ml->color == null) { - if ((ml->color = (unsigned char *)malloc(p->w_width + 1)) == 0) + if ((ml->color = (unsigned char *)calloc(p->w_width + 1, 1)) == 0) { ml->color = null; mc->color = p->w_rend.color = 0; WMsg(p, 0, "Warning: no space for color - turned off"); } - bzero((char *)ml->color, p->w_width + 1); } # ifdef COLORS256 if (mc->colorx && ml->colorx == null) { - if ((ml->colorx = (unsigned char *)malloc(p->w_width + 1)) == 0) + if ((ml->colorx = (unsigned char *)calloc(p->w_width + 1, 1)) == 0) { ml->colorx = null; mc->colorx = p->w_rend.colorx = 0; WMsg(p, 0, "Warning: no space for extended colors - turned off"); } - bzero((char *)ml->colorx, p->w_width + 1); } # endif #endif @@ -2556,6 +2618,10 @@ int xs, ys, xe, ye, bce; int xxe; struct mline *ml; + /* Check for zero-height window */ + if (ys < 0 || ye < ys) + return; + /* check for magic margin condition */ if (xs >= p->w_width) xs = p->w_width - 1; @@ -2836,6 +2902,8 @@ struct win *p; int visual; { struct canvas *cv; + if (displays == NULL) + p->w_bell = BELL_DONE; for (display = displays; display; display = display->d_next) { for (cv = D_cvlist; cv; cv = cv->c_next) @@ -2888,7 +2956,7 @@ char *str; extern struct layer *flayer; struct layer *oldflayer = flayer; flayer = &p->w_layer; - LMsg(err, str); + LMsg(err, "%s", str); flayer = oldflayer; } @@ -2953,6 +3021,8 @@ int *hp; if (*s++ != (hp ? '%' : '\005')) continue; l = 0; + s += (*s == '+'); + s += (*s == '-'); while (*s >= '0' && *s <= '9') s++; if (*s == 'L') @@ -3021,7 +3091,7 @@ int what; p = D_fore; if (inhstr || (inhstrh && p && p->w_hstatus && *p->w_hstatus && WindowChangedCheck(p->w_hstatus, what, (int *)0))) RefreshHStatus(); - if (ox != -1 && ox != -1) + if (ox != -1 && oy != -1) GotoPos(ox, oy); } display = olddisplay; @@ -3053,7 +3123,7 @@ int what; } if (got && inhstr && p == D_fore) RefreshHStatus(); - if (ox != -1 && ox != -1) + if (ox != -1 && oy != -1) GotoPos(ox, oy); } display = olddisplay; @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,12 +19,12 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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: ansi.h,v 1.6 1994/05/31 12:31:28 mlschroe Exp $ FAU + * $Id$ GNU */ #define NATTR 6 diff --git a/attacher.c b/src/attacher.c index 792ff97..370d594 100644 --- a/attacher.c +++ b/src/attacher.c @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,19 +19,19 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ +#include "config.h" #include <sys/types.h> #include <sys/stat.h> #include <sys/ioctl.h> #include <fcntl.h> #include <signal.h> -#include "config.h" #include "screen.h" #include "extern.h" @@ -46,18 +51,17 @@ static void screen_builtin_lck __P((void)); #ifdef DEBUG static sigret_t AttacherChld __P(SIGPROTOARG); #endif -#ifdef MULTIUSER static sigret_t AttachSigCont __P(SIGPROTOARG); -#endif extern int real_uid, real_gid, eff_uid, eff_gid; extern char *SockName, *SockMatch, SockPath[]; +extern char HostName[]; extern struct passwd *ppp; extern char *attach_tty, *attach_term, *LoginName, *preselect; extern int xflag, dflag, rflag, quietflag, adaptflag; extern struct mode attach_Mode; extern struct NewWindow nwin_options; -extern int MasterPid; +extern int MasterPid, attach_fd; #ifdef MULTIUSER extern char *multi; @@ -69,7 +73,6 @@ static int multipipe[2]; #endif -#ifdef MULTIUSER static int ContinuePlease; static sigret_t @@ -79,14 +82,31 @@ AttachSigCont SIGDEFARG ContinuePlease = 1; SIGRETURN; } -#endif +static int QueryResult; + +static sigret_t +QueryResultSuccess SIGDEFARG +{ + QueryResult = 1; + SIGRETURN; +} + +static sigret_t +QueryResultFail SIGDEFARG +{ + QueryResult = 2; + SIGRETURN; +} /* * Send message to a screen backend. * returns 1 if we could attach one, or 0 if none. * Understands MSG_ATTACH, MSG_DETACH, MSG_POW_DETACH * MSG_CONT, MSG_WINCH and nothing else! + * + * if type == MSG_ATTACH and sockets are used, attaches + * tty filedescriptor. */ static int @@ -96,6 +116,11 @@ struct msg *m; { int r, l = sizeof(*m); +#ifndef NAMEDPIPE + if (m->type == MSG_ATTACH) + return SendAttachMsg(s, m, attach_fd); +#endif + while(l > 0) { r = write(s, (char *)m + (sizeof(*m) - l), l); @@ -184,8 +209,13 @@ int how; { real_uid = multi_uid; eff_uid = own_uid; +#ifdef HAVE_SETRESUID + if (setresuid(multi_uid, own_uid, multi_uid)) + Panic(errno, "setresuid"); +#else xseteuid(multi_uid); xseteuid(own_uid); +#endif if (chmod(attach_tty, 0666)) Panic(errno, "chmod %s", attach_tty); tty_oldmode = tty_mode; @@ -293,7 +323,7 @@ int how; Panic(0, "That screen is %sdetached.", dflag ? "already " : "not "); #ifdef REMOTE_DETACH if (dflag && - (how == MSG_ATTACH || how == MSG_DETACH || how == MSG_POW_DETACH)) + (how == MSG_DETACH || how == MSG_POW_DETACH)) { m.m.detach.dpid = getpid(); strncpy(m.m.detach.duser, LoginName, sizeof(m.m.detach.duser) - 1); @@ -304,9 +334,16 @@ int how; else # endif m.type = MSG_DETACH; + /* If there is no password for the session, or the user enters the correct + * password, then we get a SIGCONT. Otherwise we get a SIG_BYE */ + signal(SIGCONT, AttachSigCont); if (WriteMessage(lasts, &m)) Panic(errno, "WriteMessage"); close(lasts); + while (!ContinuePlease) + pause(); /* wait for SIGCONT */ + signal(SIGCONT, SIG_DFL); + ContinuePlease = 0; if (how != MSG_ATTACH) return 0; /* we detached it. jw. */ sleep(1); /* we dont want to overrun our poor backend. jw. */ @@ -335,6 +372,18 @@ int how; m.m.attach.columns = atoi(s); m.m.attach.encoding = nwin_options.encoding > 0 ? nwin_options.encoding + 1 : 0; +#ifdef REMOTE_DETACH +#ifdef POW_DETACH + if (dflag == 2) + m.m.attach.detachfirst = MSG_POW_DETACH; + else +#endif + if (dflag) + m.m.attach.detachfirst = MSG_DETACH; + else +#endif + m.m.attach.detachfirst = MSG_ATTACH; + #ifdef MULTIUSER /* setup CONT signal handler to repair the terminal mode */ if (multi && (how == MSG_ATTACH || how == MSG_CONT)) @@ -369,9 +418,7 @@ int how; } -#if defined(DEBUG) || !defined(DO_NOT_POLL_MASTER) static int AttacherPanic = 0; -#endif #ifdef DEBUG static sigret_t @@ -406,7 +453,7 @@ AttacherSigInt SIGDEFARG } /* - * Unfortunatelly this is also the SIGHUP handler, so we have to + * Unfortunately this is also the SIGHUP handler, so we have to * check if the backend is already detached. */ @@ -561,7 +608,6 @@ Attacher() #endif for (;;) { -#ifndef DO_NOT_POLL_MASTER signal(SIGALRM, AttacherSigAlarm); alarm(15); pause(); @@ -571,10 +617,6 @@ Attacher() debug1("attacher: Panic! MasterPid %d does not exist.\n", MasterPid); AttacherPanic++; } -#else - pause(); -#endif -#if defined(DEBUG) || !defined(DO_NOT_POLL_MASTER) if (AttacherPanic) { fcntl(0, F_SETFL, 0); @@ -582,7 +624,6 @@ Attacher() printf("\nSuddenly the Dungeon collapses!! - You die...\n"); eexit(1); } -#endif #ifdef BSDJOBS if (SuspendPlease) { @@ -715,7 +756,7 @@ LockTerminal() debug2("Lock: %s: return code %d\n", prg, WEXITSTATUS(wstat)); } else - printf(LockEnd); + printf("%s", LockEnd); } } else @@ -859,8 +900,8 @@ screen_builtin_lck() *cp1 -= 'a' - 'A'; } - sprintf(message, "Screen used by %s <%s>.\nPassword:\007", - fullname, ppp->pw_name); + sprintf(message, "Screen used by %s%s<%s> on %s.\nPassword:\007", + fullname, fullname[0] ? " " : "", ppp->pw_name, HostName); /* loop here to wait for correct password */ for (;;) @@ -897,10 +938,11 @@ screen_builtin_lck() void -SendCmdMessage(sty, match, av) +SendCmdMessage(sty, match, av, query) char *sty; char *match; char **av; +int query; { int i, s; struct msg m; @@ -928,7 +970,7 @@ char **av; exit(1); } bzero((char *)&m, sizeof(m)); - m.type = MSG_COMMAND; + m.type = query ? MSG_QUERY : MSG_COMMAND; if (attach_tty) { strncpy(m.m_tty, attach_tty, sizeof(m.m_tty) - 1); @@ -953,7 +995,59 @@ char **av; m.m.command.preselect[sizeof(m.m.command.preselect) - 1] = 0; m.m.command.apid = getpid(); debug1("SendCommandMsg writing '%s'\n", m.m.command.cmd); - if (WriteMessage(s, &m)) - Msg(errno, "write"); - close(s); + if (query) + { + /* Create a server socket so we can get back the result */ + char *sp = SockPath + strlen(SockPath); + char query[] = "-queryX"; + char c; + int r = -1; + for (c = 'A'; c <= 'Z'; c++) + { + query[6] = c; + strcpy(sp, query); /* XXX: strncpy? */ + if ((r = MakeServerSocket()) >= 0) + break; + } + if (r < 0) + { + for (c = '0'; c <= '9'; c++) + { + query[6] = c; + strcpy(sp, query); + if ((r = MakeServerSocket()) >= 0) + break; + } + } + + if (r < 0) + Panic(0, "Could not create a listening socket to read the results."); + + strncpy(m.m.command.writeback, SockPath, sizeof(m.m.command.writeback) - 1); + m.m.command.writeback[sizeof(m.m.command.writeback) - 1] = '\0'; + + /* Send the message, then wait for a response */ + signal(SIGCONT, QueryResultSuccess); + signal(SIG_BYE, QueryResultFail); + if (WriteMessage(s, &m)) + Msg(errno, "write"); + close(s); + while (!QueryResult) + pause(); + signal(SIGCONT, SIG_DFL); + signal(SIG_BYE, SIG_DFL); + + /* Read the result and spit it out to stdout */ + ReceiveRaw(r); + unlink(SockPath); + if (QueryResult == 2) /* An error happened */ + exit(1); + } + else + { + if (WriteMessage(s, &m)) + Msg(errno, "write"); + close(s); + } } + diff --git a/src/autogen.sh b/src/autogen.sh new file mode 100755 index 0000000..520249c --- /dev/null +++ b/src/autogen.sh @@ -0,0 +1,2 @@ +#!/bin/sh +exec autoreconf diff --git a/braille.c b/src/braille.c index 9951087..e12fc8f 100644 --- a/braille.c +++ b/src/braille.c @@ -9,7 +9,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * 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, @@ -18,9 +18,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -388,7 +388,7 @@ bd_signal() else { AddCStr(D_BL); - Flush(); + Flush(0); } } diff --git a/braille.h b/src/braille.h index c0157de..a0cb4e9 100644 --- a/braille.h +++ b/src/braille.h @@ -8,7 +8,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * 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, @@ -17,12 +17,12 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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: braille.h,v 1.1 1995/09/06 15:51:18 jnweiger Exp jnweiger $ FAU + * $Id$ GNU */ #ifdef HAVE_BRAILLE diff --git a/braille_tsi.c b/src/braille_tsi.c index eed260a..6768291 100644 --- a/braille_tsi.c +++ b/src/braille_tsi.c @@ -10,7 +10,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * 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, @@ -19,9 +19,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ diff --git a/src/canvas.c b/src/canvas.c new file mode 100644 index 0000000..0121892 --- /dev/null +++ b/src/canvas.c @@ -0,0 +1,916 @@ +/* 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 + * http://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 = 0; + 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 = need * (hh - m - 1) / got; + 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 xs, xe, ys, ye; + struct canvas *cv; + + debug("RemCanvas\n"); + cv = D_forecv; + 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); + } + xs = cv->c_slback->c_xs; + xe = cv->c_slback->c_xe; + ys = cv->c_slback->c_ys; + ye = cv->c_slback->c_ye; + /* 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); + } +} + diff --git a/src/canvas.h b/src/canvas.h new file mode 100644 index 0000000..6aeb3d8 --- /dev/null +++ b/src/canvas.h @@ -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 + * http://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 */ + @@ -1,4 +1,9 @@ -/* Copyright (c) 1993-2002 +/* 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 @@ -14,7 +19,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * 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, @@ -23,9 +28,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -53,7 +58,7 @@ struct comm comms[RC_LAST + 1] = #endif { "allpartial", NEED_DISPLAY|ARGS_1 }, { "altscreen", ARGS_01 }, - { "at", NEED_DISPLAY|ARGS_2|ARGS_ORMORE }, + { "at", ARGS_2|ARGS_ORMORE }, #ifdef COLOR { "attrcolor", ARGS_12 }, #endif @@ -98,7 +103,7 @@ struct comm comms[RC_LAST + 1] = #endif { "blanker", NEED_DISPLAY|ARGS_0}, #ifdef BLANKER_PRG - { "blankerprg", ARGS_1|ARGS_ORMORE }, + { "blankerprg", ARGS_0|ARGS_ORMORE }, #endif { "break", NEED_FORE|ARGS_01 }, { "breaktype", NEED_FORE|ARGS_01 }, @@ -112,6 +117,9 @@ struct comm comms[RC_LAST + 1] = #endif { "charset", NEED_FORE|ARGS_1 }, { "chdir", ARGS_01 }, +#ifdef DW_CHARS + { "cjkwidth", ARGS_01 }, +#endif { "clear", NEED_FORE|ARGS_0 }, { "colon", NEED_LAYER|ARGS_01 }, { "command", NEED_DISPLAY|ARGS_02 }, @@ -120,7 +128,7 @@ struct comm comms[RC_LAST + 1] = #endif { "console", NEED_FORE|ARGS_01 }, #ifdef COPY_PASTE - { "copy", NEED_FORE|ARGS_0 }, + { "copy", NEED_FORE|NEED_DISPLAY|ARGS_0 }, { "crlf", ARGS_01 }, #endif { "debug", ARGS_01 }, @@ -149,6 +157,7 @@ struct comm comms[RC_LAST + 1] = #endif { "defmode", ARGS_1 }, { "defmonitor", ARGS_1 }, + { "defmousetrack", ARGS_1 }, #ifdef MULTI { "defnonblock", ARGS_1 }, #endif @@ -167,24 +176,26 @@ struct comm comms[RC_LAST + 1] = #ifdef DETACH { "detach", NEED_DISPLAY|ARGS_01 }, #endif - { "digraph", NEED_LAYER|ARGS_01 }, + { "digraph", NEED_LAYER|ARGS_012 }, { "dinfo", NEED_DISPLAY|ARGS_0 }, { "displays", NEED_LAYER|ARGS_0 }, { "dumptermcap", NEED_FORE|ARGS_0 }, - { "echo", ARGS_12 }, + { "echo", CAN_QUERY|ARGS_12 }, #ifdef ENCODINGS { "encoding", ARGS_12 }, #endif { "escape", ARGS_1 }, { "eval", ARGS_1|ARGS_ORMORE }, #ifdef PSEUDOS - { "exec", NEED_FORE|ARGS_0|ARGS_ORMORE }, + { "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 }, - { "hardcopy", ARGS_012 }, + { "group", NEED_FORE|ARGS_01 }, + { "hardcopy", NEED_FORE|ARGS_012 }, { "hardcopy_append", ARGS_1 }, { "hardcopydir", ARGS_01 }, { "hardstatus", ARGS_012 }, @@ -196,12 +207,13 @@ struct comm comms[RC_LAST + 1] = { "hstatus", NEED_FORE|ARGS_1 }, { "idle", ARGS_0|ARGS_ORMORE }, { "ignorecase", ARGS_01 }, - { "info", NEED_LAYER|ARGS_0 }, + { "info", CAN_QUERY|NEED_LAYER|ARGS_0 }, #ifdef ENCODINGS { "kanji", NEED_FORE|ARGS_12 }, #endif { "kill", NEED_FORE|ARGS_0 }, - { "lastmsg", NEED_DISPLAY|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 }, @@ -220,9 +232,10 @@ struct comm comms[RC_LAST + 1] = #ifdef COPY_PASTE { "markkeys", ARGS_1 }, #endif - { "maxwin", ARGS_1 }, + { "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 @@ -235,7 +248,7 @@ struct comm comms[RC_LAST + 1] = #ifdef MULTI { "nonblock", NEED_DISPLAY|ARGS_01 }, #endif - { "number", NEED_FORE|ARGS_01 }, + { "number", CAN_QUERY|NEED_FORE|ARGS_01 }, { "obuflimit", NEED_DISPLAY|ARGS_01 }, { "only", NEED_DISPLAY|ARGS_0 }, { "other", ARGS_0 }, @@ -266,13 +279,14 @@ struct comm comms[RC_LAST + 1] = #ifdef COPY_PASTE { "removebuf", ARGS_0 }, #endif + { "rendition", ARGS_23 }, { "reset", NEED_FORE|ARGS_0 }, - { "resize", NEED_DISPLAY|ARGS_01 }, + { "resize", NEED_DISPLAY|ARGS_0|ARGS_ORMORE }, { "screen", ARGS_0|ARGS_ORMORE }, #ifdef COPY_PASTE { "scrollback", NEED_FORE|ARGS_1 }, #endif - { "select", ARGS_01 }, + { "select", CAN_QUERY|ARGS_01 }, { "sessionname", ARGS_01 }, { "setenv", ARGS_012 }, { "setsid", ARGS_1 }, @@ -284,9 +298,9 @@ struct comm comms[RC_LAST + 1] = { "slowpaste", NEED_FORE|ARGS_01 }, { "sorendition", ARGS_012 }, { "source", ARGS_1 }, - { "split", NEED_DISPLAY|ARGS_0 }, + { "split", NEED_DISPLAY|ARGS_01 }, { "startup_message", ARGS_1 }, - { "stuff", NEED_LAYER|ARGS_12 }, + { "stuff", NEED_LAYER|ARGS_012 }, #ifdef MULTIUSER { "su", NEED_DISPLAY|ARGS_012 }, #endif @@ -297,9 +311,10 @@ struct comm comms[RC_LAST + 1] = { "termcap", ARGS_23 }, { "termcapinfo", ARGS_23 }, { "terminfo", ARGS_23 }, - { "time", ARGS_01 }, - { "title", NEED_FORE|ARGS_01 }, + { "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 }, @@ -311,8 +326,8 @@ struct comm comms[RC_LAST + 1] = { "version", ARGS_0 }, { "wall", NEED_DISPLAY|ARGS_1}, { "width", ARGS_0123 }, - { "windowlist", NEED_DISPLAY|ARGS_012 }, - { "windows", NEED_DISPLAY|ARGS_0 }, + { "windowlist", ARGS_012 }, + { "windows", CAN_QUERY|ARGS_0 }, { "wrap", NEED_FORE|ARGS_01 }, #ifdef COPY_PASTE { "writebuf", ARGS_0123 }, @@ -323,5 +338,5 @@ struct comm comms[RC_LAST + 1] = #ifdef ZMODEM { "zmodem", ARGS_012 }, #endif - { "zombie", ARGS_01 } + { "zombie", ARGS_012 } }; @@ -43,6 +43,8 @@ struct comm #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) @@ -61,6 +63,10 @@ struct action int nr; char **args; int *argl; + int quiet; /* Suppress (currently unused) + 0x01 - Error message + 0x02 - Normal message + */ }; #define RC_ILLEGAL -1 diff --git a/configure.in b/src/configure.in index 34c9372..4184947 100644 --- a/configure.in +++ b/src/configure.in @@ -1,18 +1,18 @@ dnl Process this file with autoconf to produce a configure script. dnl -dnl $Id: configure.in,v 1.18 1994/09/06 16:59:54 mlschroe Exp $ FAU +dnl $Id$ GNU dnl dnl Many thanks to David MacKenzie for writing autoconf and dnl providing a sample configure.in file for screen. dnl -AC_REVISION($Revision: 1.18 $)dnl +AC_REVISION($Revision$)dnl AC_INIT(screen.c) AC_CONFIG_HEADER(config.h) dnl dnl Define some useful macros dnl -AC_DEFUN(AC_PROGRAM_SOURCE, +AC_DEFUN([AC_PROGRAM_SOURCE], [AC_REQUIRE([AC_PROG_CPP])AC_PROVIDE([$0])cat > conftest.c <<EOF #include "confdefs.h" [$1] @@ -45,6 +45,7 @@ AC_PROG_CC AC_PROG_CPP AC_PROG_GCC_TRADITIONAL AC_ISC_POSIX +AC_USE_SYSTEM_EXTENSIONS AC_TRY_RUN(main(){exit(0);},,[ if test $CC != cc ; then @@ -93,7 +94,12 @@ AC_ARG_ENABLE(socket-dir, AC_MSG_RESULT(yes) AC_MSG_CHECKING(for the socket dir) SOCKDIR="(eff_uid ? \"/tmp/uscreens\" : \"/tmp/screens\")" - AC_ARG_WITH(socket-dir, [ --with-socket-dir=path where to put the per-user sockets], [ SOCKDIR="\"${withval}\"" ]) + AC_ARG_WITH(socket-dir, [ --with-socket-dir=path where to put the per-user sockets], [ + case "${withval}" in + *\"*) SOCKDIR="${withval}" ;; + *) SOCKDIR="\"${withval}\"" ;; + esac + ]) AC_MSG_RESULT(${SOCKDIR}) AC_DEFINE_UNQUOTED(SOCKDIR, $SOCKDIR) ] @@ -203,6 +209,7 @@ AC_TRY_LINK([#include <utmpx.h> [AC_CHECK_HEADER(dwarf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN), [AC_CHECK_HEADER(elf.h, AC_DEFINE(SVR4) AC_DEFINE(BUGGYGETLOGIN))])] ,LIBS="$oldlibs") +AC_CHECK_HEADERS([stropts.h string.h strings.h]) AC_CHECKING(for Solaris 2.x) AC_EGREP_CPP(yes, @@ -252,15 +259,15 @@ int y = TIOCNOTTY; ], AC_NOTE(- you have jobcontrol) AC_DEFINE(BSDJOBS), AC_NOTE(- you don't have jobcontrol)) dnl -dnl **** setreuid(), seteuid() **** +dnl **** setresuid(), setreuid(), seteuid() **** dnl -AC_CHECKING(setreuid) +AC_CHECKING(setresuid) AC_TRY_LINK(,[ -#ifdef __hpux setresuid(0, 0, 0); -#else +], AC_DEFINE(HAVE_SETRESUID)) +AC_CHECKING(setreuid) +AC_TRY_LINK(,[ setreuid(0, 0); -#endif ], AC_DEFINE(HAVE_SETREUID)) dnl dnl seteuid() check: @@ -277,6 +284,12 @@ seteuid(0); #endif ], AC_DEFINE(HAVE_SETEUID)) +dnl execvpe +AC_CHECKING(execvpe) +AC_TRY_LINK(,[ + execvpe(0, 0, 0); +], AC_DEFINE(HAVE_EXECVPE)) + dnl dnl **** select() **** dnl @@ -294,7 +307,14 @@ dnl AC_CHECKING(fifos) AC_TRY_RUN([ +/* For select - According to POSIX 1003.1-2001 */ +#include <sys/select.h> + +/* For select - According to earlier standards */ +#include <sys/time.h> #include <sys/types.h> +#include <unistd.h> + #include <sys/stat.h> #include <fcntl.h> @@ -310,13 +330,10 @@ char *fin = "/tmp/conftest$$"; main() { struct stat stb; -#ifdef FD_SET fd_set f; -#else - int f; -#endif (void)alarm(5); + unlink(fin); #ifdef POSIX if (mkfifo(fin, 0777)) #else @@ -348,11 +365,7 @@ main() exit(1); exit(0); } -#ifdef FD_SET FD_SET(0, &f); -#else - f = 1; -#endif if (select(1, &f, 0, 0, 0) == -1) exit(1); exit(0); @@ -364,10 +377,16 @@ rm -f /tmp/conftest* if test -n "$fifo"; then AC_CHECKING(for broken fifo implementation) AC_TRY_RUN([ -#include <sys/types.h> -#include <fcntl.h> +/* For select - According to POSIX 1003.1-2001 */ +#include <sys/select.h> + +/* For select - According to earlier standards */ #include <sys/time.h> +#include <sys/types.h> +#include <unistd.h> + #include <sys/stat.h> +#include <fcntl.h> #ifndef O_NONBLOCK #define O_NONBLOCK O_NDELAY @@ -381,11 +400,7 @@ char *fin = "/tmp/conftest$$"; main() { struct timeval tv; -#ifdef FD_SET fd_set f; -#else - int f; -#endif #ifdef POSIX if (mkfifo(fin, 0600)) @@ -396,11 +411,7 @@ main() close(0); if (open(fin, O_RDONLY|O_NONBLOCK)) exit(1); -#ifdef FD_SET FD_SET(0, &f); -#else - f = 1; -#endif tv.tv_sec = 1; tv.tv_usec = 0; if (select(1, &f, 0, 0, &tv)) @@ -420,10 +431,18 @@ dnl AC_CHECKING(sockets) AC_TRY_RUN([ +/* For select - According to POSIX 1003.1-2001 */ +#include <sys/select.h> + +/* For select - According to earlier standards */ +#include <sys/time.h> #include <sys/types.h> +#include <unistd.h> + +#include <sys/stat.h> +#include <fcntl.h> #include <sys/socket.h> #include <sys/un.h> -#include <fcntl.h> char *son = "/tmp/conftest$$"; @@ -431,11 +450,7 @@ main() { int s1, s2, l; struct sockaddr_un a; -#ifdef FD_SET fd_set f; -#else - int f; -#endif (void)alarm(5); if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) @@ -460,11 +475,7 @@ main() close(0); if (accept(s1, &a, &l)) exit(1); -#ifdef FD_SET FD_SET(0, &f); -#else - f = 1; -#endif if (select(1, &f, 0, 0, 0) == -1) exit(1); exit(0); @@ -476,7 +487,14 @@ rm -f /tmp/conftest* if test -n "$sock"; then AC_CHECKING(socket implementation) AC_TRY_RUN([ +/* For select - According to POSIX 1003.1-2001 */ +#include <sys/select.h> + +/* For select - According to earlier standards */ +#include <sys/time.h> #include <sys/types.h> +#include <unistd.h> + #include <sys/stat.h> #include <sys/socket.h> #include <sys/un.h> @@ -518,8 +536,7 @@ if test -n "$fifo"; then elif test -n "$fifobr"; then AC_NOTE(- as your fifos are broken lets use the sockets.) else - AC_NOTE(- both sockets and fifos usable. let's take fifos.) - AC_DEFINE(NAMEDPIPE) + AC_NOTE(- both sockets and fifos usable. let's take sockets.) fi else AC_NOTE(- using named pipes, of course) @@ -537,7 +554,14 @@ dnl AC_CHECKING(select return value) AC_TRY_RUN([ +/* For select - According to POSIX 1003.1-2001 */ +#include <sys/select.h> + +/* For select - According to earlier standards */ +#include <sys/time.h> #include <sys/types.h> +#include <unistd.h> + #include <sys/stat.h> #include <fcntl.h> @@ -555,11 +579,7 @@ char *nam = "/tmp/conftest$$"; main() { -#ifdef FD_SET fd_set f; -#else - int f; -#endif #ifdef __FreeBSD__ /* From Andrew A. Chernov (ache@astral.msk.su): @@ -591,11 +611,7 @@ main() { int s1, s2, l; struct sockaddr_un a; -#ifdef FD_SET fd_set f; -#else - int f; -#endif (void)alarm(5); if ((s1 = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) @@ -623,11 +639,7 @@ main() #endif -#ifdef FD_SET FD_SET(0, &f); -#else - f = 1; -#endif if (select(1, &f, 0, 0, 0) == -1) exit(1); if (select(1, &f, &f, 0, 0) != 2) @@ -658,10 +670,13 @@ AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, LIBS="-ltermlib $olibs" AC_CHECKING(libtermlib) AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, +LIBS="-lncursesw $olibs" +AC_CHECKING(libncursesw) +AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, LIBS="-lncurses $olibs" AC_CHECKING(libncurses) AC_TRY_LINK(,tgetent((char *)0, (char *)0);,, -AC_MSG_ERROR(!!! no tgetent - no screen)))))) +AC_MSG_ERROR(!!! no tgetent - no screen))))))) AC_TRY_RUN([ main() @@ -1193,17 +1208,7 @@ main() { exit(0); /* libc version works properly. */ }], AC_DEFINE(USEMEMCPY)) -AC_MSG_CHECKING(long file names) -(echo 1 > /tmp/conftest9012345) 2>/dev/null -(echo 2 > /tmp/conftest9012346) 2>/dev/null -val=`cat /tmp/conftest9012345 2>/dev/null` -if test -f /tmp/conftest9012345 && test "$val" = 1; then -AC_MSG_RESULT(yes) -else -AC_MSG_RESULT(no) -AC_DEFINE(NAME_MAX, 14) -fi -rm -f /tmp/conftest* +AC_SYS_LONG_FILE_NAMES AC_MSG_CHECKING(for vsprintf) AC_TRY_LINK(,[vsprintf(0,0,0);], AC_MSG_RESULT(yes);AC_DEFINE(USEVARARGS), AC_MSG_RESULT(no)) @@ -1211,11 +1216,32 @@ AC_TRY_LINK(,[vsprintf(0,0,0);], AC_MSG_RESULT(yes);AC_DEFINE(USEVARARGS), AC_MS AC_HEADER_DIRENT AC_MSG_CHECKING(for setenv) -AC_TRY_LINK(,[setenv((char *)0,(char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes);AC_DEFINE(USESETENV), -AC_MSG_RESULT(no) -AC_MSG_CHECKING(for putenv) -AC_TRY_LINK(,[putenv((char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes) , AC_MSG_RESULT(no);AC_DEFINE(NEEDPUTENV) -)) +if test -z "$ac_setenv_args"; then + AC_TRY_LINK( + [#include <stdlib.h>], + [ + setenv((char *) 0, (char *) 0, 0); + ], ac_setenv_args=3) +fi +if test -z "$ac_setenv_args"; then + AC_TRY_LINK( + [#include <stdlib.h>], + [ + setenv((char *) 0, (char *) 0); + ], ac_setenv_args=2) +fi +if test -n "$ac_setenv_args"; then + AC_DEFINE(USESETENV) + if test "$ac_setenv_args" = 3; then + AC_DEFINE(HAVE_SETENV_3) + elif test "$ac_setenv_args" = 2; then + AC_DEFINE(HAVE_SETENV_2) + fi +else + AC_MSG_RESULT(no) + AC_MSG_CHECKING(for putenv) + AC_TRY_LINK(,[putenv((char *)0);unsetenv((char *)0);], AC_MSG_RESULT(yes) , AC_MSG_RESULT(no);AC_DEFINE(NEEDPUTENV)) +fi AC_MSG_CHECKING([for nl_langinfo(CODESET)]) AC_TRY_LINK([ #include <langinfo.h> @@ -1268,23 +1294,10 @@ test -n "$seqptx" && LIBS="-ltermcap -lc -lsocket -linet -lnsl -lsec -lseq" AC_TRY_RUN(main(){exit(0);},,AC_MSG_ERROR(Can't run the compiler - internal error. Sorry.)) -ETCSCREENRC="\"/usr/local/etc/screenrc\"" -if test -n "$prefix"; then -ETCSCREENRC="\"$prefix/etc/screenrc\"" -fi +ETCSCREENRC= AC_MSG_CHECKING(for the global screenrc file) -AC_ARG_WITH(sys-screenrc, [ --with-sys-screenrc=path where to put the global screenrc file], [ ETCSCREENRC="\"${withval}\"" ]) -AC_DEFINE_UNQUOTED(ETCSCREENRC,$ETCSCREENRC) -AC_MSG_RESULT($ETCSCREENRC) - -SCREENENCODINGS="\"/usr/local/lib/screen/utf8encodings\"" -if test -n "$datadir"; then -eval SCREENENCODINGS="$datadir/screen/utf8encodings" -SCREENENCODINGS="\"$SCREENENCODINGS\"" -fi -AC_MSG_CHECKING(for the utf8-encodings location) -AC_DEFINE_UNQUOTED(SCREENENCODINGS,$SCREENENCODINGS) -AC_MSG_RESULT($SCREENENCODINGS) +AC_ARG_WITH(sys-screenrc, [ --with-sys-screenrc=path to the global screenrc file], [ ETCSCREENRC="${withval}" ]) +AC_SUBST(ETCSCREENRC) AC_OUTPUT(Makefile doc/Makefile, [[ # a hook for preserving undef directive in config.h diff --git a/display.c b/src/display.c index 9e09187..5fa11cb 100644 --- a/display.c +++ b/src/display.c @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,9 +19,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -32,12 +37,12 @@ #include "screen.h" #include "extern.h" #include "braille.h" +#include "canvas.h" static int CountChars __P((int)); static int DoAddChar __P((int)); static int BlankResize __P((int, int)); static int CallRewrite __P((int, int, int, int)); -static void FreeCanvas __P((struct canvas *)); static void disp_readev_fn __P((struct event *, char *)); static void disp_writeev_fn __P((struct event *, char *)); #ifdef linux @@ -60,6 +65,7 @@ static void RAW_PUTCHAR __P((int)); #ifdef COLOR static void SetBackColor __P((int)); #endif +static void RemoveStatusMinWait __P((void)); extern struct layer *flayer; @@ -115,12 +121,15 @@ struct display TheDisplay; */ int defobuflimit = OBUF_MAX; int defnonblock = -1; +int defmousetrack = 0; #ifdef AUTO_NUKE int defautonuke = 0; #endif int captionalways; int hardstatusemu = HSTATUS_IGNORE; +int focusminwidth, focusminheight; + /* * Default layer management */ @@ -191,7 +200,8 @@ struct LayFuncs BlankLf = DefClearLine, DefRewrite, BlankResize, - DefRestore + DefRestore, + 0 }; /*ARGSUSED*/ @@ -304,6 +314,7 @@ struct mode *Mode; D_termname[sizeof(D_termname) - 1] = 0; D_user = *u; D_processinput = ProcessInput; + D_mousetrack = defmousetrack; return display; } @@ -312,7 +323,6 @@ void FreeDisplay() { struct win *p; - struct canvas *cv, *cvp; #ifdef MULTI struct display *d, **dp; #endif @@ -325,7 +335,7 @@ FreeDisplay() #endif if (D_userfd >= 0) { - Flush(); + Flush(3); if (!display) return; SetTTY(D_userfd, &D_OldMode); @@ -379,15 +389,16 @@ FreeDisplay() if (D_obuf) free(D_obuf); *dp = display->d_next; - cv = display->d_cvlist; #else /* MULTI */ ASSERT(display == displays); ASSERT(display == &TheDisplay); - cv = display->d_cvlist; - display->d_cvlist = 0; displays = 0; #endif /* MULTI */ + while (D_canvas.c_slperp) + FreeCanvas(D_canvas.c_slperp); + D_cvlist = 0; + for (p = windows; p; p = p->w_next) { if (p->w_pdisplay == display) @@ -397,320 +408,22 @@ FreeDisplay() if (p->w_readev.condneg == &D_status || p->w_readev.condneg == &D_obuflenmax) p->w_readev.condpos = p->w_readev.condneg = 0; } - for (; cv; cv = cvp) - { - cvp = cv->c_next; - FreeCanvas(cv); - } #ifdef ZMODEM for (p = windows; p; p = p->w_next) if (p->w_zdisplay == display) zmodem_abort(p, 0); #endif + if (D_mousetrack) + { + D_mousetrack = 0; + MouseMode(0); + } #ifdef MULTI free((char *)display); #endif display = 0; } -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 = 0; - cv->c_ye = D_height - 1 - (D_has_hstatus == HSTATUS_LASTLINE) - captionalways; - cv->c_xoff = 0; - cv->c_yoff = 0; - cv->c_next = 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; - - 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; - cv->c_lnext = 0; - - D_cvlist = cv; - RethinkDisplayViewports(); - D_forecv = cv; /* default input focus */ - return 0; -} - -static void -FreeCanvas(cv) -struct canvas *cv; -{ - struct viewport *vp, *nvp; - struct win *p; - - p = Layer2Window(cv->c_layer); - 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); - free(cv); -} - -int -AddCanvas() -{ - int hh, h, i, j; - struct canvas *cv, **cvpp; - - for (cv = D_cvlist, j = 0; cv; cv = cv->c_next) - j++; - j++; /* new canvas */ - h = D_height - (D_has_hstatus == HSTATUS_LASTLINE); - if (h / j <= 1) - return -1; - - for (cv = D_cvlist; cv; cv = cv->c_next) - if (cv == D_forecv) - break; - ASSERT(cv); - cvpp = &cv->c_next; - - if ((cv = (struct canvas *)calloc(1, sizeof *cv)) == 0) - return -1; - - cv->c_xs = 0; - cv->c_xe = D_width - 1; - cv->c_ys = 0; - cv->c_ye = D_height - 1; - 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; - - 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; - cv->c_lnext = 0; - - cv->c_next = *cvpp; - *cvpp = cv; - - i = 0; - for (cv = D_cvlist; cv; cv = cv->c_next) - { - hh = h / j-- - 1; - cv->c_ys = i; - cv->c_ye = i + hh - 1; - cv->c_yoff = i; - i += hh + 1; - h -= hh + 1; - } - - RethinkDisplayViewports(); - ResizeLayersToCanvases(); - return 0; -} - -void -RemCanvas() -{ - int hh, h, i, j; - struct canvas *cv, **cvpp; - int did = 0; - - h = D_height - (D_has_hstatus == HSTATUS_LASTLINE); - for (cv = D_cvlist, j = 0; cv; cv = cv->c_next) - j++; - if (j == 1) - return; - i = 0; - j--; - for (cvpp = &D_cvlist; (cv = *cvpp); cvpp = &cv->c_next) - { - if (cv == D_forecv && !did) - { - *cvpp = cv->c_next; - FreeCanvas(cv); - cv = *cvpp; - D_forecv = cv ? cv : D_cvlist; - D_fore = Layer2Window(D_forecv->c_layer); - flayer = D_forecv->c_layer; - if (cv == 0) - break; - did = 1; - } - hh = h / j-- - 1; - if (!captionalways && i == 0 && j == 0) - hh++; - cv->c_ys = i; - cv->c_ye = i + hh - 1; - cv->c_yoff = i; - i += hh + 1; - h -= hh + 1; - } - RethinkDisplayViewports(); - ResizeLayersToCanvases(); -} - -void -OneCanvas() -{ - struct canvas *mycv = D_forecv; - struct canvas *cv, **cvpp; - - for (cvpp = &D_cvlist; (cv = *cvpp);) - { - if (cv == mycv) - { - cv->c_ys = 0; - cv->c_ye = D_height - 1 - (D_has_hstatus == HSTATUS_LASTLINE) - captionalways; - cv->c_yoff = 0; - cvpp = &cv->c_next; - } - else - { - *cvpp = cv->c_next; - FreeCanvas(cv); - } - } - RethinkDisplayViewports(); - ResizeLayersToCanvases(); -} - -int -RethinkDisplayViewports() -{ - struct canvas *cv; - struct viewport *vp, *vpn; - - /* free old viewports */ - for (cv = display->d_cvlist; cv; cv = cv->c_next) - { - for (vp = cv->c_vplist; vp; vp = vpn) - { - vp->v_canvas = 0; - vpn = vp->v_next; - bzero((char *)vp, sizeof(*vp)); - free(vp); - } - cv->c_vplist = 0; - } - display->d_vpxmin = -1; - display->d_vpxmax = -1; - - for (cv = display->d_cvlist; cv; cv = cv->c_next) - { - if ((vp = (struct viewport *)malloc(sizeof *vp)) == 0) - return -1; -#ifdef HOLE - vp->v_canvas = cv; - vp->v_xs = cv->c_xs; - vp->v_ys = (cv->c_ys + cv->c_ye) / 2; - vp->v_xe = cv->c_xe; - vp->v_ye = cv->c_ye; - vp->v_xoff = cv->c_xoff; - vp->v_yoff = cv->c_yoff; - vp->v_next = cv->c_vplist; - cv->c_vplist = vp; - - if ((vp = (struct viewport *)malloc(sizeof *vp)) == 0) - return -1; - vp->v_canvas = cv; - vp->v_xs = (cv->c_xs + cv->c_xe) / 2; - vp->v_ys = (3 * cv->c_ys + cv->c_ye) / 4; - vp->v_xe = cv->c_xe; - vp->v_ye = (cv->c_ys + cv->c_ye) / 2 - 1; - vp->v_xoff = cv->c_xoff; - vp->v_yoff = cv->c_yoff; - vp->v_next = cv->c_vplist; - cv->c_vplist = vp; - - if ((vp = (struct viewport *)malloc(sizeof *vp)) == 0) - return -1; - vp->v_canvas = cv; - vp->v_xs = cv->c_xs; - vp->v_ys = (3 * cv->c_ys + cv->c_ye) / 4; - vp->v_xe = (3 * cv->c_xs + cv->c_xe) / 4 - 1; - vp->v_ye = (cv->c_ys + cv->c_ye) / 2 - 1; - vp->v_xoff = cv->c_xoff; - vp->v_yoff = cv->c_yoff; - vp->v_next = cv->c_vplist; - cv->c_vplist = vp; - - if ((vp = (struct viewport *)malloc(sizeof *vp)) == 0) - return -1; - vp->v_canvas = cv; - vp->v_xs = cv->c_xs; - vp->v_ys = cv->c_ys; - vp->v_xe = cv->c_xe; - vp->v_ye = (3 * cv->c_ys + cv->c_ye) / 4 - 1; - vp->v_xoff = cv->c_xoff; - vp->v_yoff = cv->c_yoff; - vp->v_next = cv->c_vplist; - cv->c_vplist = vp; -#else - vp->v_canvas = cv; - vp->v_xs = cv->c_xs; - vp->v_ys = cv->c_ys; - vp->v_xe = cv->c_xe; - vp->v_ye = cv->c_ye; - vp->v_xoff = cv->c_xoff; - vp->v_yoff = cv->c_yoff; - vp->v_next = cv->c_vplist; - cv->c_vplist = vp; -#endif - - if (cv->c_xs < display->d_vpxmin || display->d_vpxmin == -1) - display->d_vpxmin = cv->c_xs; - if (cv->c_xe > display->d_vpxmax || display->d_vpxmax == -1) - display->d_vpxmax = cv->c_xe; - } - return 0; -} - -void -RethinkViewportOffsets(cv) -struct canvas *cv; -{ - struct viewport *vp; - - for (vp = cv->c_vplist; vp; vp = vp->v_next) - { - vp->v_xoff = cv->c_xoff; - vp->v_yoff = cv->c_yoff; - } -} - /* * if the adaptflag is on, we keep the size of this display, else * we may try to restore our old window sizes. @@ -722,8 +435,8 @@ int adapt; ASSERT(display); ASSERT(D_tcinited); D_top = D_bot = -1; - AddCStr(D_TI); AddCStr(D_IS); + AddCStr(D_TI); /* Check for toggle */ if (D_IM && strcmp(D_IM, D_EI)) AddCStr(D_EI); @@ -749,7 +462,7 @@ int adapt; ResizeDisplay(D_defwidth, D_defheight); ChangeScrollRegion(0, D_height - 1); D_x = D_y = 0; - Flush(); + Flush(3); ClearAll(); debug1("we %swant to adapt all our windows to the display\n", (adapt) ? "" : "don't "); @@ -772,6 +485,8 @@ FinitTerm() KeypadMode(0); CursorkeysMode(0); CursorVisibility(0); + if (D_mousetrack) + D_mousetrack = 0; MouseMode(0); SetRendition(&mchar_null); SetFlow(FLOW_NOW); @@ -790,7 +505,7 @@ FinitTerm() AddChar('\n'); AddCStr(D_TE); } - Flush(); + Flush(3); } @@ -903,7 +618,15 @@ int c; AddCStr(D_CE0); goto addedutf8; } - AddUtf8(c); + if (c < 0x80) + { + if (D_xtable && D_xtable[(int)(unsigned char)D_rend.font] && D_xtable[(int)(unsigned char)D_rend.font][(int)(unsigned char)c]) + AddStr(D_xtable[(int)(unsigned char)D_rend.font][(int)(unsigned char)c]); + else + AddChar(c); + } + else + AddUtf8(c); goto addedutf8; } # endif @@ -1089,7 +812,13 @@ void MouseMode(mode) int mode; { - if (display && D_mouse != mode) + if (!display) + return; + + if (mode < D_mousetrack) + mode = D_mousetrack; + + if (D_mouse != mode) { char mousebuf[20]; if (!D_CXT) @@ -2102,6 +1831,7 @@ struct mchar *mc; { if (!display) return; +#ifdef COLOR if (nattr2color && D_hascolor && (mc->attr & nattr2color) != 0) { static struct mchar mmc; @@ -2122,6 +1852,7 @@ struct mchar *mc; mc = &mmc; debug2("SetRendition: mapped to %02x %02x\n", (unsigned char)mc->attr, 0x99 - (unsigned char)mc->color); } +# ifdef COLORS16 if (D_hascolor && D_CC8 && (mc->attr & (A_BFG|A_BBG))) { int a = mc->attr; @@ -2132,8 +1863,12 @@ struct mchar *mc; if (D_rend.attr != a) SetAttr(a); } - else if (D_rend.attr != mc->attr) + else +# endif /* COLORS16 */ +#endif /* COLOR */ + if (D_rend.attr != mc->attr) SetAttr(mc->attr); + #ifdef COLOR if (D_rend.color != mc->color # ifdef COLORS256 @@ -2158,6 +1893,7 @@ int x; { if (!display) return; +#ifdef COLOR if (nattr2color && D_hascolor && (ml->attr[x] & nattr2color) != 0) { struct mchar mc; @@ -2165,6 +1901,7 @@ int x; SetRendition(&mc); return; } +# ifdef COLORS16 if (D_hascolor && D_CC8 && (ml->attr[x] & (A_BFG|A_BBG))) { int a = ml->attr[x]; @@ -2175,7 +1912,10 @@ int x; if (D_rend.attr != a) SetAttr(a); } - else if (D_rend.attr != ml->attr[x]) + else +# endif /* COLORS16 */ +#endif /* COLOR */ + if (D_rend.attr != ml->attr[x]) SetAttr(ml->attr[x]); #ifdef COLOR if (D_rend.color != ml->color[x] @@ -2217,7 +1957,7 @@ char *msg; return; /* XXX: better */ AddStr(msg); AddStr("\r\n"); - Flush(); + Flush(0); return; } if (!use_hardstatus || !D_HS) @@ -2234,19 +1974,11 @@ char *msg; if (strcmp(msg, D_status_lastmsg) == 0) { debug("same message - increase timeout"); - SetTimeout(&D_statusev, MsgWait); + if (!D_status_obufpos) + SetTimeout(&D_statusev, MsgWait); return; } - if (!D_status_bell) - { - struct timeval now; - int ti; - gettimeofday(&now, NULL); - ti = (now.tv_sec - D_status_time.tv_sec) * 1000 + (now.tv_usec - D_status_time.tv_usec) / 1000; - if (ti < MsgMinWait) - DisplaySleep1000(MsgMinWait - ti, 0); - } - RemoveStatus(); + RemoveStatusMinWait(); } for (s = t = msg; *s && t - msg < max; ++s) if (*s == BELL) @@ -2303,15 +2035,15 @@ char *msg; D_status = STATUS_ON_HS; ShowHStatus(msg); } - Flush(); - if (!display) - return; + + D_status_obufpos = D_obufp - D_obuf; + ASSERT(D_status_obufpos > 0); + if (D_status == STATUS_ON_WIN) { struct display *olddisplay = display; struct layer *oldflayer = flayer; - ASSERT(D_obuffree == D_obuflen); /* this is copied over from RemoveStatus() */ D_status = 0; GotoPos(0, STATLINE); @@ -2322,17 +2054,8 @@ char *msg; LaySetCursor(); display = olddisplay; flayer = oldflayer; - D_status_obuflen = D_obuflen; - D_status_obuffree = D_obuffree; - D_obuffree = D_obuflen = 0; D_status = STATUS_ON_WIN; } - gettimeofday(&D_status_time, NULL); - SetTimeout(&D_statusev, MsgWait); - evenq(&D_statusev); -#ifdef HAVE_BRAILLE - RefreshBraille(); /* let user see multiple Msg()s */ -#endif } void @@ -2346,28 +2069,28 @@ RemoveStatus() return; if (!(where = D_status)) return; - + debug("RemoveStatus\n"); if (D_status_obuffree >= 0) { D_obuflen = D_status_obuflen; D_obuffree = D_status_obuffree; D_status_obuffree = -1; - D_status = 0; - D_status_bell = 0; - evdeq(&D_statusev); - return; } D_status = 0; + D_status_obufpos = 0; D_status_bell = 0; evdeq(&D_statusev); olddisplay = display; oldflayer = flayer; if (where == STATUS_ON_WIN) { - GotoPos(0, STATLINE); - RefreshLine(STATLINE, 0, D_status_len - 1, 0); - GotoPos(D_status_lastx, D_status_lasty); + if (captionalways || (D_canvas.c_slperp && D_canvas.c_slperp->c_slnext)) + { + GotoPos(0, STATLINE); + RefreshLine(STATLINE, 0, D_status_len - 1, 0); + GotoPos(D_status_lastx, D_status_lasty); + } } else RefreshHStatus(); @@ -2378,12 +2101,92 @@ RemoveStatus() flayer = oldflayer; } +/* Remove the status but make sure that it is seen for MsgMinWait ms */ +static void +RemoveStatusMinWait() +{ + /* XXX: should flush output first if D_status_obufpos is set */ + if (!D_status_bell && !D_status_obufpos) + { + struct timeval now; + int ti; + gettimeofday(&now, NULL); + ti = (now.tv_sec - D_status_time.tv_sec) * 1000 + (now.tv_usec - D_status_time.tv_usec) / 1000; + if (ti < MsgMinWait) + DisplaySleep1000(MsgMinWait - ti, 0); + } + RemoveStatus(); +} + +#ifdef UTF8 +static int +strlen_onscreen(unsigned char *c, unsigned char *end) +{ + int len = 0; + char *s = c; + while (*c && (!end || c < end)) + { + int v, dec = 0; + do + { + v = FromUtf8(*c++, &dec); + if (v == -2) + c--; + } + while (v < 0 && (!end || c < end)); + if (!utf8_iscomb(v)) + { + if (utf8_isdouble(v)) + len++; + len++; + } + } + + return len; +} + +static int +PrePutWinMsg(s, start, max) +char *s; +int start, max; +{ + /* Avoid double-encoding problem for a UTF-8 message on a UTF-8 locale. + Ideally, this would not be necessary. But fixing it the Right Way will + probably take way more time. So this will have to do for now. */ + if (D_encoding == UTF8) + { + int chars = strlen_onscreen(s + start, s + max); + D_encoding = 0; + PutWinMsg(s, start, max); + D_encoding = UTF8; + D_x -= (max - chars); /* Yak! But this is necessary to count for + the fact that not every byte represents a + character. */ + return start + chars; + } + else + { + PutWinMsg(s, start, max); + return max; + } +} +#else +static int +PrePutWinMsg(s, start, max) +char *s; +int start, max; +{ + PutWinMsg(s, start, max); + return max; +} +#endif + /* refresh the display's hstatus line */ void ShowHStatus(str) char *str; { - int l, i, ox, oy, max; + int l, ox, oy, max; if (D_status == STATUS_ON_WIN && D_has_hstatus == HSTATUS_LASTLINE && STATLINE == D_height-1) return; /* sorry, in use */ @@ -2422,9 +2225,7 @@ char *str; l = D_width; GotoPos(0, D_height - 1); SetRendition(captionalways || D_cvlist == 0 || D_cvlist->c_next ? &mchar_null: &mchar_so); - if (!PutWinMsg(str, 0, l)) - for (i = 0; i < l; i++) - PUTCHARLP(str[i]); + l = PrePutWinMsg(str, 0, l); if (!captionalways && D_cvlist && !D_cvlist->c_next) while (l++ < D_width) PUTCHARLP(' '); @@ -2510,7 +2311,7 @@ int y, from, to, isblank; struct viewport *vp, *lvp; struct canvas *cv, *lcv, *cvlist, *cvlnext; struct layer *oldflayer; - int xx, yy; + int xx, yy, l; char *buf; struct win *p; @@ -2520,9 +2321,13 @@ int y, from, to, isblank; debug2(" %d %d\n", to, isblank); if (D_status == STATUS_ON_WIN && y == STATLINE) - return; /* can't refresh status */ + { + if (to >= D_status_len) + D_status_len = to + 1; + return; /* can't refresh status */ + } - if (isblank == 0 && D_CE && to == D_width - 1 && from < to) + if (isblank == 0 && D_CE && to == D_width - 1 && from < to && D_status != STATUS_ON_HS) { GotoPos(from, y); if (D_UT || D_BE) @@ -2530,12 +2335,45 @@ int y, from, to, isblank; AddCStr(D_CE); isblank = 1; } + + if (y == D_height - 1 && D_has_hstatus == HSTATUS_LASTLINE) + { + RefreshHStatus(); + return; + } + while (from <= to) { lcv = 0; lvp = 0; for (cv = display->d_cvlist; cv; cv = cv->c_next) { + if (y == cv->c_ye + 1 && from >= cv->c_xs && from <= cv->c_xe) + { + p = Layer2Window(cv->c_layer); + buf = MakeWinMsgEv(captionstring, p, '%', cv->c_xe - cv->c_xs + (cv->c_xe + 1 < D_width || D_CLP), &cv->c_captev, 0); + if (cv->c_captev.timeout.tv_sec) + evenq(&cv->c_captev); + xx = to > cv->c_xe ? cv->c_xe : to; + l = strlen(buf); + GotoPos(from, y); + SetRendition(&mchar_so); + if (l > xx - cv->c_xs + 1) + l = xx - cv->c_xs + 1; + l = PrePutWinMsg(buf, from - cv->c_xs, l); + from = cv->c_xs + l; + for (; from <= xx; from++) + PUTCHARLP(' '); + break; + } + if (from == cv->c_xe + 1 && y >= cv->c_ys && y <= cv->c_ye + 1) + { + GotoPos(from, y); + SetRendition(&mchar_so); + PUTCHARLP(' '); + from++; + break; + } if (y < cv->c_ys || y > cv->c_ye || to < cv->c_xs || from > cv->c_xe) continue; debug2("- canvas hit: %d %d", cv->c_xs, cv->c_ys); @@ -2552,6 +2390,8 @@ int y, from, to, isblank; } } } + if (cv) + continue; /* we advanced from */ if (lvp == 0) break; if (from < lvp->v_xs) @@ -2565,6 +2405,13 @@ int y, from, to, isblank; yy = y - lvp->v_yoff; xx = to < lvp->v_xe ? to : lvp->v_xe; + if (lcv->c_layer && lcv->c_xoff + lcv->c_layer->l_width == from) + { + GotoPos(from, y); + SetRendition(&mchar_blank); + PUTCHARLP('|'); + from++; + } if (lcv->c_layer && yy == lcv->c_layer->l_height) { GotoPos(from, y); @@ -2600,44 +2447,8 @@ int y, from, to, isblank; from = xx + 1; } - if (from > to) - return; /* all done */ - - if (y == D_height - 1 && D_has_hstatus == HSTATUS_LASTLINE) - { - RefreshHStatus(); - return; - } - - for (cv = display->d_cvlist; cv; cv = cv->c_next) - if (y == cv->c_ye + 1) - break; - if (cv == 0) - { - if (!isblank) - DisplayLine(&mline_null, &mline_blank, y, from, to); - return; - } - - p = Layer2Window(cv->c_layer); - buf = MakeWinMsgEv(captionstring, p, '%', D_width - !D_CLP, &cv->c_captev, 0); - if (cv->c_captev.timeout.tv_sec) - evenq(&cv->c_captev); - xx = strlen(buf); - GotoPos(from, y); - SetRendition(&mchar_so); - if (PutWinMsg(buf, from, to + 1)) - from = xx > to + 1 ? to + 1 : xx; - else - { - while (from <= to && from < xx) - { - PUTCHARLP(buf[from]); - from++; - } - } - while (from++ <= to) - PUTCHARLP(' '); + if (!isblank && from <= to) + DisplayLine(&mline_null, &mline_blank, y, from, to); } /*********************************************************************/ @@ -2713,7 +2524,7 @@ int from, to, y, bce; DisplayLine(oml, &mline_blank, y, from, to); return; } - bcechar = mchar_blank; + bcechar = mchar_null; rend_setbg(&bcechar, bce); for (x = from; x <= to; x++) copy_mchar2mline(&bcechar, &mline_old, x); @@ -3048,12 +2859,19 @@ int newtop, newbot; } #ifdef RXVT_OSC +#define WT_FLAG "2" /* change to "0" to set both title and icon */ + void SetXtermOSC(i, s) int i; char *s; { - static char oscs[] = "1;\000\00020;\00039;\00049;\000"; + static char *oscs[][2] = { + { WT_FLAG ";", "screen" }, /* set window title */ + { "20;", "" }, /* background */ + { "39;", "black" }, /* default foreground (black?) */ + { "49;", "white" } /* default background (white?) */ + }; ASSERT(display); if (!D_CXT) @@ -3062,17 +2880,13 @@ char *s; s = ""; if (!D_xtermosc[i] && !*s) return; - if (i == 0 && !*s) - s = "screen"; /* always set icon name */ - if (i == 1 && !*s) - s = ""; /* no background */ - if (i == 2 && !*s) - s = "black"; /* black text */ - if (i == 3 && !*s) - s = "white"; /* on white background */ + if (i == 0 && !D_xtermosc[0]) + AddStr("\033[22;" WT_FLAG "t"); /* stack titles (xterm patch #251) */ + if (!*s) + s = oscs[i][1]; D_xtermosc[i] = 1; AddStr("\033]"); - AddStr(oscs + i * 4); + AddStr(oscs[i][0]); AddStr(s); AddChar(7); } @@ -3083,7 +2897,10 @@ ClearAllXtermOSC() int i; for (i = 3; i >= 0; i--) SetXtermOSC(i, 0); + if (D_xtermosc[0]) + AddStr("\033[23;" WT_FLAG "t"); /* unstack titles (xterm patch #251) */ } +#undef WT_FLAG #endif /* @@ -3133,9 +2950,11 @@ int n; } void -Flush() +Flush(progress) +int progress; { register int l; + int wr; register char *p; ASSERT(display); @@ -3151,29 +2970,57 @@ Flush() return; } p = D_obuf; - if (fcntl(D_userfd, F_SETFL, 0)) - debug1("Warning: BLOCK fcntl failed: %d\n", errno); + if (!progress) + { + if (fcntl(D_userfd, F_SETFL, 0)) + debug1("Warning: BLOCK fcntl failed: %d\n", errno); + } while (l) { - register int wr; + if (progress) + { + fd_set w; + FD_ZERO(&w); + FD_SET(D_userfd, &w); + struct timeval t; + t.tv_sec = progress; + t.tv_usec = 0; + wr = select(FD_SETSIZE, (fd_set *)0, &w, (fd_set *)0, &t); + if (wr == -1) + { + if (errno == EINTR) + continue; + debug1("Warning: select failed: %d\n", errno); + break; + } + if (wr == 0) + { + /* no progress after 3 seconds. sorry. */ + debug1("Warning: no progress after %d seconds\n", progress); + break; + } + } wr = write(D_userfd, p, l); - if (wr <= 0) + if (wr <= 0) { - if (errno == EINTR) + if (errno == EINTR) continue; debug1("Writing to display: %d\n", errno); - wr = l; + break; } - if (!display) - return; D_obuffree += wr; p += wr; l -= wr; } + if (l) + debug1("Warning: Flush could not write %d bytes\n", l); D_obuffree += l; D_obufp = D_obuf; - if (fcntl(D_userfd, F_SETFL, FNBLOCK)) - debug1("Warning: NBLOCK fcntl failed: %d\n", errno); + if (!progress) + { + if (fcntl(D_userfd, F_SETFL, FNBLOCK)) + debug1("Warning: NBLOCK fcntl failed: %d\n", errno); + } if (D_blocked == 1) D_blocked = 0; D_blocked_fuzz = 0; @@ -3211,16 +3058,7 @@ Resize_obuf() if (D_status_obuffree >= 0) { ASSERT(D_obuffree == -1); - if (!D_status_bell) - { - struct timeval now; - int ti; - gettimeofday(&now, NULL); - ti = (now.tv_sec - D_status_time.tv_sec) * 1000 + (now.tv_usec - D_status_time.tv_usec) / 1000; - if (ti < MsgMinWait) - DisplaySleep1000(MsgMinWait - ti, 0); - } - RemoveStatus(); + RemoveStatusMinWait(); if (--D_obuffree > 0) /* redo AddChar decrement */ return; } @@ -3302,8 +3140,8 @@ NukePending() D_obufp = D_obuf; D_obuffree += len; D_top = D_bot = -1; - AddCStr(D_TI); AddCStr(D_IS); + AddCStr(D_TI); /* Turn off all attributes. (Tim MacKenzie) */ if (D_ME) AddCStr(D_ME); @@ -3388,6 +3226,8 @@ char *data; len = D_obufp - D_obuf; if (len < size) size = len; + if (D_status_obufpos && size > D_status_obufpos) + size = D_status_obufpos; ASSERT(len >= 0); size = write(D_userfd, D_obuf, size); if (size >= 0) @@ -3400,6 +3240,30 @@ char *data; } D_obufp -= size; D_obuffree += size; + if (D_status_obufpos) + { + D_status_obufpos -= size; + if (!D_status_obufpos) + { + debug("finished writing the status message\n"); + /* we're finished displaying the message! */ + if (D_status == STATUS_ON_WIN) + { + /* setup continue trigger */ + D_status_obuflen = D_obuflen; + D_status_obuffree = D_obuffree; + /* setting obbuffree to 0 will make AddChar call + * ResizeObuf */ + D_obuffree = D_obuflen = 0; + } + gettimeofday(&D_status_time, NULL); + SetTimeout(&D_statusev, MsgWait); + evenq(&D_statusev); +#ifdef HAVE_BRAILLE + RefreshBraille(); /* let user see multiple Msg()s */ +#endif + } + } if (D_blocked_fuzz) { D_blocked_fuzz -= size; @@ -3427,7 +3291,7 @@ char *data; Activate(D_fore ? D_fore->w_norefresh : 0); D_blocked_fuzz = D_obufp - D_obuf; } - } + } else { #ifdef linux @@ -3561,15 +3425,29 @@ char *data; y = bp[4] - 33; if (x >= D_forecv->c_xs && x <= D_forecv->c_xe && y >= D_forecv->c_ys && y <= D_forecv->c_ye) { - x -= D_forecv->c_xoff; - y -= D_forecv->c_yoff; - if (x >= 0 && x < D_forecv->c_layer->l_width && y >= 0 && y < D_forecv->c_layer->l_height) + if ((D_fore && D_fore->w_mouse) || (D_mousetrack && D_forecv->c_layer->l_mode == 1)) { - bp[3] = x + 33; - bp[4] = y + 33; - i -= 4; - bp += 4; - continue; + /* Send clicks only if the window is expecting clicks */ + x -= D_forecv->c_xoff; + y -= D_forecv->c_yoff; + if (x >= 0 && x < D_forecv->c_layer->l_width && y >= 0 && y < D_forecv->c_layer->l_height) + { + bp[3] = x + 33; + bp[4] = y + 33; + i -= 4; + bp += 4; + continue; + } + } + } + else if (D_mousetrack && bp[2] == '#') + { + /* 'focus' to the clicked region, only on mouse up */ + struct canvas *cv = FindCanvas(x, y); + if (cv) + { + SetForeCanvas(display, cv); + /* XXX: Do we want to reset the input buffer? */ } } if (bp[0] == '[') @@ -3666,29 +3544,6 @@ char *data; } } -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); -} - #ifdef MAPKEYS static void disp_map_fn(ev, data) @@ -3872,7 +3727,10 @@ char **cmdv; displays = 0; #ifdef DEBUG if (dfp && dfp != stderr) - fclose(dfp); + { + fclose(dfp); + dfp = 0; + } #endif if (setgid(real_gid) || setuid(real_uid)) Panic(errno, "setuid/setgid"); @@ -3900,7 +3758,7 @@ char **cmdv; (void)ioctl(0, TIOCSWINSZ, (char *)&glwz); #else sprintf(libuf, "LINES=%d", D_height); - sprintf(libuf, "COLUMNS=%d", D_width); + sprintf(cobuf, "COLUMNS=%d", D_width); *np++ = libuf; *np++ = cobuf; #endif @@ -3909,7 +3767,7 @@ char **cmdv; #endif display = 0; execvpe(*cmdv, cmdv, NewEnv + 3); - Panic(errno, *cmdv); + Panic(errno, "%s", *cmdv); default: break; } @@ -3919,4 +3777,6 @@ char **cmdv; ClearAll(); } -#endif +#endif /* BLANKER_PRG */ + + diff --git a/display.h b/src/display.h index ef99954..e8b3b80 100644 --- a/display.h +++ b/src/display.h @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,19 +19,25 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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: display.h,v 1.9 1994/05/31 12:31:54 mlschroe Exp $ FAU + * $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_EXT 50 #define KMAP_NOTIMEOUT 0x4000 @@ -39,45 +50,22 @@ struct kmap_ext struct action mm; }; -#endif +#else -struct win; /* forward declaration */ +#define KMAP_KEYS 0 -struct canvas -{ - struct canvas *c_next; /* next canvas on display */ - struct display *c_display; /* back pointer to display */ - 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 */ -}; +#endif -struct viewport -{ - struct viewport *v_next; /* next vp on canvas */ - struct canvas *v_canvas; /* back pointer to canvas */ - int v_xoff; /* layer x offset on display */ - int v_yoff; /* layer y offset on display */ - int v_xs; /* vp upper left */ - int v_xe; /* vp upper right */ - int v_ys; /* vp lower left */ - int v_ye; /* vp lower right */ -}; +struct win; /* forward declaration */ struct display { struct display *d_next; /* linked list */ - struct acluser *d_user; /* user who owns that display */ + 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 */ @@ -112,6 +100,8 @@ struct display int d_hstatus; /* hardstatus used */ int d_lp_missing; /* last character on bot line missing */ int d_mouse; /* mouse mode */ + int d_mousetrack; /* set when user wants to use mouse even when the window + does not */ #ifdef RXVT_OSC int d_xtermosc[4]; /* osc used */ #endif @@ -126,6 +116,7 @@ struct display 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 */ @@ -198,7 +189,9 @@ extern struct display TheDisplay; #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) @@ -234,6 +227,7 @@ extern struct display TheDisplay; #define D_hstatus DISPLAY(d_hstatus) #define D_lp_missing DISPLAY(d_lp_missing) #define D_mouse DISPLAY(d_mouse) +#define D_mousetrack DISPLAY(d_mousetrack) #define D_xtermosc DISPLAY(d_xtermosc) #define D_lpchar DISPLAY(d_lpchar) #define D_status DISPLAY(d_status) @@ -246,6 +240,7 @@ extern struct display TheDisplay; #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) @@ -317,23 +312,6 @@ do \ } \ while (0) -#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; \ -} - #define STATUS_OFF 0 #define STATUS_ON_WIN 1 #define STATUS_ON_HS 2 @@ -343,3 +321,6 @@ while (0) #define HSTATUS_MESSAGE 2 #define HSTATUS_HS 3 #define HSTATUS_ALWAYS (1<<2) + +#endif /* SCREEN_DISPLAY_H */ + diff --git a/src/doc/.gitignore b/src/doc/.gitignore new file mode 100644 index 0000000..2681820 --- /dev/null +++ b/src/doc/.gitignore @@ -0,0 +1,2 @@ +Makefile +screen.info* diff --git a/src/doc/FAQ b/src/doc/FAQ new file mode 100644 index 0000000..6c9c8af --- /dev/null +++ b/src/doc/FAQ @@ -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 til 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 peole 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 envolved 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 scrip 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 diff --git a/doc/Makefile.in b/src/doc/Makefile.in index d3c42fe..f7c7db7 100644 --- a/doc/Makefile.in +++ b/src/doc/Makefile.in @@ -6,6 +6,7 @@ VPATH = @srcdir@ DESTDIR = prefix = @prefix@ +datarootdir = @datarootdir@ mandir = @mandir@ infodir = @infodir@ diff --git a/doc/README.DOTSCREEN b/src/doc/README.DOTSCREEN index f17fa37..f17fa37 100644 --- a/doc/README.DOTSCREEN +++ b/src/doc/README.DOTSCREEN diff --git a/doc/fdpat.ps b/src/doc/fdpat.ps index 6b10099..6b10099 100644 --- a/doc/fdpat.ps +++ b/src/doc/fdpat.ps diff --git a/install.sh b/src/doc/install.sh index 8c07c50..8c07c50 100755 --- a/install.sh +++ b/src/doc/install.sh diff --git a/doc/make.help b/src/doc/make.help index 5871773..5871773 100644 --- a/doc/make.help +++ b/src/doc/make.help diff --git a/doc/screen.1 b/src/doc/screen.1 index 348d357..c175891 100644 --- a/doc/screen.1 +++ b/src/doc/screen.1 @@ -97,7 +97,9 @@ but will instead supply the command name and its arguments to the window manager (specified in the $STY environment variable) who will use it to create the new window. The above example would start the emacs editor (editing prog.c) and switch -to its window. +to its window. - Note that you cannot transport environment variables from +the invoking shell to the application (emacs in this case), because it is +forked from the parent screen process, not from the invoking shell. .PP If \*Q/etc/utmp\*U is writable by .IR screen , @@ -231,7 +233,11 @@ The use of this option is discouraged. turns login mode on or off (for /etc/utmp updating). This can also be defined through the \*Qdeflogin\*U .screenrc command. .TP 5 -.BR \-ls " and " \-list +.BR \-ls " [" \fImatch ] +.PD 0 +.TP 5 +.BR \-list " [" \fImatch ] +.PD does not start .IR screen , but prints a list of @@ -282,12 +288,14 @@ emulation (only affects auto-margin terminals without `LP'). This can also be set in your .screenrc by specifying `OP' in a \*Qtermcap\*U command. .TP 5 -.BI "\-p " number_or_name -Preselect a window. This is usefull when you want to reattach to a -specific windor or you want to send a command via the \*Q-X\*U -option to a specific window. As with screen's select commant, \*Q-\*U +.BI "\-p " number_or_name|-|=|+ +Preselect a window. This is useful when you want to reattach to a +specific window or you want to send a command via the \*Q-X\*U +option to a specific window. As with screen's select command, \*Q-\*U selects the blank window. As a special case for reattach, \*Q=\*U -brings up the windowlist on the blank window. +brings up the windowlist on the blank window, while a \*Q+\*U +will create a new window. The command will not be +executed if the specified window could not be found. .TP 5 .B \-q Suppress printing of error messages. In combination with \*Q-ls\*U the exit @@ -299,6 +307,23 @@ there is no session to resume. 12 (or more) indicates that there are 2 (or more) sessions to resume and you should specify which one to choose. In all other cases \*Q-q\*U has no effect. .TP 5 +.B \-Q +Some commands now can be queried from a remote session using this +flag, e.g. 'screen -Q windows'. The commands will send the +response to the stdout of the querying process. If there was an +error in the command, then the querying process will exit with +a non-zero status. + +The commands that can be queried now are: + \fBecho\fP + \fBinfo\fP + \fBlastmsg\fP + \fBnumber\fP + \fBselect\fP + \fBtime\fP + \fBtitle\fP + \fBwindows\fP +.TP 5 .BR \-r " [" \fIpid.tty.host ] .PD 0 .TP 5 @@ -326,7 +351,7 @@ had not been specified. The option is set by default if is run as a login-shell (actually screen uses \*Q-xRR\*U in that case). For combinations with the \fB\-d\fP/\fB\-D\fP option see there. .TP 5 -.B \-s +.BI "\-s " program sets the default shell to the program specified, instead of the value in the environment variable $SHELL (or \*Q/bin/sh\*U if not defined). This can also be defined through the \*Qshell\*U .screenrc command. @@ -341,6 +366,10 @@ default [\fItty.host\fP] suffix. sets the title (a.\|k.\|a.) for the default shell or specified program. See also the \*Qshelltitle\*U .screenrc command. .TP 5 +.BI "\-T " term +Set the $TERM enviroment varible using the spcified term as +opposed to the defualt setting of \fBscreen\fP. +.TP 5 .B \-U Run screen in UTF-8 mode. This option tells screen that your terminal sends and understands UTF-8 encoded characters. It also sets the default @@ -360,6 +389,9 @@ See the \fB-r\fP flag for a description how to construct matches. Attach to a not detached .I screen session. (Multi display mode). +.I Screen +refuses to attach from within itself. +But when cascading multiple screens, loops are not detected; take care. .TP 5 .B \-X Send the specified command to a running screen session. You can use @@ -367,7 +399,6 @@ the \fB-d\fP or \fB-r\fP option to tell screen to look only for attached or detached screen sessions. Note that this command doesn't work if the session is password protected. - .SH "DEFAULT KEY BINDINGS" .ta 12n 26n As mentioned, each @@ -396,6 +427,7 @@ Switch to window number 0 \- 9, or to the blank window. .IP "\fBC-a tab\fP (focus)" .PD Switch the input focus to the next region. +See also \fIsplit, remove, only\fP. .IP "\fBC-a C-a\fP (other)" Toggle to the window displayed previously. Note that this binding defaults to the command character typed twice, @@ -492,6 +524,7 @@ Switch to the previous window (opposite of \fBC-a n\fP). Send a control-q to the current window. .IP "\fBC-a Q\fP (only)" Delete all regions but the current one. +See also \fIsplit, remove, focus\fP. .IP "\fBC-a r\fP" .PD 0 .IP "\fBC-a C-r\fP (wrap)" @@ -504,7 +537,8 @@ automatic margins on and off). .PD Send a control-s to the current window. .IP "\fBC-a S\fP (split)" -Split the current region into two new ones. +Split the current region horizontally into two new ones. +See also \fIonly, remove, focus\fP. .IP "\fBC-a t\fP" .PD 0 .IP "\fBC-a C-t\fP (time)" @@ -530,6 +564,7 @@ Toggle 80/132 columns. Lock this terminal. .IP "\fBC-a X\fP (remove)" Kill the current region. +See also \fIsplit, only, focus\fP. .IP "\fBC-a z\fP" .PD 0 .IP "\fBC-a C-z\fP (suspend)" @@ -554,6 +589,8 @@ Enter command line mode. .IP "\fBC-a esc\fP (copy)" .PD Enter copy/scrollback mode. +.IP "\fBC-a C-]\fP" +.PD 0 .IP "\fBC-a ]\fP (paste .)" .PD Write the contents of the paste buffer to the stdin queue of the @@ -575,6 +612,8 @@ Shows where comes from, where it went to and why you can use it. .IP "\fBC-a _\fP (silence)" Start/stop monitoring the current window for inactivity. +.IP "\fBC-a |\fP (split -v)" +Split the current region vertically into two new ones. .IP "\fBC-a *\fP (displays)" Show a listing of all currently attached displays. @@ -1044,7 +1083,7 @@ so that users can type slowly. This key-binding makes \*Q^T\*U an escape character for key-bindings. If you did the above \*Qstuff barfoo\*U binding, you can enter the word \*Qfoo\*U by typing \*Q^Tfoo\*U. If you want to insert a \*Q^T\*U -you have to press the key twice (i.e. escape the escape binding). +you have to press the key twice (i.e., escape the escape binding). .sp .nf bindkey -k F1 command @@ -1077,7 +1116,8 @@ This command is normally used together with the \*Qidle\*U command. .B blankerprg .RI [ "program args" ] .PP -Defines a blanker program. Disables the blanker program if no +Defines a blanker program. Disables the blanker program if an +empty argument is given. Shows the currently set blanker program if no arguments are given. .sp .ne 3 @@ -1234,44 +1274,67 @@ window and its history into the paste buffer. In this mode a vi-like .br .in +4n .ti -2n -\fBh\fP, \fBj\fP, \fBk\fP, \fBl\fP move the cursor line by line or -column by column. +\fBh\fP, \fBC-h\fP, or \fBleft arrow\fP move the cursor left. .br .ti -2n -\fB0\fP, \fB^\fP and \fB$\fP move to the leftmost column, to the first or last -non-whitespace character on the line. +\fBj\fP, \fBC-n\fP, or \fBdown arrow\fP move the cursor down. +.br +.ti -2n +\fBk\fP, \fBC-p\fP, or \fBup arrow\fP move the cursor up. +.br +.ti -2n +\fBl\fP ('el') or \fBright arrow\fP move the cursor right. +.br +.ti -2n +\fB0\fP (zero) or \fBC-a\fP move to the leftmost column. +.br +.ti -2n +\fB+\fP and \fB\-\fP positions one line up and down. .br .ti -2n \fBH\fP, \fBM\fP and \fBL\fP move the cursor to the leftmost column of the top, center or bottom line of the window. .br .ti -2n -\fB+\fP and \fB\-\fP positions one line up and down. +\fB|\fP moves to the specified absolute column. +.br +.ti -2n +\fBg\fP or \fBhome\fP moves to the beginning of the buffer. .br .ti -2n -\fBG\fP moves to the specified absolute line (default: end of buffer). +\fBG\fP or \fBend\fP moves to the specified absolute line (default: end of buffer). .br .ti -2n -\fB|\fP moves to the specified absolute column. +\fB%\fP jumps to the specified percentage of the buffer. +.br +.ti -2n +\fB^\fP or \fB$\fP move to the leftmost column, to the first or last +non-whitespace character on the line. .br .ti -2n -\fBw\fP, \fBb\fP, \fBe\fP move the cursor word by word. +\fBw\fP, \fBb\fP, and \fBe\fP move the cursor word by word. .br .ti -2n \fBB\fP, \fBE\fP move the cursor WORD by WORD (as in vi). .br .ti -2n -\fBC-u\fP and \fBC-d\fP scroll the display up/down by the specified amount of -lines while preserving the cursor position. (Default: half screen-full). +.\"\fBf\fP,\fBt\fP, \fBF\fP, \fBT\fP move the cursor forward/backward to the next occurence of the target. +\fBf/F\fP, \fBt/T\fP move the cursor forward/backward to the next occurence of the target. (eg, '3fy' will +move the cursor to the 3rd 'y' to the right.) .br .ti -2n -\fBC-b\fP and \fBC-f\fP scroll the display up/down a full screen. +\fB;\fP and \fB,\fP Repeat the last f/F/t/T command in the same/opposite direction. .br .ti -2n -\fBg\fP moves to the beginning of the buffer. +\fBC-e\fP and \fBC-y\fP scroll the display up/down by one line +while preserving the cursor position. .br .ti -2n -\fB%\fP jumps to the specified percentage of the buffer. +\fBC-u\fP and \fBC-d\fP scroll the display up/down by the specified amount of +lines while preserving the cursor position. (Default: half screen-full). +.br +.ti -2n +\fBC-b\fP and \fBC-f\fP scroll the display up/down a full screen. .br .ti -4n @@ -1286,11 +1349,12 @@ emacs-style keymap, as this involves multi-character codes. .IR Marking : .br The copy range is specified by setting two marks. The text between these marks -will be highlighted. Press +will be highlighted. Press: .br .ti -2n -\fBspace\fP to set the first or second mark -respectively. +\fBspace\fP or \fBenter\fP to set the first or second mark +respectively. If \fBmousetrack\fP is set to `on', marks can also be set using +\fPleft mouse click\fP. .br .ti -2n \fBY\fP and \fBy\fP used to mark one whole line or to mark from @@ -1322,6 +1386,10 @@ Example: \*QC-a C-[ H 10 j 5 Y\*U will copy lines \fBC-a s\fP \fIEmacs\fP style incremental search forward. .ti -2n \fBC-r\fP \fIEmacs\fP style reverse i-search. +.ti -2n +\fBn\fP Find next search pattern. +.ti -2n +\fBN\fP Find previous search pattern. .ti -4n .IR Specials : .br @@ -1330,7 +1398,7 @@ There are however some keys that act differently than in .I Vi does not allow one to yank rectangular blocks of text, but .I screen -does. Press +does. Press: .br .ti -2n \fBc\fP or \fBC\fP to set the left or right margin respectively. If no repeat count is @@ -1355,7 +1423,7 @@ whitespace and comma separated lines. Note that you can prepend the newline character with a carriage return character, by issuing a \*Qcrlf on\*U. .br .ti -2n -\fBv\fP is for all the +\fBv\fP or \fBV\fP is for all the .I vi users with \*Q:set numbers\*U \- it toggles the left margin between column 9 and 1. Press @@ -1379,10 +1447,13 @@ to that file: \*QC-A [ g SPACE G $ >\*U. \fBC-g\fP gives information about the current line and column. .br .ti -2n -\fBx\fP exchanges the first mark and the current cursor position. You +\fBx\fP or \fBo\fP exchanges the first mark and the current cursor position. You can use this to adjust an already placed mark. .br .ti -2n +\fBC-l\fP ('el') will redraw the screen. +.br +.ti -2n \fB@\fP does nothing. Does not even exit copy mode. .br .ti -2n @@ -1448,7 +1519,7 @@ session for the duration of the break, but it may be the only way to generate long breaks. .IR Tcsendbreak " and " TIOCSBRK may or may not produce long breaks with spikes (e.g. 4 per -second). This is not only system dependant, this also differs between +second). This is not only system-dependent, this also differs between serial board drivers. Calling \*Qdefbreaktype\*U with no parameter displays the current setting. .sp @@ -1535,6 +1606,12 @@ Same as the \fBmonitor\fP command except that the default setting for new windows is changed. Initial setting is `off'. .sp .ne 3 +.BR "defmousetrack on" | off +.PP +Same as the \fBmousetrack\fP command except that the default setting for new +windows is changed. Initial setting is `off'. +.sp +.ne 3 .B defnonblock .BR on | off | \fInumsecs .PP @@ -1628,9 +1705,93 @@ why features like color or the alternate charset don't work. .PP Shows a tabular listing of all currently connected user front-ends (displays). This is most useful for multiuser sessions. +The following keys can be used in displays list: +.br +.in +4n +.ti -2n +\fBk\fP, \fBC-p\fP, or \fBup\fP Move up one line. +.br +.ti -2n +\fBj\fP, \fBC-n\fP, or \fBdown\fP Move down one line. +.br +.ti -2n +\fBC-a\fP or \fBhome\fP Move to the first line. +.br +.ti -2n +\fBC-e\fP or \fBend\fP Move to the last line. +.br +.ti -2n +\fBC-u\fP or \fBC-d\fP Move one half page up or down. +.br +.ti -2n +\fBC-b\fP or \fBC-f\fP Move one full page up or down. +.br +.ti -2n +\fBmouseclick\fP Move to the selected line. Available +when \*Qmousetrack\*U is set to on. +.br +.ti -2n +\fBspace\fP Refresh the list +.br +.ti -2n +\fBd\fP Detach that display +.br +.ti -2n +\fBD\fP Power detach that display +.br +.ti -2n +\fBC-g\fP, \fBenter\fP, or \fBescape\fP Exit the list +.br +.ti -4n +.PP +The following is an example of what \*Qdisplays\*U could look like: +.IP +xterm 80x42 jnweiger@/dev/ttyp4 0(m11) &rWx +.br +facit 80x24 mlschroe@/dev/ttyhf nb 11(tcsh) rwx +.br +xterm 80x42 jnhollma@/dev/ttyp5 0(m11) &R.x +.br + (A) (B) (C) (D) (E) (F)(G) (H)(I) +.PP +The legend is as follows: +.br +(A) The terminal type known by screen for this display. +.br +(B) Displays geometry as width x height. +.br +(C) Username who is logged in at the display. +.br +(D) Device name of the display or the attached device +.br +(E) Display is in blocking or nonblocking mode. The available modes are "nb", "NB", +"Z<", "Z>", and "BL". +.br +(F) Number of the window +.br +(G) Name/title of window +.br +(H) Whether the window is shared +.br +(I) Window permissions. Made up of three characters: + (1st character) + ‘-’ : no read + ‘r’ : read + ‘R’ : read only due to foreign wlock + (2nd character) + ‘-’ : no write + ‘.’ : write suppressed by foreign wlock + ‘w’ : write + ‘W’ : own wlock + (3rd character) + ‘-’ : no execute + ‘x’ : execute + +\*QDisplays\*U needs a region size of at least 10 characters wide and 5 characters high in +order to display. .sp .ne 3 -.BR "digraph " [ \fIpreset ] +.BR "digraph " [ \fIpreset [ \fI unicode-value ] ] .PP This command prompts the user for a digraph sequence. The next two characters typed are looked up in a builtin table and the @@ -1644,6 +1805,11 @@ number instead. The optional argument is treated as user input, thus one can create an \*Qumlaut\*U key. For example the command "bindkey ^K digraph '"'" enables the user to generate an a-umlaut by typing CTRL-K a. +When a non-zero +.I unicode-value +is specified, a new digraph is created with the specified preset. The digraph is unset +if a zero value is provided for the +.I unicode-value. .sp .ne 3 .B dumptermcap @@ -1724,7 +1890,7 @@ Run a unix subprocess (specified by an executable path \fInewcommand\fP and its optional arguments) in the current window. The flow of data between newcommands stdin/stdout/stderr, the process originally started in the window (let us call it "application-process") and screen itself (window) is -controlled by the filedescriptor pattern fdpat. +controlled by the file descriptor pattern fdpat. This pattern is basically a three character sequence representing stdin, stdout and stderr of newcommand. A dot (.) connects the file descriptor to @@ -1837,6 +2003,21 @@ region respectively. Useful bindings are (j and k as in vi) bind t focus top bind b focus bottom .fi +Note that \fBk\fP is traditionally bound to the \fIkill\fP command. +.sp +.ne 3 +.BI "focusminsize [ ( " width "|max|_ ) ( " height "|max|_ ) ]" +.PP +This forces any currently selected region to be automatically +resized at least a certain \fIwidth\fP and \fIheight\fP. All +other surrounding regions will be resized in order to accommodate. +This constraint follows everytime the \*Qfocus\*U command is +used. The \*Qresize\*U command can be used to increase either +dimension of a region, but never below what is set with +\*Qfocusminsize\*U. The underscore `_' is a synonym for +\fBmax\fP. Setting a \fIwidth\fP and \fIheight\fP of `0 0' +(zero zero) will undo any constraints and allow for manual resizing. +Without any parameters, the minimum width and height is shown. .sp .ne 3 .BR "gr " [ on | off ] @@ -1848,6 +2029,15 @@ default (see also \*Qdefgr\*U) is not to process GR switching because otherwise the ISO88591 charset would not work. .sp .ne 3 +.BI group +.RI [ grouptitle ] +.PP +Change or show the group the current window belongs to. Windows can +be moved around between different groups by specifying the name of +the destination group. Without specifying a group, the title of the +current group is displayed. +.sp +.ne 3 .B hardcopy .RB [ -h ] .RI [ file ] @@ -1914,7 +2104,7 @@ If you prepend the word \*Qalways\*U to the type (e.g., \*Qalwayslastline\*U), will use the type even if the terminal supports a hardstatus. .P The third form specifies the contents of the hardstatus line. '%h' is -used as default string, i.e. the stored hardstatus of the current +used as default string, i.e., the stored hardstatus of the current window (settable via \*QESC]0;<string>^G\*U or \*QESC_<string>ESC\e\*U) is displayed. You can customize this to any string you like including the escapes from the \*QSTRING ESCAPES\*U chapter. If you leave out @@ -1986,14 +2176,14 @@ Sets a command that is run after the specified number of seconds inactivity is reached. This command will normally be the \*Qblanker\*U command to create a screen blanker, but it can be any screen command. If no command is specified, only the timeout is set. A timeout of -zero (ot the special timeout \fBoff\fP) disables the timer. +zero (or the special timeout \fBoff\fP) disables the timer. If no arguments are given, the current settings are displayed. .sp .ne 3 .BR "ignorecase " [ on | off ] .PP Tell screen to ignore the case of characters in searches. Default is -`off'. +`off'. Without any options, the state of ignorecase is toggled. .sp .ne 3 .B info @@ -2069,6 +2259,123 @@ away when you press a key (unless your terminal has a hardware status line). Refer to the commands \*Qmsgwait\*U and \*Qmsgminwait\*U for fine tuning. .sp .ne 3 +.BR "layout new " [\fItitle\fP] +.PP +Create a new layout. The screen will change to one whole region +and be switched to the blank window. From here, you build the +regions and the windows they show as you desire. The new layout +will be numbered with the smallest available integer, starting +with zero. You can optionally give a title to your new layout. +Otherwise, it will have a default title of \*Qlayout\*U. You +can always change the title later by using the command +\fBlayout title\fP. +.sp +.ne 3 +.BR "layout remove " [\fIn|title\fP] +.PP +Remove, or in other words, delete the specified layout. Either +the number or the title can be specified. Without either +specification, \fIscreen\fP will remove the current layout. + +Removing a layout does not affect your set windows or regions. +.sp +.ne 3 +.B layout next +.PP +Switch to the next layout available +.sp +.ne 3 +.B layout prev +.PP +Switch to the previous layout available +.sp +.ne 3 +.BR "layout select " [\fIn|title\fP] +.PP +Select the desired layout. Either the number or the title can +be specified. Without either specification, \fIscreen\fP will +prompt and ask which screen is desired. To see which layouts are +available, use the \fBlayout show\fP command. +.sp +.ne 3 +.B layout show +.PP +List on the message line the number(s) and title(s) of the available +layout(s). The current layout is flagged. +.sp +.ne 3 +.BR "layout title " [\fItitle\fP] +.PP +Change or display the title of the current layout. A string given +will be used to name the layout. Without any options, the current +title and number is displayed on the message line. +.sp +.ne 3 +.BR "layout number " [\fIn\fP] +.PP +Change or display the number of the current layout. An integer given +will be used to number the layout. Without any options, the current +number and title is displayed on the message line. +.sp +.ne 3 +.BR "layout attach " [\fItitle\fP|\fB:last\fP] +.PP +Change or display which layout to reattach back to. The default is +\fB:last\fP, which tells \fIscreen\fP to reattach back to the last +used layout just before detachment. By supplying a title, You can +instruct \fIscreen\fP to reattach to a particular layout regardless +which one was used at the time of detachment. Without any options, +the layout to reattach to will be shown in the message line. +.sp +.ne 3 +.BR "layout save " [\fIn|title\fP] +.PP +Remember the current arrangement of regions. When used, \fIscreen\fP +will remember the arrangement of vertically and horizontally split +regions. This arrangement is restored when a \fIscreen\fP session +is reattached or switched back from a different layout. If the +session ends or the \fIscreen\fP process dies, the layout +arrangements are lost. The \fBlayout dump\fP command should help +in this siutation. If a number +or title is supplied, \fIscreen\fP will remember the arrangement of +that particular layout. Without any options, \fIscreen\fP will +remember the current layout. + +Saving your regions can be done automatically by using the +\fBlayout autosave\fP command. +.sp +.ne 3 +.BR "layout autosave " [\fBon|off\fP] +.PP +Change or display the status of automatcally saving layouts. The +default is \fBon\fP, meaning when \fIscreen\fP is detached or +changed to a different layout, the arrangement of regions and windows +will be remembered at the time of change and restored upon return. +If autosave is set to \fBoff\fP, that arrangement will only be +restored to either to the last manual save, using \fBlayout save\fP, +or to when the layout was first created, to a single region with +a single window. Without either an \fBon\fP or \fBoff\fP, the +current status is displayed on the message line. +.sp +.ne 3 +.BR "layout dump " [\fIfilename\fP] +.PP +Write to a file the order of splits made in the current layout. This +is useful to recreate the order of your regions used in your current +layout. Only the current layout is recorded. While the order of the +regions are recorded, the sizes of those regions and which windows +correspond to which regions are not. If no filename is specified, +the default is \fIlayout-dump\fP, saved in the directory that the +\fIscreen\fP process was started in. If the file already exists, +\fBlayout dump\fP will append to that file. As an example: +.PP +.nf + C-a : layout dump /home/user/.screenrc +.fi +.PP +will save or append the layout to the user's \fI.screenrc\fP file. +.sp +.ne 3 .B license .PP Display the disclaimer page. This is done whenever @@ -2111,7 +2418,7 @@ Default is `off'. .br .BI "logfile flush " secs .PP -Defines the name the logfiles will get. The default is +Defines the name the log files will get. The default is \*Qscreenlog.%n\*U. The second form changes the number of seconds .I screen will wait before flushing the logfile buffer to the file-system. The @@ -2172,11 +2479,11 @@ Like mapdefault, but don't even look in the default bindkey table. .sp .ne 3 .B maptimeout -.RI [ timo ] +.RI [ timeout ] .PP Set the inter-character timer for input sequence detection to a timeout of -.I timo +.I timeout ms. The default timeout is 300ms. Maptimeout with no arguments shows the current setting. See also \*Qbindkey\*U. @@ -2202,7 +2509,8 @@ single statement. .BI "maxwin " num .PP Set the maximum window number screen will create. Doesn't affect -already existing windows. The number may only be decreased. +already existing windows. The number can be increased only when there are no +existing windows. .sp .ne 3 .B meta @@ -2220,6 +2528,18 @@ with an `@' in the window-status display. Monitoring is initially off for all windows. .sp .ne 3 +.BR "mousetrack " [ on | off ] +.PP +This command determines whether +.I screen +will watch for +mouse clicks. When this command is enabled, regions that have +been split in various ways can be selected by pointing to them +with a mouse and left-clicking them. Without specifying \fBon\fP +or \fBoff\fP, the current state is displayed. The default state +is determined by the \*Qdefmousetrack\*U command. +.sp +.ne 3 .BI "msgminwait " sec .PP Defines the time @@ -2260,7 +2580,8 @@ available if .I screen was compiled with the NETHACK flag defined. The default setting is then determined by the presence of the environment -variable $NETHACKOPTIONS. +variable $NETHACKOPTIONS and the file ~/.nethackrc - if either one is present, +the default is \fBon\fP. .sp .ne 3 .B next @@ -2284,11 +2605,12 @@ some time it restarts to accept characters, screen will unblock the display and redisplay the updated window contents. .sp .ne 3 -.BR "number " [ \fIn ] +.BR "number " [[+|-] \fIn ] .PP -Change the current windows number. If the given number \fIn\fP is already +Change the current window's number. If the given number \fIn\fP is already used by another window, both windows exchange their numbers. If no argument is -specified, the current window number (and title) is shown. +specified, the current window number (and title) is shown. Using `+' or `-' +will change the window's number by the relative amount specified. .sp .ne 3 .BR "obuflimit " [ \fIlimit ] @@ -2502,6 +2824,15 @@ Unlinks the screen-exchange file used by the commands \*Qwritebuf\*U and \*Qreadbuf\*U. .sp .ne 3 +.B "rendition bell" | monitor | silence | so +.RB "\fIattr\fR " [ \fIcolor ] +.PP +Change the way +.I screen +renders the titles of windows that have monitor or bell flags set in caption or hardstatus or windowlist. See the \*QSTRING ESCAPES\*U chapter for the syntax of the modifiers. +The default for monitor is currently \*Q=b \*U (bold, active colors), for bell \*Q=ub \*U (underline, bold and active colors), and \*Q=u \*U for silence. +.sp +.ne 3 .B "reset" .PP Reset the virtual terminal to its \*Qpower-on\*U values. Useful when strange @@ -2528,7 +2859,7 @@ resize min minimize current region height .PP .sp .ne 3 -.B "screen \fP[\fI-opts\fP] [\fIn\fP] [\fIcmd\fP [\fIargs\fP]]" +.B "screen \fP[\fI-opts\fP] [\fIn\fP] [\fIcmd\fP [\fIargs\fP]|\fB//group\fP]" .PP Establish a new window. The flow-control options (\fB\-f\fP, \fB\-fn\fP and \fB\-fa\fP), @@ -2537,11 +2868,14 @@ title (a.\|k.\|a.) option (\fB\-t\fP), login options (\fB-l\fP and \fB-ln\fP) and scrollback option (\fB-h\fP <num>) may be specified with each command. The option (\fB-M\fP) turns monitoring on for this window. The option (\fB-L\fP) turns output logging on for this window. -If an optional number \fIn\fP in the range 0..9 is given, the window -number \fIn\fP is assigned to the newly created window (or, if this -number is already in-use, the next available number). +If an optional number \fIn\fP in the range 0..MAXWIN-1 is given, +the window number \fIn\fP is assigned to the newly created window +(or, if this number is already in-use, the next available number). If a command is specified after \*Qscreen\*U, this command (with the given arguments) is started in the window; otherwise, a shell is created. +If \fB//group\fP is supplied, a container-type window is created in +which other windows may be created inside it. + Thus, if your \*Q.screenrc\*U contains the lines .sp .nf @@ -2571,8 +2905,9 @@ See also chapter \*QWINDOW TYPES\*U. .PP Set the size of the scrollback buffer for the current windows to \fInum\fP lines. The default scrollback is 100 lines. -See also the \*Qdefscrollback\*U command and use \*QC-a i\*U to view the -current setting. +See also the \*Qdefscrollback\*U command and use \*Qinfo\*U to view the +current setting. To access and use the contents in the scrollback buffer, +use the \*Qcopy\*U command. .sp .ne 3 .BR "select " [ \fIWindowID ] @@ -2585,7 +2920,7 @@ When a new window is established, the first available number is assigned to this window. Thus, the first window can be activated by \*Qselect 0\*U. The number of windows is limited at compile-time by the MAXWIN -configuration parameter. +configuration parameter (which defaults to 40). There are two special WindowIDs, \*Q-\*U selects the internal blank window and \*Q.\*U selects the current window. The latter is useful if used with screen's \*Q-X\*U option. @@ -2596,8 +2931,10 @@ latter is useful if used with screen's \*Q-X\*U option. Rename the current session. Note, that for \*Qscreen -list\*U the name shows up with the process-id prepended. If the argument \*Qname\*U is omitted, the name of this session is displayed. Caution: The $STY -environment variables still reflects the old name. This may result in -confusion. +environment variables will still reflect the old name in pre-existing +shells. This may result in confusion. Use of this command is generally +discouraged. Use the \*Q-S\*U command-line option if you want to +name a new session. The default is constructed from the tty and host names. .sp .ne 3 @@ -2689,19 +3026,17 @@ default screenrc files to have an effect. .B sorendition .RB [ "\fIattr\fR " [ \fIcolor ]] .PP -Change the way -.I screen -does highlighting for text marking and printing messages. -See the \*QSTRING ESCAPES\*U chapter for the syntax of the modifiers. -The default is currently \*Q=s dd\*U (standout, default colors). +This command is deprecated. See "rendition so" instead. .sp .ne 3 .B split +.RB [ -v ] .PP Split the current region into two new ones. All regions on the display are resized to make room for the new region. The blank -window is displayed on the new region. Use the \*Qremove\*U or the -\*Qonly\*U command to delete regions. +window is displayed on the new region. Splits are made horizontally +unless -v is used. Use the \*Qremove\*U or the \*Qonly\*U command +to delete regions. Use \*Qfocus\*U to toggle between regions. .sp .ne 3 .B "startup_message on\fP|\fBoff" @@ -2710,21 +3045,22 @@ Select whether you want to see the copyright notice during startup. Default is `on', as you probably noticed. .sp .ne 3 -.B stuff -.I string +.B stuff +.RB [ "\fIstring\fR" ] .PP Stuff the string .I string in the input buffer of the current window. This is like the \*Qpaste\*U command but with much less overhead. +Without a paramter, screen will prompt for a string to stuff. You cannot paste large buffers with the \*Qstuff\*U command. It is most useful for key bindings. See also \*Qbindkey\*U. .sp .ne 3 .B su -.RB [ username " [" password -.RB [ password2 ]] +.RI [ username " [" password +.RI [ password2 ]]] .PP Substitute the user of a display. The command prompts for all parameters that are omitted. If passwords are specified as parameters, they have to be @@ -2871,7 +3207,7 @@ man page for more information on termcap definitions. .PP Uses the message line to display the time of day, the host name, and the load averages over 1, 5, and 15 minutes (if this is available on your system). -For window specific information use \*Qinfo\*U. +For window specific information, use \*Qinfo\*U. If a string is specified, it changes the format of the time report like it is described in the \*QSTRING ESCAPES\*U chapter. Screen uses a default of @@ -2887,6 +3223,14 @@ prompts for one. This command was known as `aka' in previous releases. .sp .ne 3 +.BI "unbindall " +.PP +Unbind all the bindings. This can be useful when +screen is used solely for its detaching abilities, such as when +letting a console application run as a daemon. If, for some reason, +it is necessary to bind commands after this, use 'screen -X'. +.sp +.ne 3 .BI "unsetenv " var .PP Unset an environment variable. @@ -2926,7 +3270,7 @@ Sets the visual bell message. \fImessage\fP is printed to the status line if the window receives a bell character (^G), vbell is set to \*Qon\*U, but the terminal does not support a visual bell. The default message is \*QWuff, Wuff!!\*U. -Without parameter, the current message is shown. +Without a parameter, the current message is shown. .sp .ne 3 .BI "vbellwait " sec @@ -2941,7 +3285,7 @@ visual bell message. The default is 1 second. .PP If verbose is switched on, the command name is echoed, whenever a window is created (or resurrected from zombie state). Default is off. -Without parameter, the current setting is shown. +Without a parameter, the current setting is shown. .sp .ne 3 .B version @@ -2975,6 +3319,7 @@ vice versa. .B windowlist .RB [ -b ] .RB [ -m ] +.RB [ -g ] .br .B windowlist .B string @@ -2984,9 +3329,9 @@ vice versa. .B title .RI [ title ] .PP -Display all windows in a table for visual window selection. The -desired window can be selected via the standard movement keys (see -the \*Qcopy\*U command) and activated via the return key. +Display all windows in a table for visual window selection. +If screen was in a window group, screen will +back out of the group and then display the windows in that group. If the .B -b option is given, screen will switch to the blank window before @@ -2995,6 +3340,76 @@ The .B -m option changes the order of the windows, instead of sorting by window numbers screen uses its internal most-recently-used list. +The +.B -g +option will show the windows inside any groups in that level +and downwards. + +The following keys are used to navigate in \*Qwindowlist\*U: +.br +.in +4n +.ti -2n +\fBk\fP, \fBC-p\fP, or \fBup\fP Move up one line. +.br +.ti -2n +\fBj\fP, \fBC-n\fP, or \fBdown\fP Move down one line. +.br +.ti -2n +\fBC-g\fP or \fBescape\fP Exit windowlist. +.br +.ti -2n +\fBC-a\fP or \fBhome\fP Move to the first line. +.br +.ti -2n +\fBC-e\fP or \fBend\fP Move to the last line. +.br +.ti -2n +\fBC-u\fP or \fBC-d\fP Move one half page up or down. +.br +.ti -2n +\fBC-b\fP or \fBC-f\fP Move one full page up or down. +.br +.ti -2n +\fB0..9\fP Using the number keys, move to the selected line. +.br +.ti -2n +\fBmouseclick\fP Move to the selected line. Available when +\*Qmousetrack\*U is set to \*Qon\*U +.br +.ti -2n +\fB/\fP Search. +.br +.ti -2n +\fBn\fP Repeat search in the forward direction. +.br +.ti -2n +\fBN\fP Repeat search in the backward direction. +.br +.ti -2n +\fBm\fP Toggle MRU. +.br +.ti -2n +\fBg\fP Toggle group nesting. +.br +.ti -2n +\fBa\fP All window view. +.br +.ti -2n +\fBC-h\fP or backspace Back out the group. +.br +.ti -2n +\fB,\fP Switch numbers with the previous window. +.br +.ti -2n +\fB.\fP Switch numbers with the next window. +.br +.ti -2n +\fBK\fP Kill that window. +.br +.ti -2n +\fBspace\fP or \fBenter\fP Select that window. +.br +.in -4n The table format can be changed with the \fBstring\fP and \fBtitle\fP option, the title is displayed as table heading, while @@ -3003,6 +3418,9 @@ setting is \*QNum Name%=Flags\*U for the title and \*Q%3n %t%=%f\*U for the lines. See the \*QSTRING ESCAPES\*U chapter for more codes (e.g. color settings). + +\*QWindowlist\*U needs a region size of at least 10 characters wide +and 6 characters high in order to display. .sp .ne 3 .B windows @@ -3030,7 +3448,7 @@ When line-wrap is on, the second consecutive printable character output at the last column of a line will wrap to the start of the following line. As an added feature, backspace (^H) will also wrap through the left margin to the previous line. -Default is `on'. +Default is `on'. Without any options, the state of wrap is toggled. .sp .ne 3 .B writebuf @@ -3091,7 +3509,7 @@ via the second and the third form. Note also that this is an experimental feature. .sp .ne 3 -.BR "zombie " [\fIkeys\fP] +.BR "zombie " [\fIkeys\fP [ onerror ] ] .br .BR "defzombie " [\fIkeys\fP] .PP @@ -3113,6 +3531,10 @@ As the zombie-setting is manipulated globally for all windows, this command should only be called \fBdefzombie\fP. Until we need this as a per window setting, the commands \fBzombie\fP and \fBdefzombie\fP are synonymous. +Optionally you can put the word \*Qonerror\*U after the keys. This will cause screen +to monitor exit status of the process running in the window. If it exits normally ('0'), +the window disappears. Any other exit value causes the window to become a zombie. + .SH "THE MESSAGE LINE" .I Screen displays informational messages and other diagnostics in a \fImessage line\fP. @@ -3172,14 +3594,14 @@ Usually 300, 1200, 9600 or 19200. This affects transmission as well as receive s Specify the transmission of eight (or seven) bits per byte. .IP "ixon or -ixon" Enables (or disables) software flow-control (CTRL-S/CTRL-Q) for sending data. -.IP "ixoff or -ixon" +.IP "ixoff or -ixoff" Enables (or disables) software flow-control for receiving data. .IP "istrip or -istrip" Clear (or keep) the eight bit in each received byte. .PP You may want to specify as many of these options as applicable. Unspecified options cause the terminal driver to make up the parameter values of the -connection. These values are system dependant and may be in defaults or values +connection. These values are system dependent and may be in defaults or values saved from a previous connection. .PP For tty windows, the @@ -3192,13 +3614,12 @@ Signals that are logical low (inactive) have their name preceded by an exclamation mark (!), otherwise the signal is logical high (active). Signals not supported by the hardware but available to the ioctl() interface are usually shown low. -.br +.PP When the CLOCAL status bit is true, the whole set of modem signals is placed inside curly braces ({ and }). When the CRTSCTS or TIOCSOFTCAR bit is set, the signals `CTS' or `CD' are shown in parenthesis, respectively. - - +.PP For tty windows, the command .B break causes the Data transmission line (TxD) to go low for a specified period of @@ -3207,6 +3628,7 @@ No data is sent and no modem control line is changed when a .B break is issued. .RE + .IP \(bu If the first parameter is \*Q//telnet\*U, the second parameter is expected to be a host name, and an optional third parameter may specify a TCP port number @@ -3271,7 +3693,7 @@ day number .IP D weekday name .IP f -flags of the window +flags of the window, see \*Qwindows\*U for meanings of the various flags .IP F sets %? to true if the window has the focus .IP h @@ -3286,6 +3708,10 @@ month number month name .IP n window number +.IP P +sets %? to true if the current region is in copy/paste mode +.IP S +session name .IP s seconds .IP t @@ -3293,7 +3719,7 @@ window title .IP u all other users on this window .IP w -all window numbers and names. With '-' quailifier: up to the current +all window numbers and names. With '-' qualifier: up to the current window; with '+' qualifier: starting with the window after the current one. .IP W @@ -3345,7 +3771,7 @@ An attribute/color modifier is is used to change the attributes or the color settings. Its format is \*Q[attribute modifier] [color description]\*U. The attribute modifier must be prefixed by a change type indicator if it can be confused with -a color desciption. The following change types are known: +a color description. The following change types are known: .IP + add the specified set to the current attributes .IP - @@ -3403,14 +3829,14 @@ use the pseudo-color 'i' to set just the brightness and leave the color unchanged. .br A one digit/letter color description is treated as foreground or -background color dependant on the current attributes: if reverse mode is +background color dependent on the current attributes: if reverse mode is set, the background color is changed instead of the foreground color. If you don't like this, prefix the color with a \*Q.\*U. If you want -the same behaviour for two-letter color descriptions, also prefix them +the same behavior for two-letter color descriptions, also prefix them with a \*Q.\*U. .br As a special case, \*Q%{-}\*U restores the attributes and colors that -were set before the last change was made (i.e. pops one level of the +were set before the last change was made (i.e., pops one level of the color-change stack). .PP Examples: @@ -3616,7 +4042,7 @@ up to 8. Bash users will probably want to echo the escape sequence in the PROMPT_COMMAND: .IP -PROMPT_COMMAND='echo -n -e "\e033k\e033\e134"' +PROMPT_COMMAND='printf "\e033k\e033\e134"' .PP (I used \*Q\134\*U to output a `\e' because of a bug in bash v1.04). @@ -4329,7 +4755,7 @@ The things in braces may be repeated any number of times. A \fI<charset-mapping>\fP tells .I screen how to map characters -in font \fI<designator>\fP ('B': Ascii, 'A': UK, 'K': german, etc.) +in font \fI<designator>\fP ('B': Ascii, 'A': UK, 'K': German, etc.) to strings. Every \fI<mapping>\fP describes to what string a single character will be translated. A template mechanism is used, as most of the time the codes have a lot in common (for example @@ -4349,7 +4775,7 @@ This tells .I screen how to translate ISOlatin1 (charset 'B') upper case umlaut characters on a hp700 terminal that has a -german charset. '\e304' gets translated to '\eE(K[\eE(B' and so on. +German charset. '\e304' gets translated to '\eE(K[\eE(B' and so on. Note that this line gets parsed *three* times before the internal lookup table is built, therefore a lot of quoting is needed to create a single '\e'. @@ -4367,7 +4793,7 @@ This example shows one use of the extension: termcap xterm 'XC=K%,%\eE(B,[\e304,\e\e\e\e\e326,]\e334' -Here, a part of the german ('K') charset is emulated on an xterm. +Here, a part of the German ('K') charset is emulated on an xterm. If .I screen has to change to the 'K' charset, '\eE(B' will be sent @@ -4454,10 +4880,19 @@ termcap(5), utmp(5), vi(1), captoinfo(1), tic(1) .SH AUTHORS Originally created by Oliver Laumann, this latest version was -produced by Wayne Davison, Juergen Weigert and Michael Schroeder. +produced by Juergen Weigert, Michael Schroeder, Micah Cowan and +Sadrul Habib Chowdhury. .SH COPYLEFT .nf +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-2003 Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de) Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de) @@ -4466,7 +4901,7 @@ Copyright (C) 1987 Oliver Laumann .PP This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) +the Free Software Foundation; either version 3, or (at your option) any later version. .PP This program is distributed in the hope that it will be useful, @@ -4512,7 +4947,7 @@ Pablo Averbuj (pablo@averbuj.com). .SH VERSION -This is version 4.0.2. Its roots are a merge of a custom version +This is version 4.1.0. Its roots are a merge of a custom version 2.3PR7 by Wayne Davison and several enhancements to Oliver Laumann's version 2.0. Note that all versions numbered 2.x are copyright by Oliver Laumann. diff --git a/doc/screen.texinfo b/src/doc/screen.texinfo index 408305a..08ca259 100644 --- a/doc/screen.texinfo +++ b/src/doc/screen.texinfo @@ -7,7 +7,7 @@ @finalout @setchapternewpage odd @c %**end of header -@set version 4.0.2 +@set version 4.1.0 @direntry * Screen: (screen). Full-screen window manager. @@ -15,7 +15,7 @@ @c For examples, use a literal escape in info. @ifinfo -@set esc +@set esc ^[ @end ifinfo @iftex @set esc <ESC> @@ -73,6 +73,9 @@ except that this permission notice may be stated in a translation approved by the Foundation. @end titlepage +@shortcontents +@contents + @node Top, Overview, (dir), (dir) @ifinfo @@ -175,6 +178,9 @@ run another copy of @code{screen}, but will instead supply the command name and its arguments to the window manager (specified in the $STY environment variable) who will use it to create the new window. The above example would start the @code{emacs} editor (editing @file{prog.c}) and switch to its window. +- Note that you cannot transport environment variables from +the invoking shell to the application (emacs in this case), because it is +forked from the parent screen process, not from the invoking shell. If @file{/etc/utmp} is writable by @code{screen}, an appropriate record will be written to this file for each window, and removed when the @@ -344,12 +350,20 @@ This also starts @code{screen} in @emph{detached} mode, but doesn't fork a new process. The command exits if the session terminates. @end table -@item -p @var{name_or_number} -Preselect a window. This is usefull when you want to reattach to a -specific windor or you want to send a command via the @samp{-X} -option to a specific window. As with screen's select commant, @samp{-} +@item -O +Select a more optimal output mode for your terminal rather than true VT100 +emulation (only affects auto-margin terminals without @samp{LP}). This +can also be set in your @file{.screenrc} by specifying @samp{OP} in the +@code{termcap} command. + +@item -p @var{name_or_number}|-|=|+ +Preselect a window. This is useful when you want to reattach to a +specific window or you want to send a command via the @samp{-X} +option to a specific window. As with screen's select command, @samp{-} selects the blank window. As a special case for reattach, @samp{=} -brings up the windowlist on the blank window. +brings up the windowlist on the blank window, while a @samp{+} will +create new window. The command will not be executed if the specified +window could not be found. @item -q Suppress printing of error messages. In combination with @samp{-ls} the exit @@ -361,6 +375,23 @@ there is no session to resume. 12 (or more) indicates that there are 2 (or more) sessions to resume and you should specify which one to choose. In all other cases @samp{-q} has no effect. +@item -Q +Some commands now can be queried from a remote session using this +flag, e.g. 'screen -Q windows'. The commands will send the +response to the stdout of the querying process. If there was an +error in the command, then the querying process will exit with +a non-zero status. + +The commands that can be queried now are: + @code{echo} + @code{info} + @code{lastmsg} + @code{number} + @code{select} + @code{time} + @code{title} + @code{windows} + @item -r [@var{pid.sessionname}] @itemx -r @var{sessionowner}/[@var{pid.sessionname}] Resume a detached @code{screen} session. No other options (except @@ -400,6 +431,10 @@ Set the title (name) for the default shell or specified program. This option is equivalent to the @code{shelltitle} command (@pxref{Shell}). +@item -T @var{term} +Set the $TERM enviroment varible using the spcified @emph{term} as +opposed to the defualt setting of @code{screen}. + @item -U Run screen in UTF-8 mode. This option tells screen that your terminal sends and understands UTF-8 encoded characters. It also sets the default @@ -417,7 +452,10 @@ See the @code{-r} flag for a description how to construct matches. @item -x Attach to a session which is already attached elsewhere (multi-display -mode). +mode). +@code{Screen} refuses to attach from within itself. +But when cascading multiple screens, loops are not detected; take care. + @item -X Send the specified command to a running screen session. You can use @@ -617,7 +655,7 @@ Cycle flow among @samp{on}, @samp{off} or @samp{auto}. @xref{Flow}. @item @kbd{C-a F} (fit)@* -Resize the window to the current region size. @xref{Window Size}. +Resize the window to the current region size. @xref{Fit}. @item @kbd{C-a C-g} (vbell)@* @@ -702,7 +740,7 @@ Send a ^S (ASCII XOFF) to the current window. @xref{XON/XOFF}. @item @kbd{C-a S} (split)@* -Split the current region into two new ones. @xref{Regions}. +Split the current region horizontally into two new ones. @xref{Regions}. @item @kbd{C-a t} @itemx @kbd{C-a C-t} @@ -794,15 +832,19 @@ Delete the screen-exchange file. @xref{Screen Exchange}. @item @kbd{C-a _} (silence)@* -Start/stop monitoring the current window for inactivity. @xref{Silence}, +Start/stop monitoring the current window for inactivity. @xref{Monitor}. + +@item @kbd{C-a |} +(split -v)@* +Split the current region vertically into two new ones. @xref{Regions}. @item @kbd{C-a ,} (license)@* -Show the copyright page. +Show the copyright page. @xref{License}. @item @kbd{C-a *} (displays)@* -Show the listing of attached displays. +Show the listing of attached displays. @xref{Displays}. @end table @node Command Summary, , Default Key Bindings, Commands @@ -912,6 +954,8 @@ Select default utmp logging behavior. @xref{Login}. Select default file mode for ptys. @xref{Mode}. @item defmonitor @var{state} Select default activity monitoring behavior. @xref{Monitor}. +@item defmousetrack @var{on}|@var{off} +Select the default mouse tracking behavior. @xref{Mousetrack}. @item defnonblock @var{state}|@var{numsecs} Select default nonblock mode. @xref{Nonblock}. @item defobuflimit @var{limit} @@ -921,7 +965,7 @@ Set default lines of scrollback. @xref{Scrollback}. @item defshell @var{command} Set the default program for new windows. @xref{Shell}. @item defsilence @var{state} -Select default idle monitoring behavior. @xref{Silence}. +Select default idle monitoring behavior. @xref{Monitor}. @item defslowpaste @var{msec} Select the default inter-character timeout when pasting. @xref{Paste}. @item defutf8 @var{state} @@ -934,8 +978,8 @@ Set default writelock behavior. @xref{Multiuser Session}. Keep dead windows. @xref{Zombie}. @item detach [-h] Disconnect @code{screen} from the terminal. @xref{Detach}. -@item digraph -Enter digraph sequence. @xref{Digraph}. +@item digraph [@var{preset} [@var{unicode-value}]] +Enter a digraph sequence. @xref{Digraph}. @item dinfo Display terminal information. @xref{Info}. @item displays @@ -958,8 +1002,12 @@ Change window size to current display size. @xref{Window Size}. Set flow control behavior. @xref{Flow}. @item focus Move focus to next region. @xref{Regions}. +@item focusminsize +Force the current region to a certain size. @xref{Focusminsize}. @item gr [@var{state}] Change GR charset processing. @xref{Character Processing}. +@item group [@var{grouptitle}] +Change or show the group the current window belongs to. @xref{Window Groups}. @item hardcopy [-h] [@var{file}] Write out the contents of the current window. @xref{Hardcopy}. @item hardcopy_append @var{state} @@ -978,7 +1026,7 @@ Find previous command beginning @dots{}. @xref{History}. Change the window's hardstatus line. @xref{Hardstatus}. @item idle [@var{timeout} [@var{cmd} @var{args}]] Define a screen saver command. @xref{Screen Saver}. -@item ignorecase [@var{state}] +@item ignorecase [on|off] Ignore character case in searches. @xref{Searching}. @item info Display window settings. @xref{Info}. @@ -988,6 +1036,30 @@ Removed, use @code{paste} instead. @xref{Registers}. Destroy the current window. @xref{Kill}. @item lastmsg Redisplay the last message. @xref{Last Message}. +@item layout new [@var{title}] +Create a layout. @xref{Layout}. +@item layout remove [@var{n}|@var{title}] +Delete a layout. @xref{Layout}. +@item layout next +Select the next layout. @xref{Layout}. +@item layout prev +Select the previous layout. @xref{Layout}. +@item layout select [@var{n}|@var{title}] +Jump to a layout. @xref{Layout}. +@item layout show +List the available layouts. @xref{Layout}. +@item layout title [@var{title}] +Show or set the title of a layout. @xref{Layout}. +@item layout number [@var{n}] +Show or set the number of a layout. @xref{Layout}. +@item layout attach [@var{title}|:last] +Show or set which layout to reattach to. @xref{Layout}. +@item layout save [@var{n}|@var{title}] +Remember the organization of a layout. @xref{Layout}. +@item layout autosave [@var{on}|@var{off}] +Show or set the status of layout saving. @xref{Layout}. +@item layout dump [filename] +Save the layout arrangement to a file. @xref{Layout}. @item license Display licensing information. @xref{Startup}. @item lockscreen @@ -1004,7 +1076,7 @@ Configure logfile time-stamps. @xref{Log}. Use only the default mapping table for the next keystroke. @xref{Bindkey Control}. @item mapnotnext Don't try to do keymapping on the next keystroke. @xref{Bindkey Control}. -@item maptimeout @var{timo} +@item maptimeout @var{n} Set the inter-character timeout used for keymapping. @xref{Bindkey Control}. @item markkeys @var{string} Rebind keys in copy mode. @xref{Copy Mode Keys}. @@ -1014,6 +1086,8 @@ Set the maximum window number. @xref{Maxwin}. Insert the command character. @xref{Command Character}. @item monitor [@var{state}] Monitor activity in window. @xref{Monitor}. +@item mousetrack [@var{on}|@var{off}] +Enable selecting split regions with mouse clicks. @xref{Mousetrack}. @item msgminwait @var{sec} Set minimum message wait. @xref{Message Wait}. @item msgwait @var{sec} @@ -1068,15 +1142,17 @@ Store a string to a register. @xref{Registers}. Kill current region. @xref{Regions}. @item removebuf Delete the screen-exchange file. @xref{Screen Exchange}. +@item rendition bell | monitor | silence | so @var{attr} [@var{color}] +Change text attributes in caption for flagged windows. @xref{Rendition}. @item reset Reset the terminal settings for the window. @xref{Reset}. @item resize [(+/-)lines] Grow or shrink a region -@item screen [@var{opts}] [@var{n}] [@var{cmd} [@var{args}]] +@item screen [@var{opts}] [@var{n}] [@var{cmd} [@var{args}] | //group] Create a new window. @xref{Screen Command}. @item scrollback @var{num} Set size of scrollback buffer. @xref{Scrollback}. -@item select [@var{n}] +@item select [@var{n}|-|.] Switch to a specified window. @xref{Selecting}. @item sessionname [@var{name}] Name this session. @xref{Session Name}. @@ -1089,9 +1165,9 @@ Set the default program for new windows. @xref{Shell}. @item shelltitle @var{title} Set the default name for new windows. @xref{Shell}. @item silence [@var{state}|@var{seconds}] -Monitor a window for inactivity. @xref{Silence}. +Monitor a window for inactivity. @xref{Monitor}. @item silencewait @var{seconds} -Default timeout to trigger an inactivity notify. @xref{Silence}. +Default timeout to trigger an inactivity notify. @xref{Monitor}. @item sleep @var{num} Pause during startup. @xref{Startup}. @item slowpaste @var{msec} @@ -1099,12 +1175,12 @@ Slow down pasting in windows. @xref{Paste}. @item source @var{file} Run commands from a file. @xref{Source}. @item sorendition [@var{attr} [@var{color}]] -Change text highlighting. @xref{Sorendition}. +Deprecated. Use @code{rendition so} instead. @xref{Rendition}. @item split Split region into two parts. @xref{Regions}. @item startup_message @var{state} Display copyright notice on startup. @xref{Startup}. -@item stuff @var{string} +@item stuff [@var{string}] Stuff a string in the input buffer of a window. @xref{Paste}. @item su [@var{username} [@var{password} [@var{password2}]]] Identify a user. @xref{Multiuser Session}. @@ -1124,6 +1200,8 @@ Display time and load average. @xref{Time}. Set the name of the current window. @xref{Title Command}. @item umask [@var{users}]+/-@var{bits} ... Synonym to @code{aclumask}. @xref{Umask}. +@item unbindall +Unset all keybindings. @xref{Bind}. @item unsetenv @var{var} Unset environment variable for new windows. @xref{Setenv}. @item utf8 [@var{state} [@var{dstate}]] @@ -1140,11 +1218,11 @@ Display @code{screen} version. @xref{Version}. Write a message to all displays. @xref{Multiuser Session}. @item width [@var{cols} [@var{lines}]] Set the width of the window. @xref{Window Size}. -@item windowlist [-b] | string [@var{string}] | title [@var{title}] +@item windowlist [[-b] [-m] [-g]] | string [@var{string}] | title [@var{title}] Present a list of all windows for selection. @xref{Windowlist}. @item windows List active windows. @xref{Windows}. -@item wrap [@var{state}] +@item wrap [ on | off ] Control line-wrap behavior. @xref{Wrap}. @item writebuf [-e @var{encoding}] [@var{filename}] Write paste buffer to screen-exchange file. @xref{Screen Exchange}. @@ -1156,7 +1234,7 @@ Send an XOFF character. @xref{XON/XOFF}. Send an XON character. @xref{XON/XOFF}. @item zmodem [off|auto|catch|pass] Define how screen treats zmodem requests. @xref{Zmodem}. -@item zombie [@var{keys}] +@item zombie [@var{keys} [onerror] ] Keep dead windows. @xref{Zombie}. @end table @@ -1165,9 +1243,9 @@ Keep dead windows. @xref{Zombie}. This section describes the commands for creating a new window for running programs. When a new window is created, the first available -number from the range 0@dots{}9 is assigned to it. +number is assigned to it. The number of windows is limited at compile-time by the MAXWIN -configuration parameter. +configuration parameter (which defaults to 40). @menu * Chdir:: Change the working directory for new windows. @@ -1176,6 +1254,7 @@ configuration parameter. * Shell:: Parameters for shell windows. * Term:: Set the terminal type for new windows. * Window Types:: Creating different types of windows. +* Window Groups:: Grouping windows together @end menu @node Chdir, Screen Command, , New Window @@ -1200,7 +1279,7 @@ affect all the windows you create interactively. @section Screen Command @kindex c @kindex C-c -@deffn Command screen [opts] [n] [cmd [args]] +@deffn Command screen [opts] [n] [cmd [args] @var{| //group}] (@kbd{C-a c}, @kbd{C-a C-c})@* Establish a new window. The flow-control options (@samp{-f}, @samp{-fn} and @samp{-fa}), title option (@samp{-t}), login options @@ -1209,11 +1288,13 @@ the all-capability-flag (@samp{-a}) and scrollback option (@samp{-h @var{num}}) may be specified with each command. The option (@samp{-M}) turns monitoring on for this window. The option (@samp{-L}) turns output logging on for this window. -If an optional number @var{n} in the range 0@dots{}9 is given, +If an optional number @var{n} in the range 0@dots{}MAXWIN-1 is given, the window number @var{n} is assigned to the newly created window (or, if this number is already in-use, the next available number). If a command is specified after @code{screen}, this command (with the given arguments) is started in the window; otherwise, a shell is created. +If @samp{//group} is supplied, a container-type window is created in +which other windows may be created inside it. @xref{Window Groups}. Screen has built in some functionality of @samp{cu} and @samp{telnet}. @xref{Window Types}. @@ -1289,7 +1370,7 @@ the next @code{screen rlogin othermachine} command. Use the command and resetting the default. @end deffn -@node Window Types, , Term, New Window +@node Window Types, Window Groups, Term, New Window @section Window Types @cindex window types Screen provides three different window types. New windows are created @@ -1332,7 +1413,7 @@ Clear (or keep) the eight bit in each received byte. You may want to specify as many of these options as applicable. Unspecified options cause the terminal driver to make up the parameter -values of the connection. These values are system dependant and may be +values of the connection. These values are system-dependent and may be in defaults or values saved from a previous connection. For tty windows, the @code{info} command shows some of the modem @@ -1389,6 +1470,37 @@ For telnet windows, the command @code{break} sends the telnet code @end itemize +@node Window Groups, , Window Types, New Window +@section Window Groups +@cindex window groups +Screen provides a method for grouping windows together. Windows can be +organized in a hierarchical fashion, resembling a tree structure. New +screens are created using the @code{screen} command while new groups +are created using @code{screen //group}. @xref{Screen Command}. + +Once a new group is created, it will act as a container for windows +and even other groups. When a group is selected, you will see the +output of the @code{windowlist} command, allowing you to select a +window inside. If there are no windows inside a group, use the +@code{screen} command to create one. Once inside a group, using the +commands @code{next} and @code{prev} will switch between windows only +in that group. Using the @code{windowlist} command will give you the +opportunity to leave the group you are in. @xref{Windowlist}. + +@deffn Command group [grouptitle] +(none)@* +Change or show the group the current window belongs to. Windows can +be moved around between different groups by specifying the name of +the destination group. Without specifying a group, the title of the +current group is displayed. +@end deffn + +Using groups in combination with layouts will help create a +multi-desktop experience. One group can be assigned for each +layout made. Windows can be made, split, and organized within each +group as desired. Afterwhich, switching between groups can be as easy +as switching layouts. + @node Selecting, Session Management, New Window, Top @chapter Selecting a Window @@ -1418,8 +1530,10 @@ pressing space.) @kindex p @kindex C-p +@kindex C-h +@kindex Backspace @deffn Command prev -(@kbd{C-a p}, @kbd{C-a C-p})@* +(@kbd{C-a p}, @kbd{C-a C-p}, @kbd{C-a C-h}, @kbd{C-a @key{Backspace}})@* Switch to the previous window (the opposite of @kbd{C-a n}). @end deffn @@ -1438,7 +1552,7 @@ this command becomes @kbd{]]} (@pxref{Command Character}). @section Select @kindex 0@dots{}9 @kindex ' -@deffn Command select [n] +@deffn Command select [n @var{|-|.}] (@kbd{C-a @var{n}}, @kbd{C-a '})@* Switch to the window with the number @var{n}. If no window number is specified, you get prompted for an @@ -1458,19 +1572,83 @@ current window. The latter is useful if used with screen's @node Windowlist, , Select, Selecting @section Windowlist @kindex " -@deffn Command windowlist [-b] [-m] +@deffn Command windowlist [-b] [-m] [-g] @deffnx Command windowlist string [@var{string}] @deffnx Command windowlist title [@var{title}] (@kbd{C-a "})@* Display all windows in a table for visual window selection. -The desired window can be selected via the standard -movement keys (@pxref{Movement}) and activated via -the return key. If the @code{-b} option is given, screen will +If screen was in a window group, screen will +back out of the group and then display the windows in that +group. If the @code{-b} option is given, screen will switch to the blank window before presenting the list, so that the current window is also selectable. The @code{-m} option changes the order of the windows, instead of sorting by window numbers screen uses its internal most-recently-used -list. +list. The @code{-g} option will show the windows inside any groups +in that level and downwards. + +The following keys are used to navigate in @code{windowlist}: + +@noindent +@kbd{k}, @kbd{C-p}, or @kbd{up} Move up one line. + +@noindent +@kbd{j}, @kbd{C-n}, or @kbd{down} Move down one line. + +@noindent +@kbd{C-g} or @kbd{escape} Exit windowlist. + +@noindent +@kbd{C-a} or @kbd{home} Move to the first line. + +@noindent +@kbd{C-e} or @kbd{end} Move to the last line. + +@noindent +@kbd{C-u} or @kbd{C-d} Move one half page up or down. + +@noindent +@kbd{C-b} or @kbd{C-f} Move one full page up or down. + +@indent +@kbd{0..9} Using the number keys, move to the selected line. + +@noindent +@kbd{mouseclick} Move to the selected line. Available when +@code{mousetrack} is set to @code{on}. + +@noindent +@kbd{/} Search. + +@noindent +@kbd{n} Repeat search in the forward direction. + +@noindent +@kbd{N} Repeat search in the backward direction. + +@noindent +@kbd{m} Toggle MRU. + +@noindent +@kbd{g} Toggle group nesting. + +@noindent +@kbd{a} All window view. + +@noindent +@kbd{C-h} or @kbd{backspace} Back out the group. + +@noindent +@kbd{,} Switch numbers with the previous window. + +@noindent +@kbd{.} Switch numbers with the next window. + +@noindent +@kbd{K} Kill that window. + +@noindent +@kbd{space} or @kbd{enter} Select that window. The table format can be changed with the string and title option, the title is displayed as table heading, while the @@ -1479,6 +1657,8 @@ setting is @samp{Num Name%=Flags} for the title and @samp{%3n %t%=%f} for the lines. See the string escapes chapter (@pxref{String Escapes}) for more codes (e.g. color settings). +@code{Windowlist} needs a region size of at least 10 characters +wide and 6 characters high in order to display. @end deffn @node Session Management, Regions, Selecting, Top @@ -1552,7 +1732,7 @@ logout if @code{screen} was started from your login shell. The @var{message} specified here is output whenever a power detach is performed. It may be used as a replacement for a logout message or to reset baud rate, etc. -Without parameter, the current message is shown. +Without a parameter, the current message is shown. @end deffn @node Lock, Multiuser Session, Power Detach, Session Management @@ -1679,6 +1859,82 @@ all groups the user is in are listed. Shows a tabular listing of all currently connected user front-ends (displays). This is most useful for multiuser sessions. + +The following keys can be used in @code{displays} list: + +@noindent +@kbd{k}, @kbd{C-p}, or @kbd{up} Move up one line. + +@noindent +@kbd{j}, @kbd{C-n}, or @kbd{down} Move down one line. + +@noindent +@kbd{C-a} or @kbd{home} Move to the first line. + +@noindent +@kbd{C-e} or @kbd{end} Move to the last line. + +@noindent +@kbd{C-u} or @kbd{C-d} Move one half page up or down. + +@noindent +@kbd{C-b} or @kbd{C-f} Move one full page up or down. + +@noindent +@kbd{mouseclick} Move to the selected line. Available when +@code{mousetrack} is set to @code{on}. + +@noindent +@kbd{space} Refresh the list. + +@noindent +@kbd{d} Detach the selected display. + +@noindent +@kbd{D} Power detach the selected display. + +@noindent +@kbd{C-g}, @kbd{enter}, or @kbd{escape} Exit the list. + + +The following is an example of what @code{displays} could +look like: + +@example +xterm 80x42 jnweiger@@/dev/ttyp4 0(m11) &rWx +facit 80x24 mlschroe@@/dev/ttyhf nb 11(tcsh) rwx +xterm 80x42 jnhollma@@/dev/ttyp5 0(m11) &R.x + (A) (B) (C) (D) (E) (F)(G) (H)(I) +@end example + +The legend is as follows: +@*(A) The terminal type known by @code{screen} for this display. +@*(B) Displays geometry as width x height. +@*(C) Username who is logged in at the display. +@*(D) Device name of the display or the attached device +@*(E) Display is in blocking or nonblocking mode. The available + modes are "nb", "NB", "Z<", "Z>", and "BL". +@*(F) Number of the window +@*(G) Name/title of window +@*(H) Whether the window is shared +@*(I) Window permissions. Made up of three characters: +@display +(1st character) + @samp{-} : no read + @samp{r} : read + @samp{R} : read only due to foreign wlock +(2nd character) + @samp{-} : no write + @samp{.} : write suppressed by foreign wlock + @samp{w} : write + @samp{W} : own wlock +(3rd character) + @samp{-} : no execute + @samp{x} : execute +@end display + +@code{Displays} needs a region size of at least 10 characters +wide and 5 characters high in order to display. @end deffn @node Umask, Wall, Displays, Multiuser Session @@ -1755,8 +2011,11 @@ Rename the current session. Note that for @code{screen -list} the name shows up with the process-id prepended. If the argument @var{name} is omitted, the name of this session is displayed.@* @emph{Caution}: The @code{$STY} -environment variable still reflects the old name. This may result in -confusion. The default is constructed from the tty and host names. +environment variable will still reflect the old name in pre-existing +shells. This may result in +confusion. Use of this command is generally +discouraged. Use the @code{-S} command-line option if you want to +name a new session.The default is constructed from the tty and host names. @end deffn @node Suspend, Quit, Session Name, Session Management @@ -1797,16 +2056,27 @@ which can contain different windows. * Resize:: Grow or shrink a region * Caption:: Control the window's caption * Fit:: Resize a window to fit the region +* Focusminsize:: Force a minimum size on a current region +* Layout:: Manage groups of regions @end menu @node Split, Focus, , Regions @section Split @kindex S -@deffn Command split -(@kbd{C-a S})@* +@kindex | +@deffn Command split [-v] +(@kbd{C-a S}, @kbd{C-a |})@* Split the current region into two new ones. All regions on the display are resized to make room for the new region. The blank -window is displayed on the new region. +window is displayed on the new region. The default is to create +a horizontal split, putting the new regions on the top and +bottom of each other. Using -v will create a vertical split, +causing the new regions to appear side by side of each other. + +With this current implementation of @code{screen}, scrolling data +will appear much slower in a vertically split region than one +that is not. This should be taken into consideration if you need +to use system commands such as @code{cat} or @code{tail -f}. @end deffn @node Focus, Only, Split, Regions @@ -1879,7 +2149,7 @@ You can mix both forms by providing the string as an additional argument. @end deffn -@node Fit, , Caption, Regions +@node Fit, Focusminsize, Caption, Regions @section Fit @kindex F @deffn Command fit @@ -1889,6 +2159,154 @@ command is needed because screen doesn't adapt the window size automatically if the window is displayed more than once. @end deffn +@node Focusminsize, Layout, Fit, Regions +@section Focusminsize +@deffn Command focusminsize [ (width|@code{max}|@code{_}) (height|@code{max}|@code{_}) ] +(none)@* +This forces any currently selected region to be automatically +resized at least a certain @var{width} and @var{height}. All +other surrounding regions will be resized in order to accommodate. +This constraint follows every time the @code{focus} command is +used. The @code{resize} command can be used to increase either +dimension of a region, but never below what is set with +@code{focusminsize}. The underscore @samp{_} is a synonym for +@code{max}. Setting a @var{width} and @var{height} of @code{0 0} +(zero zero) will undo any constraints and allow for manual resizing. +Without any parameters, the minimum width and height is shown. +@end deffn + +@node Layout, , Focusminsize, Regions +@section Layout +@cindex layout +Using regions, and perhaps a large enough terminal, you can give +@code{screen} more of a desktop feel. By being able to split +regions horizontally or vertically, you can take advantage of the +lesser used spaces of your terminal. The catch to these splits has +been that they're not kept between screen detachments and reattachments. + +Layouts will help organize your regions. You can create one +layout of four horizontal regions and then create a separate layout +of regions in a two by two array. The regions could contain the same windows, +but they don't have to. You can easily switch between layouts and keep +them between detachments and reattachments. + +Note that there are several subcommands to @code{layout}. + +@deffn Command layout @code{new} [title] +(none)@* +Create a new layout. The screen will change to one whole region +and be switched to the blank window. From here, you build the +regions and the windows they show as you desire. The new layout +will be numbered with the smallest available integer, starting +with zero. You can optionally give a title to your new layout. +Otherwise, it will have a default title of @code{layout}. You +can always change the title later by using the command +@code{layout title}. +@end deffn + +@deffn Command layout @code{remove} [n|title] +(none)@* +Remove, or in other words, delete the specified layout. Either +the number or the title can be specified. Without either +specification, @code{screen} will remove the current layout. + +Removing a layout does not affect your set windows or regions. +@end deffn + +@deffn Command layout @code{next} +(none)@* +Switch to the next layout available +@end deffn + +@deffn Command layout @code{prev} +(none)@* +Switch to the previous layout available +@end deffn + +@deffn Command layout @code{select} [n|title] +(none)@* +Select the desired layout. Either the number or the title can +be specified. Without either specification, @code{screen} will +prompt and ask which screen is desired. To see which layouts are +available, use the @code{layout show} command. +@end deffn + +@deffn Command layout @code{show} +(none)@* +List on the message line the number(s) and title(s) of the available +layout(s). The current layout is flagged. +@end deffn + +@deffn Command layout @code{title} [title] +(none)@* +Change or display the title of the current layout. A string given +will be used to name the layout. Without any options, the current +title and number is displayed on the message line. +@end deffn + +@deffn Command layout @code{number} [n] +(none)@* +Change or display the number of the current layout. An integer given +will be used to number the layout. Without any options, the current +number and title is displayed on the message line. +@end deffn + +@deffn Command layout @code{attach} [title|@code{:last}] +(none)@* +Change or display which layout to reattach back to. The default is +@code{:last}, which tells @code{screen} to reattach back to the last +used layout just before detachment. By supplying a title, You can +instruct @code{screen} to reattach to a particular layout regardless +which one was used at the time of detachment. Without any options, +the layout to reattach to will be shown in the message line. +@end deffn + +@deffn Command layout @code{save} [n|title] +(none)@* +Remember the current arrangement of regions. When used, @code{screen} +will remember the arrangement of vertically and horizontally split +regions. This arrangement is restored when a @code{screen} session +is reattached or switched back from a different layout. If the +session ends or the @code{screen} process dies, the layout +arrangements are lost. The @code{layout dump} command should help +in this siutation. If a number +or title is supplied, @code{screen} will remember the arrangement of +that particular layout. Without any options, @code{screen} will +remember the current layout. + +Saving your regions can be done automatically by using the +@code{layout autosave} command. +@end deffn + +@deffn Command layout @code{autosave} [@code{on}|@code{off}] +(none)@* +Change or display the status of automatically saving layouts. The +default is @code{on}, meaning when @code{screen} is detached or +changed to a different layout, the arrangement of regions and windows +will be remembered at the time of change and restored upon return. +If autosave is set to @code{off}, that arrangement will only be +restored to either to the last manual save, using @code{layout save}, +or to when the layout was first created, to a single region with +a single window. Without either an @code{on} or an @code{off}, the +current status is displayed on the message line. +@end deffn + +@deffn Command layout @code{dump} [filename] +(none)@* +Write to a file the order of splits made in the current layout. This +is useful to recreate the order of your regions used in your current +layout. Only the current layout is recorded. While the order of the +regions are recorded, the sizes of those regions and which windows +correspond to which regions are not. If no filename is specified, +the default is @file{layout-dump}, saved in the directory that the +@code{screen} process was started in. If the file already exists, +@code{layout dump} will append to that file. As an example: +@example +layout dump /home/user/.screenrc +@end example +will save or append the layout to the user's @file{.screenrc} file. +@end deffn + @node Window Settings, Virtual Terminal, Regions, Top @chapter Window Settings @@ -1902,7 +2320,7 @@ terminal emulation itself. * Kill:: Destroy an unwanted window * Login:: Control @file{/etc/utmp} logging * Mode:: Control the file mode of the pty -* Monitor:: Watch for activity in a window +* Monitor:: Watch for activity or inactivity in a window * Windows:: List the active windows * Hardstatus:: Set a window's hardstatus line @end menu @@ -1999,7 +2417,7 @@ Bash users will probably want to echo the escape sequence in the PROMPT_COMMAND: @example -PROMPT_COMMAND='echo -n -e "\033k\033\134"' +PROMPT_COMMAND='printf "\033k\033\134"' @end example (I used @samp{\134} to output a @samp{\} because of a bug in v1.04). @@ -2165,6 +2583,29 @@ the window-status display (@pxref{Windows}). Monitoring defaults to @samp{off} for all windows. @end deffn +@kindex _ +@deffn Command silence [@var{state}|@var{sec}] +(@kbd{C-a _})@* +Toggles silence monitoring of windows. When silence is turned on and an +affected window is switched into the background, you will receive the +silence notification message in the status line after a specified period +of inactivity (silence). The default timeout can be changed with the +@code{silencewait} command or by specifying a number of seconds instead of +@code{on} or @code{off}. Silence is initially off for all windows. +@end deffn + +@deffn Command defsilence state +(none)@* +Same as the @code{silence} command except that the default setting for +new windows is changed. Initial setting is `off'. +@end deffn + +@deffn Command silencewait @var{seconds} +(none)@* +Define the time that all windows monitored for silence should wait +before displaying a message. Default is 30 seconds. +@end deffn + @node Windows, Hardstatus, Monitor, Window Settings @section Windows @kindex w @@ -2190,7 +2631,7 @@ If this list is too long to fit on the terminal's status line only the portion around the current window is displayed. @end deffn -@node Hardstatus, , Windows, Window Settings +@node Hardstatus, Mousetrack, Windows, Window Settings @section Hardstatus @code{Screen} maintains a hardstatus line for every window. If a window @@ -2221,6 +2662,25 @@ Per default the hardstatus line of new windows is empty. Changes the current window's hardstatus line to @var{status}. @end deffn +@node Mousetrack, , Hardstatus, Miscellaneous +@section Mousetrack + +@deffn Command mousetrack [ @code{on|off} ] +(none)@* +This command determines whether @code{screen} will watch for +mouse clicks. When this command is enabled, regions that have +been split in various ways can be selected by pointing to them +with a mouse and left-clicking them. Without specifying @var{on} +or @var{off}, the current state is displayed. The default state +is determined by the @code{defmousetrack} command. +@end deffn + +@deffn Command defmousetrack @code{on|off} +(none)@* +This command determines the default state of the @code{mousetrack} +command, currently defaulting of @var{off}. +@end deffn + @node Virtual Terminal, Copy and Paste, Window Settings, Top @chapter Virtual Terminal @@ -2473,8 +2933,8 @@ Keypad enter fe stuff \015 @section Digraph @kindex C-v -@deffn Command digraph [preset] -(none)@* +@deffn Command digraph [preset [unicode-value]] +(@kbd{C-a C-v})@* This command prompts the user for a digraph sequence. The next two characters typed are looked up in a builtin table and the resulting character is inserted in the input stream. For example, @@ -2484,7 +2944,190 @@ will treat the following characters (up to three) as an octal number instead. The optional argument @var{preset} is treated as user input, thus one can create an "umlaut" key. For example the command @samp{bindkey ^K digraph '"'} enables the user -to generate an a-umlaut by typing @samp{CTRL-K a}. +to generate an a-umlaut by typing @samp{CTRL-K a}. When a non-zero +@var{unicode-value} is specified, a new digraph is created with the +specified preset. The digraph is unset if a zero value is provided +for the @var{unicode-value}. + +The following table is the builtin sequences. + +@documentencoding ISO-8859-1 +@example + Sequence Octal Digraph Unicode Equivalent + ----------------------------------------------- + ' ', ' ' 160 (space) U+00A0 + 'N', 'S' 160 (space) U+00A0 + '~', '!' 161 ¡ U+00A1 + '!', '!' 161 ¡ U+00A1 + '!', 'I' 161 ¡ U+00A1 + 'c', '|' 162 ¢ U+00A2 + 'c', 't' 162 ¢ U+00A2 + '$', '$' 163 £ U+00A3 + 'P', 'd' 163 £ U+00A3 + 'o', 'x' 164 ¤ U+00A4 + 'C', 'u' 164 ¤ U+00A4 + 'C', 'u' 164 ¤ U+00A4 + 'E', 'u' 164 ¤ U+00A4 + 'Y', '-' 165 ¥ U+00A5 + 'Y', 'e' 165 ¥ U+00A5 + '|', '|' 166 ¦ U+00A6 + 'B', 'B' 166 ¦ U+00A6 + 'p', 'a' 167 § U+00A7 + 'S', 'E' 167 § U+00A7 + '"', '"' 168 ¨ U+00A8 + ''', ':' 168 ¨ U+00A8 + 'c', 'O' 169 © U+00A9 + 'C', 'o' 169 © U+00A9 + 'a', '-' 170 ª U+00AA + '<', '<' 171 « U+00AB + '-', ',' 172 ¬ U+00AC + 'N', 'O' 172 ¬ U+00AC + '-', '-' 173 U+00AD + 'r', 'O' 174 ® U+00AE + 'R', 'g' 174 ® U+00AE + '-', '=' 175 ¯ U+00AF + ''', 'm' 175 ¯ U+00AF + '~', 'o' 176 ° U+00B0 + 'D', 'G' 176 ° U+00B0 + '+', '-' 177 ± U+00B1 + '2', '2' 178 ² U+00B2 + '2', 'S' 178 ² U+00B2 + '3', '3' 179 ³ U+00B3 + '3', 'S' 179 ³ U+00B3 + ''', ''' 180 ´ U+00B4 + 'j', 'u' 181 µ U+00B5 + 'M', 'y' 181 µ U+00B5 + 'p', 'p' 182 ¶ U+00B6 + 'P', 'I' 182 ¶ U+00B6 + '~', '.' 183 · U+00B7 + '.', 'M' 183 · U+00B7 + ',', ',' 184 ¸ U+00B8 + ''', ',' 184 ¸ U+00B8 + '1', '1' 185 ¹ U+00B9 + '1', 'S' 185 ¹ U+00B9 + 'o', '-' 186 º U+00BA + '>', '>' 187 » U+00BB + '1', '4' 188 ¼ U+00BC + '1', '2' 189 ½ U+00BD + '3', '4' 190 ¾ U+00BE + '~', '?' 191 ¿ U+00BF + '?', '?' 191 ¿ U+00BF + '?', 'I' 191 ¿ U+00BF + 'A', '`' 192 À U+00C0 + 'A', '!' 192 À U+00C0 + 'A', ''' 193 Á U+00C1 + 'A', '^' 194  U+00C2 + 'A', '>' 194  U+00C2 + 'A', '~' 195 à U+00C3 + 'A', '?' 195 à U+00C3 + 'A', '"' 196 Ä U+00C4 + 'A', ':' 196 Ä U+00C4 + 'A', '@@' 197 Å U+00C5 + 'A', 'A' 197 Å U+00C5 + 'A', 'E' 198 Æ U+00C6 + 'C', ',' 199 Ç U+00C7 + 'E', '`' 200 È U+00C8 + 'E', '!' 200 È U+00C8 + 'E', ''' 201 É U+00C9 + 'E', '^' 202 Ê U+00CA + 'E', '>' 202 Ê U+00CA + 'E', '"' 203 Ë U+00CB + 'E', ':' 203 Ë U+00CB + 'I', '`' 204 Ì U+00CC + 'I', '!' 204 Ì U+00CC + 'I', ''' 205 Í U+00CD + 'I', '^' 206 Î U+00CE + 'I', '>' 206 Î U+00CE + 'I', '"' 207 Ï U+00CF + 'I', ':' 207 Ï U+00CF + 'D', '-' 208 Ð U+00D0 + 'N', '~' 209 Ñ U+00D1 + 'N', '?' 209 Ñ U+00D1 + 'O', '`' 210 Ò U+00D2 + 'O', '!' 210 Ò U+00D2 + 'O', ''' 211 Ó U+00D3 + 'O', '^' 212 Ô U+00D4 + 'O', '>' 212 Ô U+00D4 + 'O', '~' 213 Õ U+00D5 + 'O', '?' 213 Õ U+00D5 + 'O', '"' 214 Ö U+00D6 + 'O', ':' 214 Ö U+00D6 + '/', '\' 215 × U+00D7 + '*', 'x' 215 × U+00D7 + 'O', '/' 216 Ø U+00D8 + 'U', '`' 217 Ù U+00D9 + 'U', '!' 217 Ù U+00D9 + 'U', ''' 218 Ú U+00DA + 'U', '^' 219 Û U+00DB + 'U', '>' 219 Û U+00DB + 'U', '"' 220 Ü U+00DC + 'U', ':' 220 Ü U+00DC + 'Y', ''' 221 Ý U+00DD + 'I', 'p' 222 Þ U+00DE + 'T', 'H' 222 Þ U+00DE + 's', 's' 223 ß U+00DF + 's', '"' 223 ß U+00DF + 'a', '`' 224 à U+00E0 + 'a', '!' 224 à U+00E0 + 'a', ''' 225 á U+00E1 + 'a', '^' 226 â U+00E2 + 'a', '>' 226 â U+00E2 + 'a', '~' 227 ã U+00E3 + 'a', '?' 227 ã U+00E3 + 'a', '"' 228 ä U+00E4 + 'a', ':' 228 ä U+00E4 + 'a', 'a' 229 å U+00E5 + 'a', 'e' 230 æ U+00E6 + 'c', ',' 231 ç U+00E7 + 'e', '`' 232 è U+00E8 + 'e', '!' 232 è U+00E8 + 'e', ''' 233 é U+00E9 + 'e', '^' 234 ê U+00EA + 'e', '>' 234 ê U+00EA + 'e', '"' 235 ë U+00EB + 'e', ':' 235 ë U+00EB + 'i', '`' 236 ì U+00EC + 'i', '!' 236 ì U+00EC + 'i', ''' 237 í U+00ED + 'i', '^' 238 î U+00EE + 'i', '>' 238 î U+00EE + 'i', '"' 239 ï U+00EF + 'i', ':' 239 ï U+00EF + 'd', '-' 240 ð U+00F0 + 'n', '~' 241 ñ U+00F1 + 'n', '?' 241 ñ U+00F1 + 'o', '`' 242 ò U+00F2 + 'o', '!' 242 ò U+00F2 + 'o', ''' 243 ó U+00F3 + 'o', '^' 244 ô U+00F4 + 'o', '>' 244 ô U+00F4 + 'o', '~' 245 õ U+00F5 + 'o', '?' 245 õ U+00F5 + 'o', '"' 246 ö U+00F6 + 'o', ':' 246 ö U+00F6 + ':', '-' 247 ÷ U+00F7 + 'o', '/' 248 ø U+00F8 + 'u', '`' 249 ù U+00F9 + 'u', '!' 249 ù U+00F9 + 'u', ''' 250 ú U+00FA + 'u', '^' 251 û U+00FB + 'u', '>' 251 û U+00FB + 'u', '"' 252 ü U+00FC + 'u', ':' 252 ü U+00FC + 'y', ''' 253 ý U+00FD + 'i', 'p' 254 þ U+00FE + 't', 'h' 254 þ U+00FE + 'y', '"' 255 ÿ U+00FF + 'y', ':' 255 ÿ U+00FF + '"', '[' 196 Ä U+00C4 + '"', '\' 214 Ö U+00D6 + '"', ']' 220 Ü U+00DC + '"', '@{' 228 ä U+00E4 + '"', '|' 246 ö U+00F6 + '"', '@}' 252 ü U+00FC + '"', '~' 223 ß U+00DF +@end example + @end deffn @node Bell, Clear, Digraph, Virtual Terminal @@ -2506,7 +3149,7 @@ The default message is An empty message can be supplied to the @code{bell_msg} command to suppress output of a message line (@code{bell_msg ""}). -Without parameter, the current message is shown. +Without a parameter, the current message is shown. @end deffn @kindex C-g @@ -2530,7 +3173,7 @@ Sets the visual bell message. @var{Message} is printed to the status line if the window receives a bell character (^G), @code{vbell} is set to @samp{on} and the terminal does not support a visual bell. The default message is @samp{Wuff, Wuff!!}. -Without parameter, the current message is shown. +Without a parameter, the current message is shown. @end deffn @deffn Command vbellwait sec @@ -2590,7 +3233,7 @@ For system information use @code{time}. @deffn Command dinfo (none)@* -Show what screen thinks about your terminal. Useful if you want to know +Show what @code{screen} thinks about your terminal. Useful if you want to know why features like color or the alternate charset don't work. @end deffn @@ -2635,13 +3278,14 @@ partial redraw mode. @kindex r @kindex C-r -@deffn Command wrap state +@deffn Command wrap [ on | off ] (@kbd{C-a r}, @kbd{C-a C-r}) @* Sets the line-wrap setting for the current window. When line-wrap is on, the second consecutive printable character output at the last column of a line will wrap to the start of the following line. As an added feature, backspace (^H) will also wrap through the left margin to the -previous line. Default is @samp{on}. +previous line. Default is @samp{on}. Without any options, the state of +@code{wrap} is toggled. @end deffn @deffn Command defwrap state @@ -2848,7 +3492,7 @@ outlined below. @subsection CR/LF @deffn Command crlf [state] (none)@* -This affects the copying of text regions with the @kbd{C-a [} command. +This affects the copying of text regions with the @code{copy} command. If it is set to @samp{on}, lines will be separated by the two character sequence @samp{CR}/@samp{LF}. Otherwise only @samp{LF} is used. @code{crlf} is off by default. @@ -2857,6 +3501,7 @@ When no parameter is given, the state is toggled. @node Scrollback, Copy Mode Keys, Line Termination, Copy @subsection Scrollback +To access and use the contents in the scrollback buffer, use the @code{copy} command. @xref{Copy}. @deffn Command defscrollback num (none)@* Same as the @code{scrollback} command except that the default setting @@ -2866,7 +3511,7 @@ for new windows is changed. Defaults to 100. @deffn Command scrollback num (none)@* Set the size of the scrollback buffer for the current window to -@var{num} lines. The default scrollback is 100 lines. Use @kbd{C-a i} +@var{num} lines. The default scrollback is 100 lines. Use @code{info} to view the current setting. @end deffn @@ -2878,7 +3523,7 @@ to hold more useful lines in your scrollback buffer. @end deffn @node Copy Mode Keys, Movement, Scrollback, Copy -@subsection markkeys +@subsection Markkeys @deffn Command markkeys string (none)@* This is a method of changing the keymap used for copy/history mode. The @@ -2888,7 +3533,7 @@ h=^B:l=^F:$=^E} would set some keys to be more familiar to @code{emacs} users. If your terminal sends characters, that cause you to abort copy mode, then this command may help by binding these characters to do nothing. -The no-op character is `@' and is used like this: @code{markkeys @@=L=H} +The no-op character is `@@' and is used like this: @code{markkeys @@=L=H} if you do not want to use the `H' or `L' commands any longer. As shown in this example, multiple keys can be assigned to one function in a single statement. @@ -2898,46 +3543,69 @@ in a single statement. @subsection Movement Keys @noindent -@kbd{h}, @kbd{j}, @kbd{k}, @kbd{l} move the cursor line by line or -column by column. +@kbd{h}, @kbd{C-h}, or @kbd{left arrow} move the cursor left. @noindent -@kbd{0}, @kbd{^} and @kbd{$} move to the leftmost column or to the first -or last non-whitespace character on the line. +@kbd{j}, @kbd{C-n}, or @kbd{down arrow} move the cursor down. @noindent -@kbd{H}, @kbd{M} and @kbd{L} move the cursor to the leftmost column -of the top, center or bottom line of the window. +@kbd{k}, @kbd{C-p}, or @kbd{up arrow} move the cursor up. + +@noindent +@kbd{l} ('el'), or @kbd{right arrow} move the cursor right. + +@noindent +@kbd{0} (zero) or @kbd{C-a} move to the leftmost column. @noindent @kbd{+} and @kbd{-} move the cursor to the leftmost column of the next or previous line. @noindent -@kbd{G} moves to the specified absolute line (default: end of buffer). - +@kbd{H}, @kbd{M} and @kbd{L} move the cursor to the leftmost column +of the top, center or bottom line of the window. + @noindent @kbd{|} moves to the specified absolute column. @noindent -@kbd{w}, @kbd{b}, @kbd{e} move the cursor word by word. +@kbd{g} or @kbd{home} moves to the beginning of the buffer. + +@noindent +@kbd{G} or @kbd{end} moves to the specified absolute line (default: end of buffer). + +@noindent +@kbd{%} jumps to the specified percentage of the buffer. + +@noindent +@kbd{^} or @kbd{$} move to the first +or last non-whitespace character on the line. + +@noindent +@kbd{w}, @kbd{b}, and @kbd{e} move the cursor word by word. @noindent @kbd{B}, @kbd{E} move the cursor WORD by WORD (as in vi). @noindent -@kbd{C-u} and @kbd{C-d} scroll the display up/down by the specified -amount of lines while preserving the cursor position. (Default: half -screenfull). +@kbd{f}/@kbd{F}, @kbd{t}/@kbd{T} move the cursor forward/backward to the +next occurence of the target. (eg, '3fy' will move the cursor to the 3rd +'y' to the right.) @noindent -@kbd{C-b} and @kbd{C-f} move the cursor up/down a full screen. +@kbd{;} and @kbd{,} Repeat the last f/F/t/T command in the same/opposite direction. + +@noindent +@kbd{C-e} and @kbd{C-y} scroll the display up/down by one line +while preserving the cursor position. @noindent -@kbd{g} moves to the beginning of the buffer. +@kbd{C-u} and @kbd{C-d} scroll the display up/down by the specified +amount of lines while preserving the cursor position. (Default: half +screenful). @noindent -@kbd{%} jumps to the specified percentage of the buffer. +@kbd{C-b} and @kbd{C-f} move the cursor up/down a full screen. Note that Emacs-style movement keys can be specified by a .screenrc command. (@code{markkeys "h=^B:l=^F:$=^E"}) There is no simple method for @@ -2947,8 +3615,12 @@ a full emacs-style keymap, however, as this involves multi-character codes. @subsection Marking The copy range is specified by setting two marks. The text between these -marks will be highlighted. Press @kbd{space} to set the first or second -mark respectively. +marks will be highlighted. Press: + +@noindent +@kbd{space} or @kbd{enter} to set the first or second mark respectively. +If @code{mousetrack} is set to @code{on}, marks can also be set using +@kbd{left mouse click}. @noindent @kbd{Y} and @kbd{y} can be used to mark one whole line or to mark from @@ -2962,7 +3634,11 @@ start of line. Any command in copy mode can be prefixed with a number (by pressing digits @kbd{0@dots{}9}) which is taken as a repeat count. Example: -@kbd{C-a C-[ H 10 j 5 Y} will copy lines 11 to 15 into the paste buffer. +@example +@kbd{C-a C-[ H 10 j 5 Y} +@end example +@noindent +will copy lines 11 to 15 into the paste buffer. @node Searching, Specials, Repeat count, Copy @subsection Searching @@ -2979,31 +3655,42 @@ digits @kbd{0@dots{}9}) which is taken as a repeat count. Example: @noindent @kbd{C-r} @code{emacs} style reverse i-search. -@deffn Command ignorecase [state] +@deffn Command ignorecase [on|off] (none)@* Tell screen to ignore the case of characters in searches. Default is -@code{off}. +@code{off}. Without any options, the state of @code{ignorecase} +is toggled. @end deffn +@noindent +@kbd{n} Repeat search in forward direction. + +@noindent +@kbd{N} Repeat search in backward direction. + @node Specials, , Searching, Copy @subsection Specials There are, however, some keys that act differently here from in @code{vi}. @code{Vi} does not allow to yank rectangular blocks of text, -but @code{screen} does. Press +but @code{screen} does. Press: @noindent @kbd{c} or @kbd{C} to set the left or right margin respectively. If no repeat count is given, both default to the current cursor position.@* Example: Try this on a rather full text screen: +@example @kbd{C-a [ M 20 l SPACE c 10 l 5 j C SPACE}. +@end example @noindent This moves one to the middle line of the screen, moves in 20 columns left, marks the beginning of the paste buffer, sets the left column, moves 5 columns down, sets the right column, and then marks the end of -the paste buffer. Now try:@* +the paste buffer. Now try: +@example @kbd{C-a [ M 20 l SPACE 10 l 5 j SPACE} +@end example @noindent and notice the difference in the amount of text copied. @@ -3016,11 +3703,11 @@ character with a carriage return character, by issuing a @code{set crlf on}. @noindent -@kbd{v} is for all the @code{vi} users who use @code{:set numbers} - it +@kbd{v} or @kbd{V} is for all the @code{vi} users who use @code{:set numbers} - it toggles the left margin between column 9 and 1. @noindent -@kbd{a} before the final space key turns on append mode. Thus +@kbd{a} before the final @kbd{space} key turns on append mode. Thus the contents of the paste buffer will not be overwritten, but appended to. @noindent @@ -3031,16 +3718,22 @@ the contents of the paste buffer will not be overwritten, but appended to. to the screen-exchange file (@file{/tmp/screen-exchange} per default) once copy-mode is finished. @xref{Screen Exchange}.@* This example demonstrates how to dump the -whole scrollback buffer to that file: @*@kbd{C-a [ g SPACE G $ >}. +whole scrollback buffer to that file: +@example +@kbd{C-a [ g SPACE G $ >}. +@end example @noindent @kbd{C-g} gives information about the current line and column. @noindent -@kbd{x} exchanges the first mark and the current cursor position. You +@kbd{x} or @kbd{o} ('oh') exchanges the first mark and the current cursor position. You can use this to adjust an already placed mark. @noindent +@kbd{C-l} ('el') will redraw the screen. + +@noindent @kbd{@@} does nothing. Absolutely nothing. Does not even exit copy mode. @@ -3073,10 +3766,11 @@ display (terminal attached), as the registers are a global resource. The paste buffer exists once for every user. @end deffn -@deffn Command stuff string +@deffn Command stuff [string] (none)@* Stuff the string @var{string} in the input buffer of the current window. This is like the @code{paste} command, but with much less overhead. +Without a paramter, @code{screen} will prompt for a string to stuff. You cannot paste large buffers with the @code{stuff} command. It is most useful for key bindings. @xref{Bindkey}. @end deffn @@ -3193,8 +3887,9 @@ See also @section History @kindex @{ +@kindex @} @deffn Command history -(@kbd{C-a @{})@* +(@kbd{C-a @{}, @kbd{C-a @}})@* Usually users work with a shell that allows easy access to previous commands. For example, @code{csh} has the command @code{!!} to repeat the last command executed. @code{screen} provides a primitive way of @@ -3224,7 +3919,7 @@ Run a unix subprocess (specified by an executable path @var{newcommand} and its optional arguments) in the current window. The flow of data between newcommands stdin/stdout/stderr, the process originally started (let us call it "application-process") and -screen itself (window) is controlled by the filedescriptor pattern @var{fdpat}. +screen itself (window) is controlled by the file descriptor pattern @var{fdpat}. This pattern is basically a three character sequence representing stdin, stdout and stderr of newcommand. A dot (@code{.}) connects the file descriptor to screen. An exclamation mark (@code{!}) causes the file descriptor to be @@ -3348,11 +4043,19 @@ command to activate a class. Command classes can be used to create multiple command keys or multi-character bindings. By default, most suitable commands are bound to one or more keys -(@pxref{Default Key Bindings}; for instance, the command to create a +(@pxref{Default Key Bindings}); for instance, the command to create a new window is bound to @kbd{C-c} and @kbd{c}. The @code{bind} command can be used to redefine the key bindings and to define new bindings. @end deffn +@deffn Command unbindall +(none)@* +Unbind all the bindings. This can be useful when +screen is used solely for its detaching abilities, such as when +letting a console application run as a daemon. If, for some reason, +it is necessary to bind commands after this, use 'screen -X'. +@end deffn + @node Bind Examples, Command Character, Bind, Key Binding @section Examples of the @code{bind} command @noindent @@ -3466,7 +4169,7 @@ option is given, bindkey modifies the default table, @samp{-m} changes the copy mode table and with neither option the user table is selected. The argument @samp{string} is the sequence of characters to which an action is bound. This can either be a fixed -tring or a termcap keyboard capability name (selectable with the +string or a termcap keyboard capability name (selectable with the @samp{-k} option). Some keys on a VT100 terminal can send a different @@ -3516,7 +4219,7 @@ bindkey "\024" mapdefault This key-binding makes @samp{C-t} an escape character for key-bindings. If you did the above @samp{stuff barfoo} binding, you can enter the word @samp{foo} by typing @samp{C-t foo}. If you want to insert a -@samp{C-t} you have to press the key twice (i.e. escape the escape +@samp{C-t} you have to press the key twice (i.e., escape the escape binding). @example @@ -3537,10 +4240,10 @@ in the default bindkey table. (none)@* Like mapdefault, but don't even look in the default bindkey table. @end deffn -@deffn Command maptimeout timo +@deffn Command maptimeout n (none)@* -Set the intercharacter timer for input sequence detection to a timeout -of @var{timo} ms. The default timeout is 300ms. Maptimeout with no +Set the inter-character timer for input sequence detection to a timeout +of @var{n} ms. The default timeout is 300ms. Maptimeout with no arguments shows the current setting. @end deffn @@ -3649,7 +4352,7 @@ Send a ^S (ASCII XOFF) to the program in the current window. @node Termcap, Message Line, Flow Control, Top @chapter Termcap -@code{screen} demands the most out of your terminal so that it can +@code{Screen} demands the most out of your terminal so that it can perform its VT100 emulation most efficiently. These functions provide means for tweaking the termcap entries for both your physical terminal and the one simulated by @code{screen}. @@ -4061,7 +4764,7 @@ Here is an example: This tells @code{screen}, how to translate ISOlatin1 (charset @samp{B}) upper case umlaut characters on a @code{hp700} terminal that has a -german charset. @samp{\304} gets translated to +German charset. @samp{\304} gets translated to @samp{\E(K[\E(B} and so on. Note that this line gets parsed *three* times before the internal lookup table is built, therefore a lot of quoting is needed to @@ -4080,7 +4783,7 @@ This example shows one use of the extension: termcap xterm 'XC=K%,%\E(B,[\304,\\\\\326,]\334' @end example -Here, a part of the german (@samp{K}) charset is emulated on an xterm. +Here, a part of the German (@samp{K}) charset is emulated on an xterm. If screen has to change to the @samp{K} charset, @samp{\E(B} will be sent to the terminal, i.e. the ASCII charset is used instead. The @@ -4092,7 +4795,7 @@ template is just @samp{%}, so the mapping is straightforward: @chapter The Message Line @cindex message line -@code{screen} displays informational messages and other diagnostics in a +@code{Screen} displays informational messages and other diagnostics in a @dfn{message line} at the bottom of the screen. If your terminal has a status line defined in its termcap, screen will use this for displaying its messages, otherwise the last line of the screen will be temporarily @@ -4118,8 +4821,8 @@ sequence. For instance, from within the shell, try something like: echo "@value{esc}^Hello world from window $WINDOW@value{esc}\" @end example -where @samp{@value{esc}} is ASCII ESC and @samp{^} is a literal caret or -up-arrow. +where @samp{@value{esc}} is ASCII ESC and the @samp{^} that follows it +is a literal caret or up-arrow. @node Hardware Status Line, Last Message, Privacy Message, Message Line @section Hardware Status Line @@ -4145,7 +4848,7 @@ If you prepend the word @code{always} to the type (e.g., @code{alwayslastline}), the type even if the terminal supports a hardstatus line. The third form specifies the contents of the hardstatus line. -@code{%h} is used as default string, i.e. the stored hardstatus of the +@code{%h} is used as default string, i.e., the stored hardstatus of the current window (settable via @samp{ESC]0;^G} or @samp{ESC_\\}) is displayed. You can customize this to any string you like including @@ -4195,9 +4898,8 @@ This section describes the commands for keeping a record of your session. @node Hardcopy, Log, , Logging @section hardcopy @kindex h -@kindex C-h @deffn Command hardcopy [-h] [@var{file}] -(@kbd{C-a h}, @kbd{C-a C-h})@* +(@kbd{C-a h})@* Writes out the currently displayed image to the file @var{file}, or, if no filename is specified, to @file{hardcopy.@var{n}} in the default directory, where @var{n} is the number of the @@ -4217,7 +4919,7 @@ otherwise, these files are overwritten each time. @deffn Command hardcopydir directory (none)@* Defines a directory where hardcopy files will be placed. -If unset hardcopys are dumped in screen's current working +If unset, hardcopys are dumped in screen's current working directory. @end deffn @@ -4247,7 +4949,7 @@ included in the session log. Default is @samp{off}. @deffn Command logfile filename @deffnx Command logfile flush secs (none)@* -Defines the name the logfiles will get. The default is @samp{screenlog.%n}. +Defines the name the log files will get. The default is @samp{screenlog.%n}. The second form changes the number of seconds @code{screen} will wait before flushing the logfile buffer to the file-system. The default value is 10 seconds. @@ -4322,12 +5024,12 @@ categories. * Nethack:: Use @code{nethack}-like error messages. * Nonblock:: Disable flow-control to a display. * Number:: Change the current window's number. -* Silence:: Notify on inactivity. * Time:: Display the time and load average. * Verbose:: Display window creation commands. * Version:: Display the version of @code{screen}. * Zombie:: Keep dead windows. * Printcmd:: Set command for VT100 printer port emulation. +* Rendition:: Change text attributes in caption for flagged windows. * Sorendition:: Change the text highlighting method. * Attrcolor:: Map attributes to colors. * Setsid:: Change process group management. @@ -4336,6 +5038,7 @@ categories. * Backtick:: Program a command for a backtick string escape. * Screen Saver:: Define a screen safer. * Zmodem:: Define how screen treats zmodem requests. +* Mousetrack:: Set whether screen should track mouse events. @end menu @node At, Break, , Miscellaneous @@ -4374,8 +5077,10 @@ work correctly under @code{at} looping over windows. @node Break, Debug, At, Miscellaneous @section Break +@kindex b +@kindex C-b @deffn Command break [duration] -(none)@* +(@kbd{C-a b}, @kbd{C-a C-b})@* Send a break signal for @var{duration}*0.25 seconds to this window. For non-Posix systems the time interval is rounded up to full seconds. Most useful if a character device is attached to the window rather than @@ -4383,8 +5088,9 @@ a shell process (@pxref{Window Types}). The maximum duration of a break signal is limited to 15 seconds. @end deffn +@kindex B @deffn Command pow_break -(none)@* +(@kbd{C-a B})@* Reopen the window's terminal line and send a break condition. @end deffn @@ -4407,7 +5113,7 @@ terminal devices opened afterwards. The preferred methods are session for the duration of the break, but it may be the only way to generate long breaks. @code{tcsendbreak} and @code{TIOCSBRK} may or may not produce long breaks with spikes (e.g. 4 per second). This is not only system -dependant, this also differs between serial board drivers. +dependent, this also differs between serial board drivers. Calling @code{defbreaktype} with no parameter displays the current setting. @end deffn @@ -4424,8 +5130,9 @@ be turned off once and forever. @node License, Nethack, Debug, Miscellaneous @section License +@kindex , @deffn Command license -(none)@* +(@kbd{C-a ,})@* Display the disclaimer page. This is done whenever @code{screen} is started without options, which should be often enough. @end deffn @@ -4442,7 +5149,8 @@ to read. Anyway, standard messages often tend to be unclear as well. This option is only available if @code{screen} was compiled with the NETHACK flag defined (@pxref{Installation}). The default setting is then determined by the presence of the environment variable -@code{$NETHACKOPTIONS}. +@code{$NETHACKOPTIONS} and the file @code{~/.nethackrc} - if either one is +present, the default is @code{on}. @end deffn @node Nonblock, Number, Nethack, Miscellaneous @@ -4465,41 +5173,19 @@ Same as the @code{nonblock} command except that the default setting for displays is changed. Initial setting is @code{off}. @end deffn -@node Number, Silence, Nonblock, Miscellaneous +@node Number, Time, Nonblock, Miscellaneous @section Number @kindex N -@deffn Command number [@var{n}] +@deffn Command number [[+|-]@var{n}] (@kbd{C-a N})@* Change the current window's number. If the given number @var{n} is already used by another window, both windows exchange their numbers. If no argument is -specified, the current window number (and title) is shown. +specified, the current window number (and title) is shown. Using either a +plus (`+') or minus (`-') will change the window's number by the relative +amount specified. @end deffn -@node Silence, Time, Number, Miscellaneous -@section Silence -@deffn Command silence [@var{state}|@var{sec}] -(none)@* -Toggles silence monitoring of windows. When silence is turned on and an -affected window is switched into the background, you will receive the -silence notification message in the status line after a specified period -of inactivity (silence). The default timeout can be changed with the -@code{silencewait} command or by specifying a number of seconds instead of -@code{on} or @code{off}. Silence is initially off for all windows. -@end deffn - -@deffn Command defsilence state -(none)@* -Same as the @code{silence} command except that the default setting for -new windows is changed. Initial setting is `off'. -@end deffn - -@deffn Command silencewait @var{seconds} -(none)@* -Define the time that all windows monitored for silence should wait -before displaying a message. Default is 30 seconds. -@end deffn - -@node Time, Verbose, Silence, Miscellaneous +@node Time, Verbose, Number, Miscellaneous @section Time @kindex t @kindex C-t @@ -4517,7 +5203,7 @@ like it is described in the string escapes chapter (@pxref{String Escapes}). Scr @deffn Command verbose [on|off] If verbose is switched on, the command name is echoed, whenever a window is created (or resurrected from zombie state). Default is off. -Without parameter, the current setting is shown. +Without a parameter, the current setting is shown. @end deffn @node Version, Zombie, Verbose, Miscellaneous @@ -4530,7 +5216,7 @@ Display the version and modification date in the message line. @node Zombie, Printcmd, Version, Miscellaneous @section Zombie -@deffn Command zombie [@var{keys}] +@deffn Command zombie [@var{keys} [onerror] ] @deffnx Command defzombie [@var{keys}] (none)@* Per default windows are removed from the window list as soon as the @@ -4546,9 +5232,14 @@ the process terminates. As the zombie setting is affected globally for all windows, this command should only be called @code{defzombie}. Until we need this as a per window setting, the commands @code{zombie} and @code{defzombie} are synonymous. + +Optionally you can put the word @code{onerror} after the keys. This will +cause screen to monitor exit status of the process running in the window. +If it exits normally ('0'), the window disappears. Any other exit value +causes the window to become a zombie. @end deffn -@node Printcmd, Sorendition, Zombie, Miscellaneous +@node Printcmd, Rendition, Zombie, Miscellaneous @section Printcmd @deffn Command printcmd [@var{cmd}] (none)@* @@ -4564,16 +5255,24 @@ Warning: Be careful with this command! If other user have write access to your terminal, they will be able to fire off print commands. @end deffn -@node Sorendition, Attrcolor, Printcmd, Miscellaneous -@section Sorendition -@deffn Command sorendition [@var{attr} [@var{color}]] +@node Rendition, Sorendition, Printcmd, Miscellaneous +@section Rendition +@deffn Command rendition bell | monitor | silence | so @var{attr} [@var{color}] (none)@* -Change the way screen does highlighting for text marking and printing -messages. +Change the way screen renders the titles of windows that have monitor +or bell flags set in caption or hardstatus or windowlist. See the chapter about string escapes (@pxref{String Escapes}) for the syntax of -the modifiers. The default is currently @samp{=s dd} (standout, -default colors). +the modifiers. The default for monitor is currently @samp{=b} (bold, +active colors), for bell @samp{=ub} (underline, bold and active colors), and +for silence @samp{=u}. +@end deffn + +@node Sorendition, Attrcolor, Rendition, Miscellaneous +@section Sorendition +@deffn Command sorendition [@var{attr} [@var{color}]] +(none)@* +This command has been deprecated. Use @code{rendition so} instead. @end deffn @node Attrcolor, Setsid, Sorendition, Miscellaneous @@ -4586,7 +5285,7 @@ the text. If the attribute is in use, the specified attribute/color modifier is also applied. If no modifier is given, the current one is deleted. See the chapter about string escapes (@pxref{String Escapes}) for the syntax of -the modifier. Screen understands two pseudo-attributes, @code{i} +the modifier. @code{Screen} understands two pseudo-attributes, @code{i} stands for high-intensity foreground color and @code{I} for high-intensity background color. @@ -4609,7 +5308,7 @@ Make bright colored text also bold. @section Setsid @deffn Command setsid state (none)@* -Normally screen uses different sessions and process groups for +Normally @code{screen} uses different sessions and process groups for the windows. If setsid is turned @code{off}, this is not done anymore and all windows will be in the same process group as the screen backend process. This also breaks job-control, so be careful. @@ -4629,7 +5328,8 @@ Parses and executes each argument as separate command. @deffn Command maxwin @var{n} (none)@* Set the maximum window number screen will create. Doesn't affect -already existing windows. The number may only be decreased. +already existing windows. The number can be increased only when there are no +existing windows. @end deffn @node Backtick, Screen Saver, Maxwin, Miscellaneous @@ -4685,8 +5385,10 @@ command. @end deffn @deffn Command blankerprg [@var{program args}] -Defines a blanker program. Disables the blanker program if -no arguments are given. +Defines a blanker program. Disables the blanker program if an +empty argument is given. Shows the currently set blanker program if no +arguments are given. + @end deffn @node Zmodem, , Screen Saver, Miscellaneous @@ -4695,7 +5397,7 @@ no arguments are given. @deffnx Command zmodem sendcmd [string] @deffnx Command zmodem recvcmd [string] (none)@* -Define zmodem support for screen. Screen understands two +Define zmodem support for @code{screen}. @code{Screen} understands two different modes when it detects a zmodem request: @code{pass} and @code{catch}. If the mode is set to @code{pass}, screen will relay all data to the attacher until the end of the @@ -4737,7 +5439,7 @@ day number @item D weekday name @item f -flags of the window +flags of the window. @xref{Windows}, for meanings of the various flags. @item F sets %? to true if the window has the focus @item h @@ -4752,14 +5454,18 @@ month number month name @item n window number +@item P +sets %? to true if the current region is in copy/paste mode @item s seconds +@item S +session name @item t window title @item u all other users on this window @item w -all window numbers and names. With @code{-} quailifier: up to the current +all window numbers and names. With @code{-} qualifier: up to the current window; with @code{+} qualifier: starting with the window after the current one. @item W @@ -4811,7 +5517,7 @@ An attribute/color modifier is is used to change the attributes or the color settings. Its format is @samp{[attribute modifier] [color description]}. The attribute modifier must be prefixed by a change type indicator if it can be confused with -a color desciption. The following change types are known: +a color description. The following change types are known: @table @code @item + add the specified set to the current attributes @@ -4868,10 +5574,10 @@ use the pseudo-color @samp{i} to set just the brightness and leave the color unchanged. A one digit/letter color description is treated as foreground or -background color dependant on the current attributes: if reverse mode is +background color dependent on the current attributes: if reverse mode is set, the background color is changed instead of the foreground color. If you don't like this, prefix the color with a @samp{.}. If you want -the same behaviour for two-letter color descriptions, also prefix them +the same behavior for two-letter color descriptions, also prefix them with a @samp{.}. As a special case, @samp{%@{-@}} restores the attributes and colors that @@ -5010,7 +5716,8 @@ Authors @* ======= Originally created by Oliver Laumann, this latest version was -produced by Wayne Davison, Juergen Weigert and Michael Schroeder. +produced by Juergen Weigert, Michael Schroeder, Micah Cowan and +Sadrul Habib Chowdhury. @noindent Contributors @* @@ -5069,7 +5776,7 @@ found a bug not mentioned here. @menu * Known Bugs:: Problems we know about. * Reporting Bugs:: How to contact the maintainers. -* Availability:: Where to find the lastest screen version. +* Availability:: Where to find the latest screen version. @end menu @node Known Bugs, Reporting Bugs, , Bugs @@ -5249,7 +5956,5 @@ from the key sequences, since it is the same for all bindings. @printindex ky -@shortcontents -@contents @bye diff --git a/doc/window_to_display.ps b/src/doc/window_to_display.ps index cee66b3..cee66b3 100644 --- a/doc/window_to_display.ps +++ b/src/doc/window_to_display.ps diff --git a/encoding.c b/src/encoding.c index 2426545..6c1567a 100644 --- a/encoding.c +++ b/src/encoding.c @@ -5,7 +5,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * 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, @@ -14,9 +14,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -35,6 +35,10 @@ extern struct layer *flayer; extern char *screenencodings; +#ifdef DW_CHARS +extern int cjkwidth; +#endif + static int encmatch __P((char *, char *)); # ifdef UTF8 static int recode_char __P((int, int, int)); @@ -810,12 +814,11 @@ int encoding; continue; if (ml->font == null) { - if ((ml->font = (unsigned char *)malloc(p->w_width + 1)) == 0) + if ((ml->font = (unsigned char *)calloc(p->w_width + 1, 1)) == 0) { ml->font = null; break; } - bzero(ml->font, p->w_width + 1); } #ifdef DW_CHARS if ((p->w_encoding != UTF8 && (c & 0x1f00) != 0 && (c & 0xe000) == 0) || (p->w_encoding == UTF8 && utf8_isdouble(c))) @@ -845,22 +848,107 @@ int encoding; } #ifdef DW_CHARS +struct interval { + int first; + int last; +}; + +/* auxiliary function for binary search in interval table */ +static int bisearch(int ucs, const struct interval *table, int max) { + int min = 0; + int mid; + + if (ucs < table[0].first || ucs > table[max].last) + return 0; + while (max >= min) { + mid = (min + max) / 2; + if (ucs > table[mid].last) + min = mid + 1; + else if (ucs < table[mid].first) + max = mid - 1; + else + return 1; + } + + return 0; +} + int utf8_isdouble(c) int c; { - return - (c >= 0x1100 && - (c <= 0x115f || /* Hangul Jamo init. consonants */ - (c >= 0x2e80 && c <= 0xa4cf && (c & ~0x0011) != 0x300a && - c != 0x303f) || /* CJK ... Yi */ - (c >= 0xac00 && c <= 0xd7a3) || /* Hangul Syllables */ - (c >= 0xdf00 && c <= 0xdfff) || /* dw combining sequence */ - (c >= 0xf900 && c <= 0xfaff) || /* CJK Compatibility Ideographs */ - (c >= 0xfe30 && c <= 0xfe6f) || /* CJK Compatibility Forms */ - (c >= 0xff00 && c <= 0xff5f) || /* Fullwidth Forms */ - (c >= 0xffe0 && c <= 0xffe6) || - (c >= 0x20000 && c <= 0x2ffff))); + /* sorted list of non-overlapping intervals of East Asian Ambiguous + * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */ + static const struct interval ambiguous[] = { + { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 }, + { 0x00AA, 0x00AA }, { 0x00AE, 0x00AE }, { 0x00B0, 0x00B4 }, + { 0x00B6, 0x00BA }, { 0x00BC, 0x00BF }, { 0x00C6, 0x00C6 }, + { 0x00D0, 0x00D0 }, { 0x00D7, 0x00D8 }, { 0x00DE, 0x00E1 }, + { 0x00E6, 0x00E6 }, { 0x00E8, 0x00EA }, { 0x00EC, 0x00ED }, + { 0x00F0, 0x00F0 }, { 0x00F2, 0x00F3 }, { 0x00F7, 0x00FA }, + { 0x00FC, 0x00FC }, { 0x00FE, 0x00FE }, { 0x0101, 0x0101 }, + { 0x0111, 0x0111 }, { 0x0113, 0x0113 }, { 0x011B, 0x011B }, + { 0x0126, 0x0127 }, { 0x012B, 0x012B }, { 0x0131, 0x0133 }, + { 0x0138, 0x0138 }, { 0x013F, 0x0142 }, { 0x0144, 0x0144 }, + { 0x0148, 0x014B }, { 0x014D, 0x014D }, { 0x0152, 0x0153 }, + { 0x0166, 0x0167 }, { 0x016B, 0x016B }, { 0x01CE, 0x01CE }, + { 0x01D0, 0x01D0 }, { 0x01D2, 0x01D2 }, { 0x01D4, 0x01D4 }, + { 0x01D6, 0x01D6 }, { 0x01D8, 0x01D8 }, { 0x01DA, 0x01DA }, + { 0x01DC, 0x01DC }, { 0x0251, 0x0251 }, { 0x0261, 0x0261 }, + { 0x02C4, 0x02C4 }, { 0x02C7, 0x02C7 }, { 0x02C9, 0x02CB }, + { 0x02CD, 0x02CD }, { 0x02D0, 0x02D0 }, { 0x02D8, 0x02DB }, + { 0x02DD, 0x02DD }, { 0x02DF, 0x02DF }, { 0x0391, 0x03A1 }, + { 0x03A3, 0x03A9 }, { 0x03B1, 0x03C1 }, { 0x03C3, 0x03C9 }, + { 0x0401, 0x0401 }, { 0x0410, 0x044F }, { 0x0451, 0x0451 }, + { 0x2010, 0x2010 }, { 0x2013, 0x2016 }, { 0x2018, 0x2019 }, + { 0x201C, 0x201D }, { 0x2020, 0x2022 }, { 0x2024, 0x2027 }, + { 0x2030, 0x2030 }, { 0x2032, 0x2033 }, { 0x2035, 0x2035 }, + { 0x203B, 0x203B }, { 0x203E, 0x203E }, { 0x2074, 0x2074 }, + { 0x207F, 0x207F }, { 0x2081, 0x2084 }, { 0x20AC, 0x20AC }, + { 0x2103, 0x2103 }, { 0x2105, 0x2105 }, { 0x2109, 0x2109 }, + { 0x2113, 0x2113 }, { 0x2116, 0x2116 }, { 0x2121, 0x2122 }, + { 0x2126, 0x2126 }, { 0x212B, 0x212B }, { 0x2153, 0x2154 }, + { 0x215B, 0x215E }, { 0x2160, 0x216B }, { 0x2170, 0x2179 }, + { 0x2190, 0x2199 }, { 0x21B8, 0x21B9 }, { 0x21D2, 0x21D2 }, + { 0x21D4, 0x21D4 }, { 0x21E7, 0x21E7 }, { 0x2200, 0x2200 }, + { 0x2202, 0x2203 }, { 0x2207, 0x2208 }, { 0x220B, 0x220B }, + { 0x220F, 0x220F }, { 0x2211, 0x2211 }, { 0x2215, 0x2215 }, + { 0x221A, 0x221A }, { 0x221D, 0x2220 }, { 0x2223, 0x2223 }, + { 0x2225, 0x2225 }, { 0x2227, 0x222C }, { 0x222E, 0x222E }, + { 0x2234, 0x2237 }, { 0x223C, 0x223D }, { 0x2248, 0x2248 }, + { 0x224C, 0x224C }, { 0x2252, 0x2252 }, { 0x2260, 0x2261 }, + { 0x2264, 0x2267 }, { 0x226A, 0x226B }, { 0x226E, 0x226F }, + { 0x2282, 0x2283 }, { 0x2286, 0x2287 }, { 0x2295, 0x2295 }, + { 0x2299, 0x2299 }, { 0x22A5, 0x22A5 }, { 0x22BF, 0x22BF }, + { 0x2312, 0x2312 }, { 0x2460, 0x24E9 }, { 0x24EB, 0x254B }, + { 0x2550, 0x2573 }, { 0x2580, 0x258F }, { 0x2592, 0x2595 }, + { 0x25A0, 0x25A1 }, { 0x25A3, 0x25A9 }, { 0x25B2, 0x25B3 }, + { 0x25B6, 0x25B7 }, { 0x25BC, 0x25BD }, { 0x25C0, 0x25C1 }, + { 0x25C6, 0x25C8 }, { 0x25CB, 0x25CB }, { 0x25CE, 0x25D1 }, + { 0x25E2, 0x25E5 }, { 0x25EF, 0x25EF }, { 0x2605, 0x2606 }, + { 0x2609, 0x2609 }, { 0x260E, 0x260F }, { 0x2614, 0x2615 }, + { 0x261C, 0x261C }, { 0x261E, 0x261E }, { 0x2640, 0x2640 }, + { 0x2642, 0x2642 }, { 0x2660, 0x2661 }, { 0x2663, 0x2665 }, + { 0x2667, 0x266A }, { 0x266C, 0x266D }, { 0x266F, 0x266F }, + { 0x273D, 0x273D }, { 0x2776, 0x277F }, { 0xE000, 0xF8FF }, + { 0xFFFD, 0xFFFD }, { 0xF0000, 0xFFFFD }, { 0x100000, 0x10FFFD } + }; + + return ((c >= 0x1100 && + (c <= 0x115f || /* Hangul Jamo init. consonants */ + c == 0x2329 || c == 0x232a || + (c >= 0x2e80 && c <= 0xa4cf && + c != 0x303f) || /* CJK ... Yi */ + (c >= 0xac00 && c <= 0xd7a3) || /* Hangul Syllables */ + (c >= 0xf900 && c <= 0xfaff) || /* CJK Compatibility Ideographs */ + (c >= 0xfe30 && c <= 0xfe6f) || /* CJK Compatibility Forms */ + (c >= 0xff00 && c <= 0xff60) || /* Fullwidth Forms */ + (c >= 0xffe0 && c <= 0xffe6) || + (c >= 0x20000 && c <= 0x2fffd) || + (c >= 0x30000 && c <= 0x3fffd))) || + (cjkwidth && + bisearch(c, ambiguous, + sizeof(ambiguous) / sizeof(struct interval) - 1))); } #endif @@ -869,62 +957,58 @@ utf8_iscomb(c) int c; { /* taken from Markus Kuhn's wcwidth */ - static struct { - unsigned short first; - unsigned short last; - } combining[] = { - { 0x0300, 0x034F }, { 0x0360, 0x036F }, { 0x0483, 0x0486 }, - { 0x0488, 0x0489 }, { 0x0591, 0x05A1 }, { 0x05A3, 0x05B9 }, - { 0x05BB, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 }, - { 0x05C4, 0x05C4 }, { 0x064B, 0x0655 }, { 0x0670, 0x0670 }, + static const struct interval combining[] = { + { 0x0300, 0x036F }, { 0x0483, 0x0486 }, { 0x0488, 0x0489 }, + { 0x0591, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 }, + { 0x05C4, 0x05C5 }, { 0x05C7, 0x05C7 }, { 0x0600, 0x0603 }, + { 0x0610, 0x0615 }, { 0x064B, 0x065E }, { 0x0670, 0x0670 }, { 0x06D6, 0x06E4 }, { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED }, { 0x070F, 0x070F }, { 0x0711, 0x0711 }, { 0x0730, 0x074A }, - { 0x07A6, 0x07B0 }, { 0x0901, 0x0902 }, { 0x093C, 0x093C }, - { 0x0941, 0x0948 }, { 0x094D, 0x094D }, { 0x0951, 0x0954 }, - { 0x0962, 0x0963 }, { 0x0981, 0x0981 }, { 0x09BC, 0x09BC }, - { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD }, { 0x09E2, 0x09E3 }, - { 0x0A02, 0x0A02 }, { 0x0A3C, 0x0A3C }, { 0x0A41, 0x0A42 }, - { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D }, { 0x0A70, 0x0A71 }, - { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC }, { 0x0AC1, 0x0AC5 }, - { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD }, { 0x0B01, 0x0B01 }, - { 0x0B3C, 0x0B3C }, { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 }, - { 0x0B4D, 0x0B4D }, { 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 }, - { 0x0BC0, 0x0BC0 }, { 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 }, - { 0x0C46, 0x0C48 }, { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, + { 0x07A6, 0x07B0 }, { 0x07EB, 0x07F3 }, { 0x0901, 0x0902 }, + { 0x093C, 0x093C }, { 0x0941, 0x0948 }, { 0x094D, 0x094D }, + { 0x0951, 0x0954 }, { 0x0962, 0x0963 }, { 0x0981, 0x0981 }, + { 0x09BC, 0x09BC }, { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD }, + { 0x09E2, 0x09E3 }, { 0x0A01, 0x0A02 }, { 0x0A3C, 0x0A3C }, + { 0x0A41, 0x0A42 }, { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D }, + { 0x0A70, 0x0A71 }, { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC }, + { 0x0AC1, 0x0AC5 }, { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD }, + { 0x0AE2, 0x0AE3 }, { 0x0B01, 0x0B01 }, { 0x0B3C, 0x0B3C }, + { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 }, { 0x0B4D, 0x0B4D }, + { 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 }, { 0x0BC0, 0x0BC0 }, + { 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 }, { 0x0C46, 0x0C48 }, + { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, { 0x0CBC, 0x0CBC }, { 0x0CBF, 0x0CBF }, { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD }, - { 0x0D41, 0x0D43 }, { 0x0D4D, 0x0D4D }, { 0x0DCA, 0x0DCA }, - { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 }, { 0x0E31, 0x0E31 }, - { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, { 0x0EB1, 0x0EB1 }, - { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, { 0x0EC8, 0x0ECD }, - { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 }, { 0x0F37, 0x0F37 }, - { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E }, { 0x0F80, 0x0F84 }, - { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 }, { 0x0F99, 0x0FBC }, - { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, { 0x1032, 0x1032 }, - { 0x1036, 0x1037 }, { 0x1039, 0x1039 }, { 0x1058, 0x1059 }, - { 0x1160, 0x11FF }, { 0x1712, 0x1714 }, { 0x1732, 0x1734 }, - { 0x1752, 0x1753 }, { 0x1772, 0x1773 }, { 0x17B7, 0x17BD }, - { 0x17C6, 0x17C6 }, { 0x17C9, 0x17D3 }, { 0x180B, 0x180E }, - { 0x18A9, 0x18A9 }, { 0x200B, 0x200F }, { 0x202A, 0x202E }, - { 0x2060, 0x2063 }, { 0x206A, 0x206F }, { 0x20D0, 0x20EA }, - { 0x302A, 0x302F }, { 0x3099, 0x309A }, { 0xFB1E, 0xFB1E }, - { 0xFE00, 0xFE0F }, { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, - { 0xFFF9, 0xFFFB } + { 0x0CE2, 0x0CE3 }, { 0x0D41, 0x0D43 }, { 0x0D4D, 0x0D4D }, + { 0x0DCA, 0x0DCA }, { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 }, + { 0x0E31, 0x0E31 }, { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, + { 0x0EB1, 0x0EB1 }, { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, + { 0x0EC8, 0x0ECD }, { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 }, + { 0x0F37, 0x0F37 }, { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E }, + { 0x0F80, 0x0F84 }, { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 }, + { 0x0F99, 0x0FBC }, { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, + { 0x1032, 0x1032 }, { 0x1036, 0x1037 }, { 0x1039, 0x1039 }, + { 0x1058, 0x1059 }, { 0x1160, 0x11FF }, { 0x135F, 0x135F }, + { 0x1712, 0x1714 }, { 0x1732, 0x1734 }, { 0x1752, 0x1753 }, + { 0x1772, 0x1773 }, { 0x17B4, 0x17B5 }, { 0x17B7, 0x17BD }, + { 0x17C6, 0x17C6 }, { 0x17C9, 0x17D3 }, { 0x17DD, 0x17DD }, + { 0x180B, 0x180D }, { 0x18A9, 0x18A9 }, { 0x1920, 0x1922 }, + { 0x1927, 0x1928 }, { 0x1932, 0x1932 }, { 0x1939, 0x193B }, + { 0x1A17, 0x1A18 }, { 0x1B00, 0x1B03 }, { 0x1B34, 0x1B34 }, + { 0x1B36, 0x1B3A }, { 0x1B3C, 0x1B3C }, { 0x1B42, 0x1B42 }, + { 0x1B6B, 0x1B73 }, { 0x1DC0, 0x1DCA }, { 0x1DFE, 0x1DFF }, + { 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x2060, 0x2063 }, + { 0x206A, 0x206F }, { 0x20D0, 0x20EF }, { 0x302A, 0x302F }, + { 0x3099, 0x309A }, { 0xA806, 0xA806 }, { 0xA80B, 0xA80B }, + { 0xA825, 0xA826 }, { 0xFB1E, 0xFB1E }, { 0xFE00, 0xFE0F }, + { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, { 0xFFF9, 0xFFFB }, + { 0x10A01, 0x10A03 }, { 0x10A05, 0x10A06 }, { 0x10A0C, 0x10A0F }, + { 0x10A38, 0x10A3A }, { 0x10A3F, 0x10A3F }, { 0x1D167, 0x1D169 }, + { 0x1D173, 0x1D182 }, { 0x1D185, 0x1D18B }, { 0x1D1AA, 0x1D1AD }, + { 0x1D242, 0x1D244 }, { 0xE0001, 0xE0001 }, { 0xE0020, 0xE007F }, + { 0xE0100, 0xE01EF } }; - int mid, min = 0, max = sizeof(combining)/sizeof(*combining) - 1; - if (c < 0x0300 || c > 0xfffb) - return 0; - while (max >= min) - { - mid = (min + max) / 2; - if (c > combining[mid].last) - min = mid + 1; - else if (c < combining[mid].first) - max = mid - 1; - else - return 1; - } - return 0; + return bisearch(c, combining, sizeof(combining) / sizeof(struct interval) - 1); } static void @@ -959,10 +1043,9 @@ struct mchar *mc; isdouble = c1 >= 0x1100 && utf8_isdouble(c1); if (!combchars) { - combchars = (struct combchar **)malloc(sizeof(struct combchar *) * 0x802); + combchars = (struct combchar **)calloc(0x802, sizeof(struct combchar *)); if (!combchars) return; - bzero((char *)combchars, sizeof(struct combchar *) * 0x802); combchars[0x800] = (struct combchar *)malloc(sizeof(struct combchar)); combchars[0x801] = (struct combchar *)malloc(sizeof(struct combchar)); if (!combchars[0x800] || !combchars[0x801]) @@ -997,7 +1080,7 @@ struct mchar *mc; if (c1 >= 0xd800 && c1 < 0xe000) comb_tofront(root, c1 - 0xd800); i = combchars[root]->prev; - if (c1 == i + 0xd800) + if (c1 == i + 0xd800) { /* completely full, can't recycle */ debug("utf8_handle_comp: completely full!\n"); @@ -1159,6 +1242,8 @@ int *statep; *statep = c; return -1; } + if (c < 0x80) + return c; return c | (KANA << 16); } t = c; @@ -1166,11 +1251,16 @@ int *statep; *statep = 0; if (0x40 <= t && t <= 0xfc && t != 0x7f) { - if (c <= 0x9f) c = (c - 0x81) * 2 + 0x21; - else c = (c - 0xc1) * 2 + 0x21; - if (t <= 0x7e) t -= 0x1f; - else if (t <= 0x9e) t -= 0x20; - else t -= 0x7e, c++; + if (c <= 0x9f) + c = (c - 0x81) * 2 + 0x21; + else + c = (c - 0xc1) * 2 + 0x21; + if (t <= 0x7e) + t -= 0x1f; + else if (t <= 0x9e) + t -= 0x20; + else + t -= 0x7e, c++; return (c << 8) | t | (KANJI << 16); } return t; diff --git a/etc/ccdefs b/src/etc/ccdefs index 2fc98ff..2fc98ff 100755 --- a/etc/ccdefs +++ b/src/etc/ccdefs diff --git a/etc/completer.zsh b/src/etc/completer.zsh index bbbd01c..bbbd01c 100644 --- a/etc/completer.zsh +++ b/src/etc/completer.zsh diff --git a/etc/countmail b/src/etc/countmail index 974f143..974f143 100755 --- a/etc/countmail +++ b/src/etc/countmail diff --git a/etc/etcscreenrc b/src/etc/etcscreenrc index 3fc9c37..3fc9c37 100644 --- a/etc/etcscreenrc +++ b/src/etc/etcscreenrc diff --git a/etc/gr-braille.tbl b/src/etc/gr-braille.tbl index 34407b7..34407b7 100644 --- a/etc/gr-braille.tbl +++ b/src/etc/gr-braille.tbl diff --git a/etc/gs-braille.tbl b/src/etc/gs-braille.tbl index 0c5ef9b..0c5ef9b 100644 --- a/etc/gs-braille.tbl +++ b/src/etc/gs-braille.tbl diff --git a/etc/mkinstalldirs b/src/etc/mkinstalldirs index 0e29377..0e29377 100755 --- a/etc/mkinstalldirs +++ b/src/etc/mkinstalldirs diff --git a/etc/newsyntax b/src/etc/newsyntax index 6b5bb03..6b5bb03 100755 --- a/etc/newsyntax +++ b/src/etc/newsyntax diff --git a/etc/newsyntax38 b/src/etc/newsyntax38 index b22850d..b22850d 100755 --- a/etc/newsyntax38 +++ b/src/etc/newsyntax38 diff --git a/etc/screenrc b/src/etc/screenrc index ca6561d..ca6561d 100644 --- a/etc/screenrc +++ b/src/etc/screenrc diff --git a/etc/toolcheck b/src/etc/toolcheck index 1b8ee39..1b8ee39 100755 --- a/etc/toolcheck +++ b/src/etc/toolcheck diff --git a/etc/us-braille.tbl b/src/etc/us-braille.tbl index 640f62f..640f62f 100644 --- a/etc/us-braille.tbl +++ b/src/etc/us-braille.tbl @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,12 +19,12 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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: extern.h,v 1.18 1994/05/31 12:31:57 mlschroe Exp $ FAU + * $Id$ GNU */ #if !defined(__GNUC__) || __GNUC__ < 2 @@ -30,23 +35,32 @@ /* screen.c */ extern int main __P((int, char **)); extern sigret_t SigHup __P(SIGPROTOARG); -extern void eexit __P((int)); +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, char *, ...)) __attribute__((format(printf, 2, 3))); -extern void Panic __P((int, char *, ...)) __attribute__((format(printf, 2, 3))); +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 PutWinMsg __P((char *, int, int)); -extern void WindowDied __P((struct win *)); +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 */ @@ -65,7 +79,7 @@ extern void WindowChanged __P((struct win *, int)); extern int MFindUsedLine __P((struct win *, int, int)); /* fileio.c */ -extern void StartRc __P((char *)); +extern int StartRc __P((char *, int)); extern void FinishRc __P((char *)); extern void RcLine __P((char *, int)); extern FILE *secfopen __P((char *, char *)); @@ -113,7 +127,7 @@ 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 *)); +extern void Input __P((char *, int, int, void (*)(char *, int, char *), char *, int)); extern int InInput __P((void)); /* help.c */ @@ -122,7 +136,6 @@ 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 void display_wlist __P((int, int)); extern int InWList __P((void)); extern void WListUpdatecv __P((struct canvas *, struct win *)); extern void WListLinkChanged __P((void)); @@ -146,7 +159,9 @@ 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 @@ -185,7 +200,7 @@ 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((char *)); +extern int FindCommnr __P((const char *)); extern void DoCommand __P((char **, int *)); extern void Activate __P((int)); extern void KillWindow __P((struct win *)); @@ -229,7 +244,7 @@ extern void FreeTransTable __P((void)); extern int Attach __P((int)); extern void Attacher __P((void)); extern sigret_t AttacherFinit __P(SIGPROTOARG); -extern void SendCmdMessage __P((char *, char *, char **)); +extern void SendCmdMessage __P((char *, char *, char **, int)); /* display.c */ extern struct display *MakeDisplay __P((char *, char *, char *, int, int, struct mode *)); @@ -281,19 +296,12 @@ 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((void)); +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 -extern void SetCanvasWindow __P((struct canvas *, struct win *)); -extern int MakeDefaultCanvas __P((void)); -extern int AddCanvas __P((void)); -extern void RemCanvas __P((void)); -extern void OneCanvas __P((void)); -extern int RethinkDisplayViewports __P((void)); -extern void RethinkViewportOffsets __P((struct canvas *)); #ifdef RXVT_OSC extern void ClearAllXtermOSC __P((void)); extern void SetXtermOSC __P((int, char *)); @@ -335,6 +343,7 @@ 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)); /* misc.c */ extern char *SaveStr __P((const char *)); @@ -344,7 +353,7 @@ extern char *InStr __P((char *, const char *)); extern char *strerror __P((int)); #endif extern void centerline __P((char *, int)); -extern void leftline __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 @@ -436,7 +445,7 @@ extern void LKeypadMode __P((struct layer *, int)); extern void LCursorkeysMode __P((struct layer *, int)); extern void LMouseMode __P((struct layer *, int)); #ifdef USEVARARGS -extern void LMsg __P((int, char *, ...)) __attribute__((format(printf, 2, 3))); +extern void LMsg __P((int, const char *, ...)) __attribute__((format(printf, 2, 3))); #else extern void LMsg __P(()); #endif @@ -458,7 +467,7 @@ extern void TelStatus __P((struct win *, char *, int)); #endif /* nethack.c */ -extern char *DoNLS __P((char *)); +extern const char *DoNLS __P((const char *)); /* encoding.c */ #ifdef ENCODINGS @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,9 +19,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -24,6 +29,7 @@ #include <sys/types.h> #include <fcntl.h> #include <sys/stat.h> +#include <pwd.h> #ifndef SIGINT # include <signal.h> @@ -69,7 +75,7 @@ register char *str1, *str2; { len2 = strlen(str2); if ((cp = realloc(str2, (unsigned) len1 + len2 + add_colon + 1)) == NULL) - Panic(0, strnomem); + Panic(0, "%s", strnomem); bcopy(cp, cp + len1 + add_colon, len2 + 1); } else @@ -77,8 +83,8 @@ register char *str1, *str2; if (len1 == 0) return 0; if ((cp = malloc((unsigned) len1 + add_colon + 1)) == NULL) - Panic(0, strnomem); - cp[len1 + add_colon] = '\0'; + Panic(0, "%s", strnomem); + cp[len1 + add_colon] = '\0'; } bcopy(str1, cp, len1); if (add_colon) @@ -94,6 +100,42 @@ 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, '/'); @@ -128,9 +170,10 @@ char *rcfile; * 1) rcfilename = "/etc/screenrc" * 2) rcfilename = RcFileName */ -void -StartRc(rcfilename) +int +StartRc(rcfilename, nopanic) char *rcfilename; +int nopanic; { register int argc, len; register char *p, *cp; @@ -149,23 +192,25 @@ char *rcfilename; rc_name = findrcfile(rcfilename); - if ((fp = secfopen(rc_name, "r")) == NULL) + if (rc_name == NULL || (fp = secfopen(rc_name, "r")) == NULL) { - if (!rc_recursion && RcFileName && !strcmp(RcFileName, rc_name)) + 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, rcfilename); - Panic(0, "Unable to open \"%s\".", rc_name); - /* NOTREACHED */ + 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_name); - Free(rc_name); + debug1("StartRc: '%s' no good. ignored\n", rc_nonnull); + if (rc_name) + Free(rc_name); rc_name = oldrc_name; - return; + return 1; } while (fgets(buf, sizeof buf, fp) != NULL) { @@ -186,7 +231,7 @@ char *rcfilename; if (argc != 3) { AddStr("\r\n"); - Flush(); + Flush(0); } } else if (strcmp(args[0], "sleep") == 0) @@ -238,7 +283,7 @@ char *rcfilename; if (rc_recursion <= 10) { rc_recursion++; - StartRc(args[1]); + (void)StartRc(args[1], 0); rc_recursion--; } } @@ -246,6 +291,7 @@ char *rcfilename; fclose(fp); Free(rc_name); rc_name = oldrc_name; + return 0; } void @@ -258,23 +304,25 @@ char *rcfilename; rc_name = findrcfile(rcfilename); - if ((fp = secfopen(rc_name, "r")) == NULL) + 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_name); - else if (RcFileName && !strcmp(RcFileName, rc_name)) + 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, rcfilename); - Panic(0, "Unable to open \"%s\".", rc_name); + 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_name); - Free(rc_name); + debug1("FinishRc: '%s' no good. ignored\n", rc_nonnull); + if (rc_name) + Free(rc_name); rc_name = oldrc_name; return; } @@ -480,6 +528,7 @@ int dump; } if (dump == DUMP_SCROLLBACK) { +#ifdef COPY_PASTE for (i = 0; i < fore->w_histheight; i++) { p = (char *)(WIN(i)->image); @@ -489,6 +538,7 @@ int dump; putc(p[j], f); putc('\n', f); } +#endif } for (i = 0; i < fore->w_height; i++) { @@ -577,7 +627,7 @@ int *lenp; if ((buf = malloc(size)) == NULL) { close(i); - Msg(0, strnomem); + Msg(0, "%s", strnomem); return NULL; } errno = 0; @@ -779,7 +829,7 @@ char *cmd; #ifdef SIGPIPE signal(SIGPIPE, SIG_DFL); #endif - execl("/bin/sh", "sh", "-c", cmd, 0); + execl("/bin/sh", "sh", "-c", cmd, (char *)0); Panic(errno, "/bin/sh"); default: break; @@ -827,7 +877,7 @@ char **cmdv; #endif execvp(*cmdv, cmdv); close(1); - Panic(errno, *cmdv); + Panic(errno, "%s", *cmdv); default: break; } @@ -1,11 +1,19 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,9 +22,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -28,15 +36,24 @@ #include "screen.h" #include "extern.h" -char version[40]; /* initialised by main() */ +#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[]; +extern struct win **wtab; +#ifdef MAPKEYS +extern struct term term[]; +#endif + +extern struct LayFuncs ListLf; static void PadStr __P((char *, int, int, int)); @@ -65,13 +82,13 @@ char *myname, *message, *arg; #if defined(LOGOUTOK) && defined(UTMPOK) printf("-l Login mode on (update %s), -ln = off.\n", UTMPFILE); #endif - printf("-list or -ls. Do nothing, just list our SockDir.\n"); + printf("-ls [match] or -list. Do nothing, just list our SockDir [on possible matches].\n"); printf("-L Turn on output logging.\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("-r Reattach to a detached screen 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"); @@ -81,7 +98,7 @@ char *myname, *message, *arg; printf("-U Tell screen to use UTF-8 encoding.\n"); #endif printf("-v Print \"Screen version %s\".\n", version); - printf("-wipe Do nothing, just clean up SockDir.\n"); + 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 */ @@ -131,7 +148,8 @@ static struct LayFuncs HelpLf = DefClearLine, DefRewrite, DefResize, - DefRestore + DefRestore, + 0 }; @@ -161,7 +179,7 @@ struct action *ktabp; used[n] = 0; mcom = 0; mkey = 0; - for (key = 0; key < 256; key++) + for (key = 0; key < 256 + KMAP_KEYS; key++) { n = ktabp[key].nr; if (n == RC_ILLEGAL) @@ -314,7 +332,7 @@ helppage() x += helpdata->inter - !col; n = helpdata->nact[n]; buf[0] = '\0'; - for (key = 0; key < 256; key++) + for (key = 0; key < 256 + KMAP_KEYS; key++) if (ktabp[key].nr == n && ktabp[key].args == noargs && strlen(buf) < sizeof(buf) - 7) { strcat(buf, " "); @@ -333,13 +351,13 @@ helppage() while ((n = ktabp[helpdata->command_search].nr) == RC_ILLEGAL || ktabp[helpdata->command_search].args == noargs) { - if (++helpdata->command_search >= 256) + if (++helpdata->command_search >= 256 + KMAP_KEYS) return -1; } buf[0] = '\0'; add_key_to_buf(buf, helpdata->command_search); - PadStr(buf, 4, 0, crow); - AddAction(&ktabp[helpdata->command_search++], 4, crow); + PadStr(buf, 5, 0, crow); + AddAction(&ktabp[helpdata->command_search++], 5, crow); helpdata->grow++; } else @@ -425,6 +443,17 @@ int key; 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; } @@ -476,19 +505,22 @@ static struct LayFuncs CopyrightLf = DefClearLine, DefRewrite, DefResize, - DefRestore + DefRestore, + 0 }; static const char cpmsg[] = "\ \n\ Screen version %v\n\ \n\ -Copyright (c) 1993-2002 Juergen Weigert, Michael Schroeder\n\ +Copyright (c) 2010 Juergen Weigert, Sadrul Habib Chowdhury\n\ +Copyright (c) 2008, 2009 Juergen Weigert, Michael Schroeder, Micah Cowan, Sadrul Habib Chowdhury\n\ +Copyright (c) 1993-2002, 2003, 2005, 2006, 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 2, or (at your option) \ +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, \ @@ -497,13 +529,79 @@ 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, write to the \ -Free Software Foundation, Inc., \ -59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n\ +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.\n\ \n\ Send bugreports, fixes, enhancements, t-shirts, money, beer & pizza to \ -screen@uni-erlangen.de\n"; +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(ppbuf, plen) @@ -659,687 +757,6 @@ int y, xs, xe, isblank; } - -/* -** -** here is all the displays stuff -** -*/ - -#ifdef MULTI - -static void DisplaysProcess __P((char **, int *)); -static void DisplaysRedisplayLine __P((int, int, int, int)); -static void displayspage __P((void)); - -struct displaysdata -{ - int dummy_element_for_solaris; -}; - -static struct LayFuncs DisplaysLf = -{ - DisplaysProcess, - HelpAbort, - DisplaysRedisplayLine, - DefClearLine, - DefRewrite, - DefResize, - DefRestore -}; - -static void -DisplaysProcess(ppbuf, plen) -char **ppbuf; -int *plen; -{ - int done = 0; - - ASSERT(flayer); - while (!done && *plen > 0) - { - switch (**ppbuf) - { - case ' ': - displayspage(); - break; - case '\r': - case '\n': - HelpAbort(); - done = 1; - break; - default: - break; - } - ++*ppbuf; - --*plen; - } -} - - -void -display_displays() -{ - if (flayer->l_width < 10 || flayer->l_height < 5) - { - LMsg(0, "Window size too small for displays page"); - return; - } - if (InitOverlayPage(sizeof(struct displaysdata), &DisplaysLf, 0)) - return; - flayer->l_x = 0; - flayer->l_y = flayer->l_height - 1; - displayspage(); -} - -/* - * 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 void -displayspage() -{ - int y, l; - char tbuf[80]; - struct display *d; - struct win *w; - static char *blockstates[5] = {"nb", "NB", "Z<", "Z>", "BL"}; - - LClearAll(flayer, 0); - - leftline("term-type size user interface window", 0); - leftline("---------- ------- ---------- ----------------- ----------", 1); - y = 2; - - for (d = displays; d; d = d->d_next) - { - w = d->d_fore; - - if (y >= flayer->l_height - 3) - break; - 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) - { - 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, y); - y++; - } - sprintf(tbuf,"[Press Space %s Return to end.]", - 1 ? "to refresh;" : "or"); - centerline(tbuf, flayer->l_height - 2); - LaySetCursor(); -} - -static void -DisplaysRedisplayLine(y, xs, xe, isblank) -int y, xs, xe, isblank; -{ - ASSERT(flayer); - if (y < 0) - { - displayspage(); - return; - } - if (y != 0 && y != flayer->l_height - 1) - return; - if (isblank) - return; - LClearArea(flayer, xs, y, xe, y, 0, 0); - /* To be filled in... */ -} - -#endif /* MULTI */ - - -/* -** -** here is the windowlist -** -*/ - -struct wlistdata; - -static void WListProcess __P((char **, int *)); -static void WListRedisplayLine __P((int, int, int, int)); -static void wlistpage __P((void)); -static void WListLine __P((int, int, int, int)); -static void WListLines __P((int, int)); -static void WListMove __P((int, int)); -static void WListUpdate __P((struct win *)); -static int WListNormalize __P((void)); -static int WListResize __P((int, int)); -static int WListNext __P((struct wlistdata *, int, int)); - -struct wlistdata { - int pos; - int ypos; - int npos; - int numwin; - int first; - int last; - int start; - int order; -}; - -static struct LayFuncs WListLf = -{ - WListProcess, - HelpAbort, - WListRedisplayLine, - DefClearLine, - DefRewrite, - WListResize, - DefRestore -}; - -static int -WListResize(wi, he) -int wi, he; -{ - struct wlistdata *wlistdata; - if (wi < 10 || he < 5) - return -1; - wlistdata = (struct wlistdata *)flayer->l_data; - flayer->l_width = wi; - flayer->l_height = he; - wlistdata->numwin = he - 3; - if (wlistdata->ypos >= wlistdata->numwin) - wlistdata->ypos = wlistdata->numwin - 1; - flayer->l_y = he - 1; - return 0; -} - -static void -WListProcess(ppbuf, plen) -char **ppbuf; -int *plen; -{ - int done = 0; - struct wlistdata *wlistdata; - struct display *olddisplay = display; - int h; - - ASSERT(flayer); - wlistdata = (struct wlistdata *)flayer->l_data; - h = wlistdata->numwin; - while (!done && *plen > 0) - { - if ((unsigned char)**ppbuf >= '0' && (unsigned char)**ppbuf <= '9') - { - int n = (unsigned char)**ppbuf - '0'; - int d = 0; - if (n < MAXWIN && wtab[n]) - { - int i; - for (d = -wlistdata->npos, i = WListNext(wlistdata, -1, 0); i != n; i = WListNext(wlistdata, i, 1), d++) - ; - } - if (d) - WListMove(d, -1); - } - switch ((unsigned char)**ppbuf) - { - case 0220: /* up */ - case 16: /* ^P like emacs */ - case 'k': - WListMove(-1, -1); - break; - case 0216: /* down */ - case 14: /* ^N like emacs */ - case 'j': - WListMove(1, -1); - break; - case '\025': - WListMove(-(h / 2), wlistdata->ypos); - break; - case '\004': - WListMove(h / 2, wlistdata->ypos); - break; - case 0002: - case 'b': - WListMove(-h, -1); - break; - case 0006: - case 'f': - WListMove(h, -1); - break; - case 0201: /* home */ - WListMove(-wlistdata->pos, -1); - break; - case 0205: /* end */ - WListMove(MAXWIN, -1); - break; - case '\r': - case '\n': - case ' ': - done = 1; - h = wlistdata->pos; - if (!display || !wtab[h] || wtab[h] == D_fore || (flayer->l_cvlist && flayer->l_cvlist->c_lnext)) - HelpAbort(); -#ifdef MULTIUSER - else if (AclCheckPermWin(D_user, ACL_READ, wtab[h])) - HelpAbort(); -#endif - else - ExitOverlayPage(); /* no need to redisplay */ - /* restore display, don't switch wrong user */ - display = olddisplay; - SwitchWindow(h); - break; - case 0033: - case 0007: - h = wlistdata->start; - HelpAbort(); - display = olddisplay; - if (h >= 0 && wtab[h]) - SwitchWindow(h); - else if (h == -2) - { - struct win *p = FindNiceWindow(display ? D_other : (struct win *)0, 0); - if (p) - SwitchWindow(p->w_number); - } - done = 1; - break; - default: - break; - } - ++*ppbuf; - --*plen; - } -} - -static void -WListLine(y, i, pos, isblank) -int y, i; -int pos; -int isblank; -{ - char *str; - int n; - - display = 0; - str = MakeWinMsgEv(wliststr, wtab[i], '%', flayer->l_width, (struct event *)0, 0); - n = strlen(str); - if (i != pos && isblank) - while (n && str[n - 1] == ' ') - n--; - LPutWinMsg(flayer, str, (i == pos || !isblank) ? flayer->l_width : n, i == pos ? &mchar_so : &mchar_blank, 0, y + 2); -#if 0 - LPutStr(flayer, str, n, i == pos ? &mchar_so : &mchar_blank, 0, y + 2); - if (i == pos || !isblank) - while(n < flayer->l_width) - LPutChar(flayer, i == pos ? &mchar_so : &mchar_blank, n++, y + 2); -#endif - return; -} - -static int -WListNext(wlistdata, old, delta) -struct wlistdata *wlistdata; -int old, delta; -{ - int i, j; - - if (old == MAXWIN) - return MAXWIN; - if (wlistdata->order == WLIST_NUM) - { - if (old == -1) - { - for (old = 0; old < MAXWIN; old++) - if (wtab[old]) - break; - if (old == MAXWIN) - return old; - } - if (!wtab[old]) - return MAXWIN; - i = old; - while (delta > 0 && i < MAXWIN - 1) - if (wtab[++i]) - { - old = i; - delta--; - } - while (delta < 0 && i > 0) - if (wtab[--i]) - { - old = i; - delta++; - } - } - else - { - if (old == -1) - old = windows->w_number; - if (!wtab[old]) - return MAXWIN; - for (; delta > 0; delta--) - if (wtab[old]->w_next) - old = wtab[old]->w_next->w_number; - if (delta < 0) - { - for (j = i = windows->w_number; j != old; ) - { - if (delta++ >= 0 && wtab[i]->w_next) - i = wtab[i]->w_next->w_number; - if (wtab[j]->w_next) - j = wtab[j]->w_next->w_number; - } - old = i; - } - } - return old; -} - -static void -WListLines(up, oldpos) -int up, oldpos; -{ - struct wlistdata *wlistdata; - int ypos, pos; - int y, i, oldi; - - wlistdata = (struct wlistdata *)flayer->l_data; - ypos = wlistdata->ypos; - pos = wlistdata->pos; - - i = WListNext(wlistdata, pos, -ypos); - for (y = 0; y < wlistdata->numwin; y++) - { - if (i == MAXWIN || !wtab[i]) - return; - if (y == 0) - wlistdata->first = i; - wlistdata->last = i; - if (((i == oldpos || i == pos) && pos != oldpos) || (up > 0 && y >= wlistdata->numwin - up) || (up < 0 && y < -up)) - WListLine(y, i, pos, i != oldpos); - if (i == pos) - wlistdata->ypos = y; - oldi = i; - i = WListNext(wlistdata, i, 1); - if (i == MAXWIN || i == oldi) - break; - } -} - -static int -WListNormalize() -{ - struct wlistdata *wlistdata; - int i, oldi, n; - int ypos, pos; - - wlistdata = (struct wlistdata *)flayer->l_data; - ypos = wlistdata->ypos; - pos = wlistdata->pos; - if (ypos < 0) - ypos = 0; - if (ypos >= wlistdata->numwin) - ypos = wlistdata->numwin - 1; - for (n = 0, oldi = MAXWIN, i = pos; i != MAXWIN && i != oldi && n < wlistdata->numwin; oldi = i, i = WListNext(wlistdata, i, 1)) - n++; - if (ypos < wlistdata->numwin - n) - ypos = wlistdata->numwin - n; - for (n = 0, oldi = MAXWIN, i = WListNext(wlistdata, -1, 0); i != MAXWIN && i != oldi && i != pos; oldi = i, i = WListNext(wlistdata, i, 1)) - n++; - if (ypos > n) - ypos = n; - wlistdata->ypos = ypos; - wlistdata->npos = n; - return ypos; -} - -static void -WListMove(num, ypos) -int num; -int ypos; -{ - struct wlistdata *wlistdata; - int oldpos, oldypos, oldnpos; - int pos, up; - - wlistdata = (struct wlistdata *)flayer->l_data; - oldpos = wlistdata->pos; - oldypos = wlistdata->ypos; - oldnpos = wlistdata->npos; - wlistdata->ypos = ypos == -1 ? oldypos + num : ypos; - pos = WListNext(wlistdata, oldpos, num); - wlistdata->pos = pos; - ypos = WListNormalize(); - up = wlistdata->npos - ypos - (oldnpos - oldypos); - if (up) - { - LScrollV(flayer, up, 2, 2 + wlistdata->numwin - 1, 0); - WListLines(up, oldpos); - LaySetCursor(); - return; - } - if (pos == oldpos) - return; - WListLine(oldypos, oldpos, pos, 0); - WListLine(ypos, pos, pos, 1); - LaySetCursor(); -} - -static void -WListRedisplayLine(y, xs, xe, isblank) -int y, xs, xe, isblank; -{ - ASSERT(flayer); - if (y < 0) - { - wlistpage(); - return; - } - if (y != 0 && y != flayer->l_height - 1) - return; - if (!isblank) - LClearArea(flayer, xs, y, xe, y, 0, 0); -} - -void -display_wlist(onblank, order) -int onblank; -int order; -{ - struct win *p; - struct wlistdata *wlistdata; - - if (flayer->l_width < 10 || flayer->l_height < 5) - { - LMsg(0, "Window size too small for window list page"); - return; - } - if (onblank) - { - debug3("flayer %x %d %x\n", flayer, flayer->l_width, flayer->l_height); - if (!display) - { - LMsg(0, "windowlist -b: display required"); - return; - } - p = D_fore; - SetForeWindow((struct win *)0); - Activate(0); - if (flayer->l_width < 10 || flayer->l_height < 5) - { - LMsg(0, "Window size too small for window list page"); - return; - } - debug3("flayer %x %d %x\n", flayer, flayer->l_width, flayer->l_height); - } - else - p = Layer2Window(flayer); - if (InitOverlayPage(sizeof(*wlistdata), &WListLf, 0)) - return; - wlistdata = (struct wlistdata *)flayer->l_data; - flayer->l_x = 0; - flayer->l_y = flayer->l_height - 1; - wlistdata->start = onblank && p ? p->w_number : -1; - wlistdata->order = order; - wlistdata->pos = p ? p->w_number : WListNext(wlistdata, -1, 0); - wlistdata->ypos = wlistdata->npos = 0; - wlistdata->numwin= flayer->l_height - 3; - wlistpage(); -} - -static void -wlistpage() -{ - struct wlistdata *wlistdata; - char *str; - int pos; - - wlistdata = (struct wlistdata *)flayer->l_data; - - LClearAll(flayer, 0); - if (wlistdata->start >= 0 && wtab[wlistdata->start] == 0) - wlistdata->start = -2; - - pos = wlistdata->pos; - if (wtab[pos] == 0) - { - if (wlistdata->order == WLIST_MRU) - pos = WListNext(wlistdata, -1, wlistdata->npos); - else - { - /* find new position */ - while(++pos < MAXWIN) - if (wtab[pos]) - break; - if (pos == MAXWIN) - while (--pos > 0) - if (wtab[pos]) - break; - } - } - wlistdata->pos = pos; - - display = 0; - str = MakeWinMsgEv(wlisttit, (struct win *)0, '%', flayer->l_width, (struct event *)0, 0); - LPutWinMsg(flayer, str, strlen(str), &mchar_blank, 0, 0); - WListNormalize(); - WListLines(wlistdata->numwin, -1); - LaySetCursor(); -} - -static void -WListUpdate(p) -struct win *p; -{ - struct wlistdata *wlistdata; - int i, n, y; - - if (p == 0) - { - wlistpage(); - return; - } - wlistdata = (struct wlistdata *)flayer->l_data; - n = p->w_number; - if (wlistdata->order == WLIST_NUM && (n < wlistdata->first || n > wlistdata->last)) - return; - i = wlistdata->first; - for (y = 0; y < wlistdata->numwin; y++) - { - if (i == n) - break; - i = WListNext(wlistdata, i, 1); - } - if (y == wlistdata->numwin) - return; - WListLine(y, i, wlistdata->pos, 0); - LaySetCursor(); -} - -void -WListUpdatecv(cv, p) -struct canvas *cv; -struct win *p; -{ - if (cv->c_layer->l_layfn != &WListLf) - return; - CV_CALL(cv, WListUpdate(p)); -} - -void -WListLinkChanged() -{ - struct display *olddisplay = display; - struct canvas *cv; - struct wlistdata *wlistdata; - - for (display = displays; display; display = display->d_next) - for (cv = D_cvlist; cv; cv = cv->c_next) - { - if (cv->c_layer->l_layfn != &WListLf) - continue; - wlistdata = (struct wlistdata *)cv->c_layer->l_data; - if (wlistdata->order != WLIST_MRU) - continue; - CV_CALL(cv, WListUpdate(0)); - } - display = olddisplay; -} - -int -InWList() -{ - if (flayer && flayer->l_layfn == &WListLf) - return 1; - return 0; -} - - - /* ** ** The bindkey help page @@ -1347,8 +764,6 @@ InWList() */ #ifdef MAPKEYS - -extern struct term term[]; extern struct kmap_ext *kmap_exts; extern int kmap_extn; extern struct action dmtab[]; @@ -1378,7 +793,8 @@ static struct LayFuncs BindkeyLf = DefClearLine, DefRewrite, DefResize, - DefRestore + DefRestore, + 0 }; @@ -1575,7 +991,8 @@ static struct LayFuncs ZmodemLf = DefClearLine, DefRewrite, ZmodemResize, - DefRestore + DefRestore, + 0 }; /*ARGSUSED*/ @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,12 +19,12 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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: image.h,v 1.9 1994/05/31 12:31:54 mlschroe Exp $ FAU + * $Id$ GNU */ @@ -161,3 +166,12 @@ IFDWCHAR((mc)->mbcs = 0; ) \ # define cole2i(c) ((c) ^ 9) # endif #endif + +enum +{ + REND_BELL = 0, + REND_MONITOR, + REND_SILENCE, + NUM_RENDS +}; + @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,9 +19,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -41,10 +46,14 @@ struct inpline char buf[101]; /* text buffer */ int len; /* length of the editible string */ int pos; /* cursor position in editable string */ + struct inpline *next, *prev; }; -static struct inpline inphist; /* XXX: should be a dynamic list */ - +/* '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 { @@ -55,6 +64,8 @@ struct inpdata 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 = @@ -65,7 +76,8 @@ static struct LayFuncs InpLf = DefClearLine, DefRewrite, DefResize, - DefRestore + DefRestore, + 0 }; /* @@ -93,6 +105,8 @@ char *p, *s; 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; } /* @@ -106,16 +120,20 @@ char *p, *s; * INP_EVERY == digraph mode. */ void -Input(istr, len, mode, finfunc, data) +Input(istr, len, mode, finfunc, priv, data) char *istr; int len; int mode; -void (*finfunc) __P((char *buf, int len, char *data)); -char *data; +void (*finfunc) __P((char *buf, int len, char *priv)); +char *priv; +int data; { int maxlen; struct inpdata *inpdata; + if (!flayer) + return; + if (len > 100) len = 100; if (!(mode & INP_NOECHO)) @@ -131,15 +149,58 @@ char *data; } 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->priv = data; - inp_setprompt(istr, (char *)NULL); - flayer->l_x = inpdata->inpstringlen; - flayer->l_y = INPUTLINE; + 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 @@ -152,10 +213,13 @@ int *plen; 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) { @@ -174,10 +238,12 @@ int *plen; if (inpdata->inpmode & INP_EVERY) { inpdata->inp.buf[inpdata->inp.len] = ch; - inpdata->inp.buf[inpdata->inp.len + 1] = ch; /* gross */ - display = inpdisplay; - (*inpdata->inpfinfunc)(inpdata->inp.buf, inpdata->inp.len, inpdata->priv); - ch = inpdata->inp.buf[inpdata->inp.len]; + 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) { @@ -211,33 +277,16 @@ int *plen; LGotoPos(flayer, x, INPUTLINE); } } + RESET_SEARCH; } else if ((ch == '\b' || ch == 0177) && inpdata->inp.pos > 0) { - if (inpdata->inp.len > inpdata->inp.pos) - bcopy(p, p-1, inpdata->inp.len - inpdata->inp.pos); - inpdata->inp.len--; - inpdata->inp.pos--; - p--; - - if (!(inpdata->inpmode & INP_NOECHO)) - { - struct mchar mc; - mc = mchar_so; - x--; - while (p < inpdata->inp.buf+inpdata->inp.len) - { - mc.image = *p++; - LPutChar(flayer, &mc, x++, INPUTLINE); - } - LPutChar(flayer, &mchar_blank, x, INPUTLINE); - x = inpdata->inpstringlen + inpdata->inp.pos; - LGotoPos(flayer, x, INPUTLINE); - } + erase_chars(inpdata, p-1, p, x, 1); + RESET_SEARCH; } else if (ch == '\025') /* CTRL-U */ { - x = inpdata->inpstringlen; + x = inpdata->inpstringlen; if (inpdata->inp.len && !(inpdata->inpmode & INP_NOECHO)) { LClearArea(flayer, x, INPUTLINE, x + inpdata->inp.len - 1, INPUTLINE, 0, 0); @@ -247,7 +296,7 @@ int *plen; } else if (ch == '\013') /* CTRL-K */ { - x = inpdata->inpstringlen + inpdata->inp.pos; + 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); @@ -255,6 +304,21 @@ int *plen; } 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); @@ -275,22 +339,57 @@ int *plen; LGotoPos(flayer, ++x, INPUTLINE); inpdata->inp.pos++; } - else if (ch == '\020' || (unsigned char)ch == 0220) /* CTRL-P */ - { + 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); - inpdata->inp = inphist; /* structure copy */ + 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; + x = inpdata->inpstringlen; p = inpdata->inp.buf; - + if (!(inpdata->inpmode & INP_NOECHO)) { while (p < inpdata->inp.buf+inpdata->inp.len) @@ -299,21 +398,48 @@ int *plen; LPutChar(flayer, &mc, x++, INPUTLINE); } } - x = inpdata->inpstringlen + inpdata->inp.pos; + x = inpdata->inpstringlen + inpdata->inp.pos; LGotoPos(flayer, x, INPUTLINE); } - else if (ch == '\004' || ch == '\003' || ch == '\007' || ch == '\033' || + else if (ch == '\003' || ch == '\007' || ch == '\033' || ch == '\000' || ch == '\n' || ch == '\r') { - if (ch != '\004' && 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 == 0) - inphist = inpdata->inp; /* structure copy */ - - flayer->l_data = 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; @@ -322,9 +448,17 @@ int *plen; (*inpdata->inpfinfunc)(inpdata->inp.buf, inpdata->inp.len, inpdata->priv); else (*inpdata->inpfinfunc)(pbuf - 1, 0, inpdata->priv); - free((char *)inpdata); + 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)) { @@ -348,7 +482,7 @@ int y, xs, xe, isblank; { int q, r, s, l, v; struct inpdata *inpdata; - + inpdata = (struct inpdata *)flayer->l_data; if (y != INPUTLINE) { @@ -392,11 +526,3 @@ int y, xs, xe, isblank; } } -int -InInput() -{ - if (flayer && flayer->l_layfn == &InpLf) - return 1; - return 0; -} - diff --git a/src/install.sh b/src/install.sh new file mode 100755 index 0000000..8c07c50 --- /dev/null +++ b/src/install.sh @@ -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 @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,9 +19,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -81,6 +86,12 @@ int off; # define RECODE_MLINE(ml) (ml) #endif +#define FOR_EACH_UNPAUSED_CANVAS(l, fn) for (cv = (l)->l_cvlist; cv; cv = cv->c_lnext) \ + { \ + if ((l)->l_pause.d && cv->c_slorient) \ + continue; \ + fn \ + } void LGotoPos(l, x, y) @@ -91,11 +102,14 @@ int x, y; struct viewport *vp; int x2, y2; + if (l->l_pause.d) + LayPauseUpdateRegion(l, x, x, y, y); + #ifdef HAVE_BRAILLE if (bd.bd_refreshing) return; #endif - for (cv = l->l_cvlist; cv; cv = cv->c_lnext) + FOR_EACH_UNPAUSED_CANVAS(l, { display = cv->c_display; if (D_blocked) @@ -123,6 +137,7 @@ int x, y; break; } } + ); } void @@ -138,7 +153,9 @@ struct mline *ol; if (n == 0) return; - for (cv = l->l_cvlist; cv; cv = cv->c_lnext) + if (l->l_pause.d) + LayPauseUpdateRegion(l, xs, xe, y, y); + FOR_EACH_UNPAUSED_CANVAS(l, for (vp = cv->c_vplist; vp; vp = vp->v_next) { y2 = y + vp->v_yoff; @@ -175,6 +192,7 @@ struct mline *ol; if (xs2 <= xe2) RefreshArea(xs2, y2, xe2, y2, 1); } + ); } void @@ -189,7 +207,9 @@ int bce; int ys2, ye2, xs2, xe2; if (n == 0) return; - for (cv = l->l_cvlist; cv; cv = cv->c_lnext) + if (l->l_pause.d) + LayPauseUpdateRegion(l, 0, l->l_width - 1, ys, ye); + FOR_EACH_UNPAUSED_CANVAS(l, for (vp = cv->c_vplist; vp; vp = vp->v_next) { xs2 = vp->v_xoff; @@ -237,6 +257,7 @@ int bce; if (ys2 <= ye2) RefreshArea(xs2, ys2, xe2, ye2, 1); } + ); } void @@ -252,7 +273,9 @@ struct mline *ol; struct mchar *c2, cc; struct mline *rol; - for (cv = l->l_cvlist; cv; cv = cv->c_lnext) + if (l->l_pause.d) + LayPauseUpdateRegion(l, x, l->l_width - 1, y, y); + FOR_EACH_UNPAUSED_CANVAS(l, for (vp = cv->c_vplist; vp; vp = vp->v_next) { y2 = y + vp->v_yoff; @@ -291,6 +314,7 @@ struct mline *ol; if (f) RefreshArea(xs2, y2, xs2, y2, 1); } + ); } void @@ -309,7 +333,17 @@ int x, y; return; } #endif - for (cv = l->l_cvlist; cv; cv = cv->c_lnext) + + if (l->l_pause.d) + LayPauseUpdateRegion(l, x, +#ifdef DW_CHARS + x + (c->mbcs ? 1 : 0) +#else + x +#endif + , y, y); + + FOR_EACH_UNPAUSED_CANVAS(l, { display = cv->c_display; if (D_blocked) @@ -326,6 +360,7 @@ int x, y; break; } } + ); } void @@ -350,7 +385,10 @@ int x, y; return; } #endif - for (cv = l->l_cvlist; cv; cv = cv->c_lnext) + if (l->l_pause.d) + LayPauseUpdateRegion(l, x, x + n - 1, y, y); + + FOR_EACH_UNPAUSED_CANVAS(l, for (vp = cv->c_vplist; vp; vp = vp->v_next) { y2 = y + vp->v_yoff; @@ -386,6 +424,7 @@ int x, y; while (xs2++ <= xe2) PUTCHARLP(*s2++); } + ); } void @@ -398,7 +437,6 @@ int x, y; { struct canvas *cv; struct viewport *vp; - char *s2; int xs2, xe2, y2, len, len2; struct mchar or; @@ -411,10 +449,12 @@ int x, y; return; } #endif + if (l->l_pause.d) + LayPauseUpdateRegion(l, x, x + n - 1, y, y); len = strlen(s); if (len > n) len = n; - for (cv = l->l_cvlist; cv; cv = cv->c_lnext) + FOR_EACH_UNPAUSED_CANVAS(l, for (vp = cv->c_vplist; vp; vp = vp->v_next) { y2 = y + vp->v_yoff; @@ -436,17 +476,8 @@ int x, y; len2 = xe2 - (x + vp->v_xoff) + 1; if (len2 > len) len2 = len; - if (!PutWinMsg(s, xs2 - x - vp->v_xoff, len2)) - { - s2 = s + xs2 - x - vp->v_xoff; - while (len2-- > 0) - { - PUTCHARLP(*s2++); - xs2++; - } - } - else - xs2 = x + vp->v_xoff + len2; + PutWinMsg(s, xs2 - x - vp->v_xoff, len2); + xs2 = x + vp->v_xoff + len2; if (xs2 < vp->v_xs) xs2 = vp->v_xs; or = D_rend; @@ -455,6 +486,7 @@ int x, y; while (xs2++ <= xe2) PUTCHARLP(' '); } + ); } void @@ -472,7 +504,9 @@ struct mline *ol; xs = l->l_width - 1; if (xe >= l->l_width) xe = l->l_width - 1; - for (cv = l->l_cvlist; cv; cv = cv->c_lnext) + if (l->l_pause.d) + LayPauseUpdateRegion(l, xs, xe, y, y); + FOR_EACH_UNPAUSED_CANVAS(l, for (vp = cv->c_vplist; vp; vp = vp->v_next) { xs2 = xs + vp->v_xoff; @@ -491,6 +525,7 @@ struct mline *ol; continue; ClearLine(ol ? mloff(RECODE_MLINE(ol), -vp->v_xoff) : (struct mline *)0, y2, xs2, xe2, bce); } + ); } void @@ -507,12 +542,18 @@ int uself; if (bd.bd_refreshing) return; #endif + /* Check for zero-height window */ + if (ys < 0 || ye < ys) + return; + /* check for magic margin condition */ if (xs >= l->l_width) xs = l->l_width - 1; if (xe >= l->l_width) xe = l->l_width - 1; - for (cv = l->l_cvlist; cv; cv = cv->c_lnext) + if (l->l_pause.d) + LayPauseUpdateRegion(l, xs, xe, ys, ye); + FOR_EACH_UNPAUSED_CANVAS(l, { display = cv->c_display; if (D_blocked) @@ -559,9 +600,20 @@ int uself; xe2 = vp->v_xe; display = cv->c_display; ClearArea(xs2, ys2, vp->v_xs, vp->v_xe, xe2, ye2, bce, uself); + if (xe == l->l_width - 1 && xe2 > vp->v_xoff + xe) + { + int y; + SetRendition(&mchar_blank); + for (y = ys2; y <= ye2; y++) + { + GotoPos(xe + vp->v_xoff + 1, y); + PUTCHARLP('|'); + } + } #endif } } + ); } void @@ -581,7 +633,9 @@ int isblank; return; } #endif - for (cv = l->l_cvlist; cv; cv = cv->c_lnext) + if (l->l_pause.d) + LayPauseUpdateRegion(l, xs, xe, y, y); + FOR_EACH_UNPAUSED_CANVAS(l, { display = cv->c_display; if (D_blocked) @@ -605,6 +659,7 @@ int isblank; DisplayLine(isblank ? &mline_blank : &mline_null, mloff(RECODE_MLINE(ml), -vp->v_xoff), y2, xs2, xe2); } } + ); } void @@ -657,6 +712,10 @@ int ins; int yy, y2, yy2, top2, bot2; int bce; + if (l->l_pause.d) + /* XXX: 'y'? */ + LayPauseUpdateRegion(l, 0, l->l_width - 1, top, bot); + #ifdef COLOR bce = rend_getbg(c); #else @@ -669,7 +728,7 @@ int ins; /* cursor after wrapping */ yy = y == l->l_height - 1 ? y : y + 1; - for (cv = l->l_cvlist; cv; cv = cv->c_lnext) + FOR_EACH_UNPAUSED_CANVAS(l, { y2 = 0; /* gcc -Wall */ display = cv->c_display; @@ -709,12 +768,13 @@ int ins; WrapChar(RECODE_MCHAR(c), vp->v_xoff + l->l_width, y2, vp->v_xoff, -1, vp->v_xoff + l->l_width - 1, -1, ins); } } + ); } else { /* hard case: scroll up*/ - for (cv = l->l_cvlist; cv; cv = cv->c_lnext) + FOR_EACH_UNPAUSED_CANVAS(l, { display = cv->c_display; if (D_blocked) @@ -762,6 +822,7 @@ int ins; WrapChar(RECODE_MCHAR(c), vp->v_xoff + l->l_width, bot2, vp->v_xoff, top2, vp->v_xoff + l->l_width - 1, bot2, ins); } } + ); } } @@ -849,9 +910,6 @@ int on; } } - -/*******************************************************************/ - void LClearAll(l, uself) struct layer *l; @@ -880,6 +938,53 @@ int isblank; flayer = oldflayer; } +void +/*VARARGS2*/ +#if defined(USEVARARGS) && defined(__STDC__) +LMsg(int err, const char *fmt, VA_DOTS) +#else +LMsg(err, fmt, VA_DOTS) +int err; +const char *fmt; +VA_DECL +#endif +{ + VA_LIST(ap) + char buf[MAXPATHLEN*2]; + char *p = buf; + struct canvas *cv; + + VA_START(ap, fmt); + fmt = DoNLS(fmt); + (void)vsnprintf(p, sizeof(buf) - 100, fmt, VA_ARGS(ap)); + VA_END(ap); + if (err) + { + p += strlen(p); + *p++ = ':'; + *p++ = ' '; + strncpy(p, strerror(err), buf + sizeof(buf) - p - 1); + buf[sizeof(buf) - 1] = 0; + } + debug2("LMsg('%s') (%#x);\n", buf, (unsigned int)flayer); + for (display = displays; display; display = display->d_next) + { + for (cv = D_cvlist; cv; cv = cv->c_next) + if (cv->c_layer == flayer) + break; + if (cv == 0) + continue; + MakeStatus(buf); + } +} + + +/*******************************************************************/ +/*******************************************************************/ + +/* + * Layer creation / removal + */ void KillLayerChain(lay) @@ -911,12 +1016,6 @@ struct layer *lay; } -/*******************************************************************/ -/*******************************************************************/ - -/* - * Layer creation / removal - */ int InitOverlayPage(datasize, lf, block) @@ -944,13 +1043,12 @@ int block; data = 0; if (datasize) { - if ((data = malloc(datasize)) == 0) + if ((data = calloc(1, datasize)) == 0) { free((char *)newlay); Msg(0, "No memory for layer data"); return -1; } - bzero(data, datasize); } p = Layer2Window(flayer); @@ -1009,6 +1107,8 @@ int block; return 0; } +extern struct layout *layouts; + void ExitOverlayPage() { @@ -1016,12 +1116,17 @@ ExitOverlayPage() struct win *p; int doredisplay = 0; struct canvas *cv, *ocv; + struct layout *lay; ASSERT(flayer); debug1("Exiting layer %#x\n", (unsigned int)flayer); oldlay = flayer; if (oldlay->l_data) - free(oldlay->l_data); + { + if (oldlay->l_layfn->lf_LayFree) + LayFree(oldlay->l_data); + free(oldlay->l_data); + } p = Layer2Window(flayer); @@ -1050,6 +1155,11 @@ ExitOverlayPage() p->w_paster.pa_pastelayer = 0; #endif + for (lay = layouts; lay; lay = lay->lay_next) + for (cv = lay->lay_cvlist; cv; cv = cv->c_next) + if (cv->c_layer == oldlay) + cv->c_layer = flayer; + /* add all canvases back into next layer's canvas list */ for (ocv = 0, cv = oldlay->l_cvlist; cv; cv = cv->c_lnext) { @@ -1067,48 +1177,175 @@ ExitOverlayPage() ocv->c_lnext = cv; } oldlay->l_cvlist = 0; + LayerCleanupMemory(oldlay); free((char *)oldlay); LayRestore(); LaySetCursor(); } -void -/*VARARGS2*/ -#if defined(USEVARARGS) && defined(__STDC__) -LMsg(int err, char *fmt, VA_DOTS) -#else -LMsg(err, fmt, VA_DOTS) -int err; -char *fmt; -VA_DECL -#endif +int +LayProcessMouse(struct layer *l, unsigned char ch) +{ + /* XXX: Make sure the layer accepts mouse events */ + int len; + + if (l->l_mouseevent.len >= sizeof(l->l_mouseevent.buffer)) + return -1; + + len = l->l_mouseevent.len++; + l->l_mouseevent.buffer[len] = (len > 0 ? ch - 33 : ch); + return (l->l_mouseevent.len == sizeof(l->l_mouseevent.buffer)); +} + +int +LayProcessMouseSwitch(struct layer *l, int s) +{ + if ((l->l_mouseevent.start = s)) + { + l->l_mouseevent.len = 0; + } +} + +void LayPause(layer, pause) +struct layer *layer; +int pause; { - VA_LIST(ap) - char buf[MAXPATHLEN*2]; - char *p = buf; struct canvas *cv; + struct display *olddisplay = display; + int line; + struct win *win; - VA_START(ap, fmt); - fmt = DoNLS(fmt); - (void)vsnprintf(p, sizeof(buf) - 100, fmt, VA_ARGS(ap)); - VA_END(ap); - if (err) + pause = !!pause; + + if (layer->l_pause.d == pause) + return; + + if ((layer->l_pause.d = pause)) { - p += strlen(p); - *p++ = ':'; - *p++ = ' '; - strncpy(p, strerror(err), buf + sizeof(buf) - p - 1); - buf[sizeof(buf) - 1] = 0; + /* Start pausing */ + layer->l_pause.top = layer->l_pause.bottom = -1; + return; } - debug2("LMsg('%s') (%#x);\n", buf, (unsigned int)flayer); - for (display = displays; display; display = display->d_next) + + /* Unpause. So refresh the regions in the displays! */ + if (layer->l_pause.top == -1 && + layer->l_pause.bottom == -1) + return; + + if (layer->l_layfn == &WinLf) /* Currently, this will always be the case! */ + win = layer->l_data; + else + win = NULL; + + for (cv = layer->l_cvlist; cv; cv = cv->c_lnext) { - for (cv = D_cvlist; cv; cv = cv->c_next) - if (cv->c_layer == flayer) - break; - if (cv == 0) - continue; - MakeStatus(buf); + struct viewport *vp; + + if (!cv->c_slorient) + continue; /* Wasn't split, so already updated. */ + + display = cv->c_display; + + for (vp = cv->c_vplist; vp; vp = vp->v_next) + { + for (line = layer->l_pause.top; line <= layer->l_pause.bottom; line++) + { + int xs, xe; + + if (line + vp->v_yoff >= vp->v_ys && line + vp->v_yoff <= vp->v_ye && + ((xs = layer->l_pause.left[line]) >= 0) && + ((xe = layer->l_pause.right[line]) >= 0)) + { + xs += vp->v_xoff; + xe += vp->v_xoff; + + if (xs < vp->v_xs) xs = vp->v_xs; + if (xe > vp->v_xe) xe = vp->v_xe; + +#if defined(DW_CHARS) && defined(UTF8) + if (layer->l_encoding == UTF8 && xe < vp->v_xe && win) + { + struct mline *ml = win->w_mlines + line; + if (dw_left(ml, xe, UTF8)) + xe++; + } +#endif + + if (xs <= xe) + RefreshLine(line + vp->v_yoff, xs, xe, 0); + } + } + } + + if (cv == D_forecv) + { + int cx = layer->l_x + cv->c_xoff; + int cy = layer->l_y + cv->c_yoff; + + if (cx < cv->c_xs) cx = cv->c_xs; + if (cy < cv->c_ys) cy = cv->c_ys; + if (cx > cv->c_xe) cx = cv->c_xe; + if (cy > cv->c_ye) cy = cv->c_ye; + + GotoPos(cx, cy); + } + } + + for (line = layer->l_pause.top; line <= layer->l_pause.bottom; line++) + layer->l_pause.left[line] = layer->l_pause.right[line] = -1; + olddisplay = display; +} + +void +LayPauseUpdateRegion(layer, xs, xe, ys, ye) +struct layer *layer; +int xs, xe; +int ys, ye; +{ + if (!layer->l_pause.d) + return; + if (ys < 0) + ys = 0; + if (ye >= layer->l_height) + ye = layer->l_height - 1; + if (xe >= layer->l_width) + xe = layer->l_width - 1; + + if (layer->l_pause.top == -1 || layer->l_pause.top > ys) + layer->l_pause.top = ys; + if (layer->l_pause.bottom < ye) + { + layer->l_pause.bottom = ye; + if (layer->l_pause.lines <= ye) + { + int o = layer->l_pause.lines; + layer->l_pause.lines = ye + 32; + layer->l_pause.left = realloc(layer->l_pause.left, sizeof(int) * layer->l_pause.lines); + layer->l_pause.right = realloc(layer->l_pause.right, sizeof(int) * layer->l_pause.lines); + while (o < layer->l_pause.lines) + { + layer->l_pause.left[o] = layer->l_pause.right[o] = -1; + o++; + } + } + } + + while (ys <= ye) + { + if (layer->l_pause.left[ys] == -1 || layer->l_pause.left[ys] > xs) + layer->l_pause.left[ys] = xs; + if (layer->l_pause.right[ys] < xe) + layer->l_pause.right[ys] = xe; + ys++; } } +void +LayerCleanupMemory(layer) +struct layer *layer; +{ + if (layer->l_pause.left) + free(layer->l_pause.left); + if (layer->l_pause.right) + free(layer->l_pause.right); +} @@ -1,11 +1,16 @@ -/* Copyright (c) 1995-2002 +/* 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 2, or (at your option) + * 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, @@ -14,14 +19,17 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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: overlay.h,v 1.3 1994/05/31 12:32:31 mlschroe Exp $ FAU + * $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. @@ -38,6 +46,8 @@ struct LayFuncs 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 @@ -49,11 +59,30 @@ struct layer int l_y; int l_encoding; struct LayFuncs *l_layfn; - char *l_data; + 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) @@ -63,6 +92,7 @@ struct layer #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) @@ -103,3 +133,31 @@ struct layer 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)); + diff --git a/src/layout.c b/src/layout.c new file mode 100644 index 0000000..584abbd --- /dev/null +++ b/src/layout.c @@ -0,0 +1,406 @@ +/* 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 + * http://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(cv) +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(title, startat) +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(name, cv) +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(lay) +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(name) +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(lay, cv) +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_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(title, startat) +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(buf, len, where) +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(where) +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(lay) +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(cv, wi) +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(cv, file) +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(cv, filename) +struct canvas *cv; +char *filename; +{ + FILE *file = secfopen(filename, "a"); + if (!file) + return 0; + dump_canvas(cv, file); + fclose(file); + return 1; +} + +void RenameLayout(layout, name) +struct layout *layout; +const char *name; +{ + free(layout->lay_title); + layout->lay_title = SaveStr(name); +} + +int RenumberLayout(layout, number) +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; +} diff --git a/src/layout.h b/src/layout.h new file mode 100644 index 0000000..1814226 --- /dev/null +++ b/src/layout.h @@ -0,0 +1,60 @@ +/* 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 + * http://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 void RenameLayout __P((struct layout *, const char *)); +extern int RenumberLayout __P((struct layout *, int)); + +#endif /* SCREEN_LAYOUT_H */ + diff --git a/src/list_display.c b/src/list_display.c new file mode 100644 index 0000000..4e740c1 --- /dev/null +++ b/src/list_display.c @@ -0,0 +1,243 @@ +/* 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 + * http://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 "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); +} + +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 */ + diff --git a/src/list_generic.c b/src/list_generic.c new file mode 100644 index 0000000..e32acf7 --- /dev/null +++ b/src/list_generic.c @@ -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 + * http://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(); +} + diff --git a/src/list_generic.h b/src/list_generic.h new file mode 100644 index 0000000..234f6de --- /dev/null +++ b/src/list_generic.h @@ -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 + * http://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)); + diff --git a/src/list_window.c b/src/list_window.c new file mode 100644 index 0000000..4fd65d0 --- /dev/null +++ b/src/list_window.c @@ -0,0 +1,710 @@ +/* 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 + * http://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')) + { + *buf = 0; + 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); + } + + display = 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; + display = Layer2Window(flayer) ? 0 : flayer->l_cvlist ? flayer->l_cvlist->c_display : 0; + 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; /* 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, 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, 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 %x %d %x\n", 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; + struct gl_Window_Data *wdata; + + if (cv->c_layer->l_layfn != &ListLf) + return; + ldata = cv->c_layer->l_data; + if (ldata->name != ListID) + return; + wdata = ldata->data; + 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; +} + @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,9 +19,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ diff --git a/logfile.c b/src/logfile.c index d2eacce..edee89d 100644 --- a/logfile.c +++ b/src/logfile.c @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,9 +19,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ diff --git a/logfile.h b/src/logfile.h index 0d1ac40..c588a32 100644 --- a/logfile.h +++ b/src/logfile.h @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,12 +19,12 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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: logfile.h,v 1.11 1994/05/31 12:33:27 jnweiger Exp $ FAU + * $Id$ GNU */ struct logfile @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,14 +19,15 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ #include <sys/types.h> +#include <ctype.h> #include "config.h" #include "screen.h" @@ -63,7 +69,7 @@ extern struct mchar mchar_so; int pastefont = 1; #endif -static struct LayFuncs MarkLf = +struct LayFuncs MarkLf = { MarkProcess, MarkAbort, @@ -71,7 +77,8 @@ static struct LayFuncs MarkLf = DefClearLine, MarkRewrite, DefResize, - DefRestore + DefRestore, + 0 }; int join_with_cr = 0; @@ -134,6 +141,58 @@ int y; return x; } +/* + * nextchar sets *xp to the num-th occurrence of the target in the line. + * + * Returns -1 if the target doesn't appear num times, 0 otherwise. + */ +static int +nextchar(int *xp, int *yp, int direction, char target, int num) +{ + int width; /* width of the current window. */ + int x; /* x coordinate of the current cursor position. */ + int step; /* amount to increment x (+1 or -1) */ + int adjust; /* Final adjustment of cursor position. */ + char *displayed_line; /* Line in which search takes place. */ + + debug("nextchar\n"); + + x = *xp; + adjust = 0; + width = fore->w_width; + displayed_line = (char *)WIN(*yp) -> image; + + switch(direction) { + case 't': + adjust = -1; /* fall through */ + case 'f': + step = 1; + break; + case 'T': + adjust = 1; /* fall through */ + case 'F': + step = -1; + break; + default: + ASSERT(0); + } + + x += step; + + debug1("ml->image = %s\n", displayed_line); + debug2("num = %d, width = %d\n",num, width); + debug2("x = %d target = %c\n", x, target ); + + for ( ;x>=0 && x <= width; x += step) { + if (displayed_line[x] == target) { + if (--num == 0) { + *xp = x + adjust; + return 0; + } + } + } + return -1; +} /* * nextword calculates the cursor position of the num'th word. @@ -149,6 +208,8 @@ int y; #define NW_MUSTMOVE (1<<2) #define NW_BIG (1<<3) + + static void nextword(xp, yp, flags, num) int *xp, *yp, flags, num; @@ -442,6 +503,7 @@ MarkRoutine() if (InitOverlayPage(sizeof(*markdata), &MarkLf, 1)) return; flayer->l_encoding = fore->w_encoding; + flayer->l_mode = 1; markdata = (struct markdata *)flayer->l_data; markdata->md_user = D_user; /* XXX: Correct? */ markdata->md_window = fore; @@ -500,21 +562,24 @@ int *inlenp; in_mark = 1; while (in_mark && (inlen /* || extrap */)) { -/* - if (extrap) + unsigned char ch = (unsigned char )*pt++; + inlen--; + if (flayer->l_mouseevent.start) { - od = *extrap++; - if (*extrap == 0) - extrap = 0; - } - else -*/ - { - od = mark_key_tab[(int)(unsigned char)*pt++]; - inlen--; + int r = LayProcessMouse(flayer, ch); + if (r == -1) + LayProcessMouseSwitch(flayer, 0); + else + { + if (r) + ch = 0222; + else + continue; + } } + od = mark_key_tab[(int)ch]; rep_cnt = markdata->rep_cnt; - if (od >= '0' && od <= '9') + if (od >= '0' && od <= '9' && !markdata->f_cmd.flag) { if (rep_cnt < 1001 && (od != '0' || rep_cnt != 0)) { @@ -534,8 +599,51 @@ int *inlenp; } cx = markdata->cx; cy = markdata->cy; + + if (markdata -> f_cmd.flag) { + debug2("searching for %c:%d\n",od,rep_cnt); + markdata->f_cmd.flag = 0; + markdata->rep_cnt = 0; + + if (isgraph (od)) { + markdata->f_cmd.target = od; + rep_cnt = (rep_cnt) ? rep_cnt : 1; + nextchar(&cx, &cy, markdata->f_cmd.direction, od, rep_cnt ); + revto(cx, cy); + continue; + } + } + +processchar: switch (od) - { + { + case 'f': /* fall through */ + case 'F': /* fall through */ + case 't': /* fall through */ + case 'T': /* fall through */ + /* + * Set f_cmd to do a search on the next key stroke. + * If we break, rep_cnt will be reset, so we + * continue instead. It might be cleaner to + * store the rep_count in f_cmd and + * break here so later followon code will be + * hit. + */ + markdata->f_cmd.flag = 1; + markdata->f_cmd.direction = od; + debug("entering char search\n"); + continue; + case ';': + case ',': + if (!markdata->f_cmd.target) + break; + if (!rep_cnt) + rep_cnt = 1; + nextchar(&cx, &cy, + od == ';' ? markdata->f_cmd.direction : (markdata->f_cmd.direction ^ 0x20), + markdata->f_cmd.target, rep_cnt ); + revto(cx, cy); + break; case 'o': case 'x': if (!markdata->second) @@ -663,7 +771,7 @@ int *inlenp; LGotoPos(flayer, cx, W2D(cy)); break; case '@': - /* it may be usefull to have a key that does nothing */ + /* it may be useful to have a key that does nothing */ break; case '%': rep_cnt--; @@ -794,6 +902,11 @@ int *inlenp; case 'n': Search(0); break; + case 'N': + markdata->isdir = -markdata->isdir; + Search(0); + markdata->isdir = -markdata->isdir; + break; case 'y': case 'Y': if (markdata->second == 0) @@ -923,6 +1036,7 @@ int *inlenp; LAY_CALL_UP(LRefreshAll(flayer, 0)); } ExitOverlayPage(); + WindowChanged(fore, 'P'); if (append_mode) LMsg(0, "Appended %d characters to buffer", newcopylen); @@ -933,6 +1047,39 @@ int *inlenp; in_mark = 0; break; } + + case 0222: + if (flayer->l_mouseevent.start) + { + int button = flayer->l_mouseevent.buffer[0]; + if (button == 'a') + { + /* Scroll down */ + od = 'j'; + } + else if (button == '`') + { + /* Scroll up */ + od = 'k'; + } + else if (button == ' ') + { + /* Left click */ + cx = flayer->l_mouseevent.buffer[1]; + cy = D2W(flayer->l_mouseevent.buffer[2]); + revto(cx, cy); + od = ' '; + } + else + od = 0; + LayProcessMouseSwitch(flayer, 0); + if (od) + goto processchar; + } + else + LayProcessMouseSwitch(flayer, 1); + break; + default: MarkAbort(); LMsg(0, "Copy mode aborted"); @@ -1009,6 +1156,8 @@ int tx, ty, line; if (markdata->second == 0) { + flayer->l_x = tx; + flayer->l_y = W2D(ty); LGotoPos(flayer, tx, W2D(ty)); return; } @@ -1105,6 +1254,8 @@ int tx, ty, line; #endif } } + flayer->l_x = tx; + flayer->l_y = W2D(ty); LGotoPos(flayer, tx, W2D(ty)); } @@ -1132,6 +1283,7 @@ MarkAbort() rem(markdata->x1, markdata->y1, markdata->cx, markdata->cy, redisp, (char *)0, yend); } ExitOverlayPage(); + WindowChanged(fore, 'P'); } @@ -1338,14 +1490,6 @@ int n; return n; } -int -InMark() -{ - if (flayer && flayer->l_layfn == &MarkLf) - return 1; - return 0; -} - void MakePaster(pa, buf, len, bufiscopy) struct paster *pa; @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,12 +19,12 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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: mark.h,v 1.1.1.1 1993/06/16 23:51:13 jnweiger Exp $ FAU + * $Id$ GNU */ struct markdata @@ -41,6 +46,10 @@ struct markdata 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; + }; @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,9 +19,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -52,7 +57,7 @@ register const char *str; register char *cp; if ((cp = malloc(strlen(str) + 1)) == NULL) - Panic(0, strnomem); + Panic(0, "%s", strnomem); else strcpy(cp, str); return cp; @@ -66,7 +71,7 @@ int n; register char *cp; if ((cp = malloc(n + 1)) == NULL) - Panic(0, strnomem); + Panic(0, "%s", strnomem); else { bcopy((char *)str, cp, n); @@ -120,9 +125,10 @@ int y; } void -leftline(str, y) +leftline(str, y, rend) char *str; int y; +struct mchar *rend; { int l, n; struct mchar mchar_dol; @@ -134,7 +140,7 @@ int y; l = n = strlen(str); if (n > flayer->l_width - 1) n = flayer->l_width - 1; - LPutStr(flayer, str, n, &mchar_blank, 0, y); + LPutStr(flayer, str, n, rend ? rend : &mchar_blank, 0, y); if (n != l) LPutChar(flayer, &mchar_dol, n, y); } @@ -603,7 +609,7 @@ char *value; * the string space, we can free our buf now. */ free(buf); -# else /* NEEDSETENV */ +# else /* NEEDPUTENV */ /* * For all sysv-ish systems that link a standard putenv() * the string-space buf is added to the environment and must not @@ -611,13 +617,13 @@ char *value; * We are sorry to say that memory is lost here, when setting * the same variable again and again. */ -# endif /* NEEDSETENV */ +# endif /* NEEDPUTENV */ #else /* USESETENV */ -# if defined(linux) || defined(__convex__) || (BSD >= 199103) +# if HAVE_SETENV_3 setenv(var, value, 1); # else setenv(var, value); -# endif /* linux || convex || BSD >= 199103 */ +# endif /* HAVE_SETENV_3 */ #endif /* USESETENV */ } @@ -646,39 +652,6 @@ int (*outc) __P((int)); return 0; } -# ifdef linux - -/* stupid stupid linux ncurses! It won't to padding with - * zeros but sleeps instead. This breaks CalcCost, of course. - * Also, the ncurses wait functions use a global variable - * to store the current outc function. Oh well... - */ - -int (*save_outc) __P((int)); - -# undef tputs - -void -xtputs(str, affcnt, outc) -char *str; -int affcnt; -int (*outc) __P((int)); -{ - extern int tputs __P((const char *, int, int (*)(int))); - save_outc = outc; - tputs(str, affcnt, outc); -} - -int -_nc_timed_wait(mode, ms, tlp) -int mode, ms, *tlp; -{ - _delay(ms * 10, save_outc); - return 0; -} - -# endif /* linux */ - #endif /* TERMINFO */ diff --git a/nethack.c b/src/nethack.c index 585dc43..d8ae456 100644 --- a/nethack.c +++ b/src/nethack.c @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,9 +19,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -115,9 +120,9 @@ static struct nlstrans nethacktrans[] = { }; #endif -char * +const char * DoNLS(from) -char *from; +const char *from; { #ifdef NETHACK struct nlstrans *t; @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,12 +19,12 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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: os.h,v 1.10 1994/05/31 12:32:22 mlschroe Exp $ FAU + * $Id$ GNU */ #include <stdio.h> @@ -36,6 +41,10 @@ # 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 @@ -70,26 +79,12 @@ extern int errno; #undef strerror #endif -#if !defined(SYSV) && !defined(linux) -# ifdef NEWSOS -# define strlen ___strlen___ -# include <strings.h> -# undef strlen -# else /* NEWSOS */ -# include <strings.h> -# endif /* NEWSOS */ -#else /* SYSV */ -# if defined(SVR4) || defined(NEWSOS) -# define strlen ___strlen___ -# include <string.h> -# undef strlen -# if !defined(NEWSOS) && !defined(__hpux) - extern size_t strlen(const char *); -# endif -# else /* SVR4 */ -# include <string.h> -# endif /* SVR4 */ -#endif /* SYSV */ +#ifdef HAVE_STRINGS_H +# include <strings.h> +#endif +#ifdef HAVE_STRING_H +# include <string.h> +#endif #ifdef USEVARARGS # if defined(__STDC__) @@ -156,12 +151,12 @@ extern int errno; # endif #endif -#ifdef hpux +#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) +#if defined(HAVE_SETEUID) || defined(HAVE_SETREUID) || defined(HAVE_SETRESUID) # define USE_SETEUID #endif @@ -239,11 +234,6 @@ extern int errno; # undef TIOCPKT #endif -/* linux ncurses is broken, we have to use our own tputs */ -#if defined(linux) && defined(TERMINFO) -# define tputs xtputs -#endif - /* Alexandre Oliva: SVR4 style ptys don't work with osf */ #ifdef __osf__ # undef HAVE_SVR4_PTYS diff --git a/osdef.h.in b/src/osdef.h.in index 8c6ed0d..2253218 100644 --- a/osdef.h.in +++ b/src/osdef.h.in @@ -5,7 +5,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * 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, @@ -14,12 +14,12 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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: osdef.h.in,v 1.2 1994/05/31 12:32:25 mlschroe Exp $ FAU + * $Id$ GNU */ /**************************************************************** @@ -82,14 +82,13 @@ extern int waitpid __P((int, int *, int)); extern int getdtablesize __P((void)); -#ifdef HAVE_SETREUID -# ifdef hpux +#ifdef HAVE_SETRESUID extern int setresuid __P((int, int, int)); extern int setresgid __P((int, int, int)); -# else +#endif +#ifdef HAVE_SETREUID extern int setreuid __P((int, int)); extern int setregid __P((int, int)); -# endif #endif #ifdef HAVE_SETEUID extern int seteuid __P((int)); diff --git a/patchlevel.h b/src/patchlevel.h index 122e97b..0695698 100644 --- a/patchlevel.h +++ b/src/patchlevel.h @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,12 +19,12 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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: patchlevel.h,v 1.17 1994/05/31 12:32:35 mlschroe Exp $ FAU + * $Id$ GNU */ /**************************************************************** @@ -519,14 +524,15 @@ * 05.12.2003 4.00.02 fixed a bug in the ansi parser. fixed execs * on ttys. fixed hardstatus line on blanked screen. * -- DISTRIBUTED - * 23.10.2006 4.00.03 fixed two bug in combining characters handling - * (cstone & Rich Felker). - * -- 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 "FAU" +#define ORIGIN "GNU" #define REV 4 -#define VERS 0 -#define PATCHLEVEL 3 -#define DATE "23-Oct-06" -#define STATE "" +#define VERS 1 +#define PATCHLEVEL 0 +#define DATE "2-May-06" +#define STATE "devel" diff --git a/process.c b/src/process.c index 7f1a6e1..dfa7c82 100644 --- a/process.c +++ b/src/process.c @@ -1,11 +1,19 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,13 +22,15 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ +#include "config.h" + #include <sys/types.h> #include <sys/stat.h> #include <signal.h> @@ -34,16 +44,17 @@ #endif -#include "config.h" - /* for solaris 2.1, Unixware (SVR4.2) and possibly others: */ -#ifdef SVR4 +#ifdef HAVE_STROPTS_H # include <sys/stropts.h> #endif #include "screen.h" #include "extern.h" #include "logfile.h" +#include "layout.h" +#include "viewport.h" +#include "list_generic.h" extern struct comm comms[]; extern char *rc_name; @@ -52,6 +63,7 @@ extern char *BellString, *ActivityString, *ShellProg, *ShellArgs[]; extern char *hstatusstring, *captionstring, *timestring; extern char *wliststr, *wlisttit; extern int captionalways; +extern int queryflag; extern char *hardcopydir, *screenlogfile, *logtstamp_string; extern int log_flush, logtstamp_on, logtstamp_after; extern char *VisualBellString; @@ -59,6 +71,7 @@ extern int VBellWait, MsgWait, MsgMinWait, SilenceWait; extern char SockPath[], *SockName; extern int TtyMode, auto_detach, use_altscreen; extern int iflag, maxwin; +extern int focusminwidth, focusminheight; extern int use_hardstatus, visual_bell; #ifdef COLOR extern int attr2color[][4]; @@ -69,8 +82,10 @@ extern char *printcmd; extern int default_startup; extern int defobuflimit; extern int defnonblock; +extern int defmousetrack; extern int ZombieKey_destroy; extern int ZombieKey_resurrect; +extern int ZombieKey_onerror; #ifdef AUTO_NUKE extern int defautonuke; #endif @@ -99,10 +114,14 @@ extern char *kmapadef[]; extern char *kmapmdef[]; #endif extern struct mchar mchar_so, mchar_null; +extern int renditions[]; extern int VerboseCreate; #ifdef UTF8 extern char *screenencodings; #endif +#ifdef DW_CHARS +extern int cjkwidth; +#endif static int CheckArgNum __P((int, char **)); static void ClearAction __P((struct action *)); @@ -143,21 +162,26 @@ static void pass2 __P((char *, int, char *)); static void pow_detach_fn __P((char *, int, char *)); #endif static void digraph_fn __P((char *, int, char *)); +static int digraph_find __P((const char *buf)); static void confirm_fn __P((char *, int, char *)); static int IsOnDisplay __P((struct win *)); -static void ResizeRegions __P((char*)); +static void ResizeRegions __P((char *, int)); static void ResizeFin __P((char *, int, char *)); static struct action *FindKtab __P((char *, int)); +static void SelectFin __P((char *, int, char *)); +static void SelectLayoutFin __P((char *, int, char *)); extern struct layer *flayer; extern struct display *display, *displays; extern struct win *fore, *console_window, *windows; extern struct acluser *users; +extern struct layout *layouts, *layout_attach, layout_last_marker; +extern struct layout *laytab[]; extern char screenterm[], HostName[], version[]; extern struct NewWindow nwin_undef, nwin_default; -extern struct LayFuncs WinLf; +extern struct LayFuncs WinLf, MarkLf; extern int Z0width, Z1width; extern int real_uid, real_gid; @@ -167,7 +191,7 @@ extern int nethackflag; #endif -struct win *wtab[MAXWIN]; /* window table, should be dynamic */ +extern struct win **wtab; #ifdef MULTIUSER extern char *multi; @@ -197,11 +221,11 @@ struct action idleaction; char **blankerprg; #endif -struct action ktab[256]; /* command key translation table */ +struct action ktab[256 + KMAP_KEYS]; /* command key translation table */ struct kclass { struct kclass *next; char *name; - struct action ktab[256]; + struct action ktab[256 + KMAP_KEYS]; }; struct kclass *kclasses; @@ -214,9 +238,18 @@ int kmap_extn; static int maptimeout = 300; #endif +#ifndef MAX_DIGRAPH +#define MAX_DIGRAPH 512 +#endif + +struct digraph +{ + unsigned char d[2]; + int value; +}; /* digraph table taken from old vim and rfc1345 */ -static const unsigned char digraphs[][3] = { +static struct digraph digraphs[MAX_DIGRAPH + 1] = { {' ', ' ', 160}, /* */ {'N', 'S', 160}, /* */ {'~', '!', 161}, /* ¡ */ @@ -390,6 +423,58 @@ static const unsigned char digraphs[][3] = { {'"', '~', 223} /* ß */ }; +#define RESIZE_FLAG_H 1 +#define RESIZE_FLAG_V 2 +#define RESIZE_FLAG_L 4 + +static char *resizeprompts[] = { + "resize # lines: ", + "resize -h # lines: ", + "resize -v # lines: ", + "resize -b # lines: ", + "resize -l # lines: ", + "resize -l -h # lines: ", + "resize -l -v # lines: ", + "resize -l -b # lines: ", +}; + +static int +parse_input_int(buf, len, val) +const char *buf; +int len; +int *val; +{ + int x = 0, i; + if (len >= 1 && ((*buf == 'U' && buf[1] == '+') || (*buf == '0' && (buf[1] == 'x' || buf[1] == 'X')))) + { + x = 0; + for (i = 2; i < len; i++) + { + if (buf[i] >= '0' && buf[i] <= '9') + x = x * 16 | (buf[i] - '0'); + else if (buf[i] >= 'a' && buf[i] <= 'f') + x = x * 16 | (buf[i] - ('a' - 10)); + else if (buf[i] >= 'A' && buf[i] <= 'F') + x = x * 16 | (buf[i] - ('A' - 10)); + else + return 0; + } + } + else if (buf[0] == '0') + { + x = 0; + for (i = 1; i < len; i++) + { + if (buf[i] < '0' || buf[i] > '7') + return 0; + x = x * 8 | (buf[i] - '0'); + } + } + else + return 0; + *val = x; + return 1; +} char *noargs[1]; @@ -506,7 +591,7 @@ InitKeytab() args[1] = NULL; SaveAction(ktab + '-', RC_SELECT, args, 0); } - for (i = 0; i < ((MAXWIN < 10) ? MAXWIN : 10); i++) + for (i = 0; i < ((maxwin && maxwin < 10) ? maxwin : 10); i++) { char *args[2], arg1[10]; args[0] = arg1; @@ -552,6 +637,18 @@ InitKeytab() ktab['X'].nr = RC_REMOVE; ktab['F'].nr = RC_FIT; ktab['\t'].nr = RC_FOCUS; + { + char *args[2]; + args[0] = "prev"; + args[1] = 0; + SaveAction(ktab + T_BACKTAB - T_CAPS + 256, RC_FOCUS, args, 0); + } + { + char *args[2]; + args[0] = "-v"; + args[1] = 0; + SaveAction(ktab + '|', RC_SPLIT, args, 0); + } /* These come last; they may want overwrite others: */ if (DefaultEsc >= 0) { @@ -594,7 +691,7 @@ int create; kp = malloc(sizeof(*kp)); if (kp == 0) { - Msg(0, strnomem); + Msg(0, "%s", strnomem); return 0; } kp->name = SaveStr(class); @@ -602,6 +699,8 @@ int create; { kp->ktab[i].nr = RC_ILLEGAL; kp->ktab[i].args = noargs; + kp->ktab[i].argl = 0; + kp->ktab[i].quiet = 0; } kp->next = 0; *kpp = kp; @@ -898,7 +997,7 @@ struct paster *pa; int FindCommnr(str) -char *str; +const char *str; { int x, m, l = 0, r = RC_LAST; while (l <= r) @@ -1018,6 +1117,28 @@ char **args; return i; } +static void +StuffFin(buf, len, data) +char *buf; +int len; +char *data; +{ + if (!flayer) + return; + while(len) + LayProcess(&buf, &len); +} + +/* If the command is not 'quieted', then use Msg to output the message. If it's a remote + * query, then Msg takes care of also outputting the message to the querying client. + * + * If we want the command to be quiet, and it's a remote query, then use QueryMsg so that + * the response does go back to the querying client. + * + * If the command is quieted, and it's not a remote query, then just don't print the message. + */ +#define OutputMsg (!act->quiet ? Msg : queryflag >= 0 ? QueryMsg : Dummy) + /*ARGSUSED*/ void DoAction(act, key) @@ -1033,6 +1154,7 @@ int key; char ch; struct display *odisplay = display; struct acluser *user; + struct layout *layout; user = display ? D_user : users; if (nr == RC_ILLEGAL) @@ -1041,19 +1163,35 @@ int key; return; } n = comms[nr].flags; + /* Commands will have a CAN_QUERY flag, depending on whether they have + * something to return on a query. For example, 'windows' can return a result, + * but 'other' cannot. + * If some command causes an error, then it should reset queryflag to -1, so that + * the process requesting the query can be notified that an error happened. + */ + if (!(n & CAN_QUERY) && queryflag >= 0) + { + /* Query flag is set, but this command cannot be queried. */ + OutputMsg(0, "%s command cannot be queried.", comms[nr].name); + queryflag = -1; + return; + } if ((n & NEED_DISPLAY) && display == 0) { - Msg(0, "%s: %s: display required", rc_name, comms[nr].name); + OutputMsg(0, "%s: %s: display required", rc_name, comms[nr].name); + queryflag = -1; return; } if ((n & NEED_FORE) && fore == 0) { - Msg(0, "%s: %s: window required", rc_name, comms[nr].name); + OutputMsg(0, "%s: %s: window required", rc_name, comms[nr].name); + queryflag = -1; return; } if ((n & NEED_LAYER) && flayer == 0) { - Msg(0, "%s: %s: display or window required", rc_name, comms[nr].name); + OutputMsg(0, "%s: %s: display or window required", rc_name, comms[nr].name); + queryflag = -1; return; } if ((argc = CheckArgNum(nr, args)) < 0) @@ -1063,8 +1201,9 @@ int key; { if (AclCheckPermCmd(D_user, ACL_EXEC, &comms[nr])) { - Msg(0, "%s: %s: permission denied (user %s)", + OutputMsg(0, "%s: %s: permission denied (user %s)", rc_name, comms[nr].name, (EffectiveAclUser ? EffectiveAclUser : D_user)->u_name); + queryflag = -1; return; } } @@ -1084,7 +1223,10 @@ int key; else if (args[0][0] == '.' && !args[0][1]) { if (!fore) - Msg(0, "select . needs a window"); + { + OutputMsg(0, "select . needs a window"); + queryflag = -1; + } else { SetForeWindow(fore); @@ -1093,22 +1235,24 @@ int key; } else if (ParseWinNum(act, &n) == 0) SwitchWindow(n); + else if (queryflag >= 0) + queryflag = -1; /* ParseWinNum already prints out an appropriate error message. */ break; #ifdef AUTO_NUKE case RC_DEFAUTONUKE: if (ParseOnOff(act, &defautonuke) == 0 && msgok) - Msg(0, "Default autonuke turned %s", defautonuke ? "on" : "off"); + OutputMsg(0, "Default autonuke turned %s", defautonuke ? "on" : "off"); if (display && *rc_name) D_auto_nuke = defautonuke; break; case RC_AUTONUKE: if (ParseOnOff(act, &D_auto_nuke) == 0 && msgok) - Msg(0, "Autonuke turned %s", D_auto_nuke ? "on" : "off"); + OutputMsg(0, "Autonuke turned %s", D_auto_nuke ? "on" : "off"); break; #endif case RC_DEFOBUFLIMIT: if (ParseNum(act, &defobuflimit) == 0 && msgok) - Msg(0, "Default limit set to %d", defobuflimit); + OutputMsg(0, "Default limit set to %d", defobuflimit); if (display && *rc_name) { D_obufmax = defobuflimit; @@ -1117,9 +1261,9 @@ int key; break; case RC_OBUFLIMIT: if (*args == 0) - Msg(0, "Limit is %d, current buffer size is %d", D_obufmax, D_obuflen); + OutputMsg(0, "Limit is %d, current buffer size is %d", D_obufmax, D_obuflen); else if (ParseNum(act, &D_obufmax) == 0 && msgok) - Msg(0, "Limit set to %d", D_obufmax); + OutputMsg(0, "Limit set to %d", D_obufmax); D_obuflenmax = D_obuflen - D_obufmax; break; case RC_DUMPTERMCAP: @@ -1128,22 +1272,27 @@ int key; case RC_HARDCOPY: { int mode = DUMP_HARDCOPY; + char *file = NULL; - if (argc > 1 && !strcmp(*args, "-h")) + if (args[0]) { - mode = DUMP_SCROLLBACK; - args++; - argc--; + if (!strcmp(*args, "-h")) + { + mode = DUMP_SCROLLBACK; + file = args[1]; + } + else if (!strcmp(*args, "--") && args[1]) + file = args[1]; + else + file = args[0]; } - if (*args && args[1]) + + if (args[0] && file == args[0] && args[1]) { - Msg(0, "%s: hardcopy: too many arguments", rc_name); + OutputMsg(0, "%s: hardcopy: too many arguments", rc_name); break; } - if (fore == 0 && *args == 0) - Msg(0, "%s: hardcopy: window required", rc_name); - else - WriteFile(user, *args, mode); + WriteFile(user, file, mode); } break; case RC_DEFLOG: @@ -1174,9 +1323,9 @@ int key; if (key >= 0) { #ifdef PSEUDOS - Input(fore->w_pwin ? "Really kill this filter [y/n]" : "Really kill this window [y/n]", 1, INP_RAW, confirm_fn, (char *)RC_KILL); + Input(fore->w_pwin ? "Really kill this filter [y/n]" : "Really kill this window [y/n]", 1, INP_RAW, confirm_fn, NULL, RC_KILL); #else - Input("Really kill this window [y/n]", 1, INP_RAW, confirm_fn, (char *)RC_KILL); + Input("Really kill this window [y/n]", 1, INP_RAW, confirm_fn, NULL, RC_KILL); #endif break; } @@ -1185,13 +1334,13 @@ int key; if (fore->w_pwin) { FreePseudowin(fore); - Msg(0, "Filter removed."); + OutputMsg(0, "Filter removed."); break; } #endif name = SaveStr(fore->w_title); KillWindow(fore); - Msg(0, "Window %d (%s) killed.", n, name); + OutputMsg(0, "Window %d (%s) killed.", n, name); if (name) free(name); break; @@ -1199,7 +1348,7 @@ int key; case RC_QUIT: if (key >= 0) { - Input("Really quit and kill all your windows [y/n]", 1, INP_RAW, confirm_fn, (char *)RC_QUIT); + Input("Really quit and kill all your windows [y/n]", 1, INP_RAW, confirm_fn, NULL, RC_QUIT); break; } Finit(0); @@ -1218,7 +1367,7 @@ int key; static char buf[2]; buf[0] = key; - Input(buf, 1, INP_RAW, pow_detach_fn, NULL); + Input(buf, 1, INP_RAW, pow_detach_fn, NULL, 0); } else Detach(D_POWER); /* detach and kill Attacher's parent */ @@ -1230,9 +1379,9 @@ int key; if (!*args) { if (dfp) - Msg(0, "debugging info is written to %s/", DEBUGDIR); + OutputMsg(0, "debugging info is written to %s/", DEBUGDIR); else - Msg(0, "debugging is currently off. Use 'debug on' to enable."); + OutputMsg(0, "debugging is currently off. Use 'debug on' to enable."); break; } if (dfp) @@ -1250,7 +1399,7 @@ int key; # endif /* SIG_NODEBUG */ #else if (*args == 0 || strcmp("off", *args)) - Msg(0, "Sorry, screen was compiled without -DDEBUG option."); + OutputMsg(0, "Sorry, screen was compiled without -DDEBUG option."); #endif break; #ifdef ZMODEM @@ -1263,7 +1412,7 @@ int key; zmodem_sendcmd = SaveStr(args[1]); } if (msgok) - Msg(0, "zmodem sendcmd: %s", zmodem_sendcmd); + OutputMsg(0, "zmodem sendcmd: %s", zmodem_sendcmd); break; } if (*args && !strcmp(*args, "recvcmd")) @@ -1274,7 +1423,7 @@ int key; zmodem_recvcmd = SaveStr(args[1]); } if (msgok) - Msg(0, "zmodem recvcmd: %s", zmodem_recvcmd); + OutputMsg(0, "zmodem recvcmd: %s", zmodem_recvcmd); break; } if (*args) @@ -1286,15 +1435,24 @@ int key; i = 1; if (i == 4) { - Msg(0, "usage: zmodem off|auto|catch|pass"); + OutputMsg(0, "usage: zmodem off|auto|catch|pass"); break; } zmodem_mode = i; } if (msgok) - Msg(0, "zmodem mode is %s", zmodes[zmodem_mode]); + OutputMsg(0, "zmodem mode is %s", zmodes[zmodem_mode]); break; #endif + case RC_UNBINDALL: + { + register unsigned int i; + + for (i = 0; i < sizeof(ktab)/sizeof(*ktab); i++) + ClearAction(&ktab[i]); + OutputMsg(0, "Unbound all keys." ); + break; + } case RC_ZOMBIE: { if (!(s = *args)) @@ -1304,9 +1462,20 @@ int key; } if (*argl == 0 || *argl > 2) { - Msg(0, "%s:zombie: one or two characters expected.", rc_name); + OutputMsg(0, "%s:zombie: one or two characters expected.", rc_name); break; } + if (args[1]) + { + if (!strcmp(args[1], "onerror")) + { + ZombieKey_onerror = 1; + } else { + OutputMsg(0, "usage: zombie [keys [onerror]]"); + break; + } + } else + ZombieKey_onerror = 0; ZombieKey_destroy = args[0][0]; ZombieKey_resurrect = *argl == 2 ? args[0][1] : 0; } @@ -1320,18 +1489,20 @@ int key; { struct display *olddisplay = display; display = 0; /* no display will cause a broadcast */ - Msg(0, "%s: %s", s, *args); + OutputMsg(0, "%s: %s", s, *args); display = olddisplay; } break; case RC_AT: /* where this AT command comes from: */ + if (!user) + break; #ifdef MULTIUSER - s = SaveStr(D_user->u_name); + s = SaveStr(user->u_name); /* DO NOT RETURN FROM HERE WITHOUT RESETTING THIS: */ - EffectiveAclUser = D_user; + EffectiveAclUser = user; #else - s = SaveStr(D_usertty); + s = SaveStr(display ? D_usertty : user->u_name); #endif n = strlen(args[0]); if (n) n--; @@ -1348,14 +1519,22 @@ int key; struct acluser *u; if (!n) - u = D_user; + u = user; else - for (u = users; u; u = u->u_next) - { - debug3("strncmp('%s', '%s', %d)\n", *args, u->u_name, n); - if (!strncmp(*args, u->u_name, n)) + { + for (u = users; u; u = u->u_next) + { + debug3("strncmp('%s', '%s', %d)\n", *args, u->u_name, n); + if (!strncmp(*args, u->u_name, n)) + break; + } + if (!u) + { + args[0][n] = '\0'; + OutputMsg(0, "Did not find any user matching '%s'", args[0]); break; - } + } + } debug1("at all displays of user %s\n", u->u_name); for (display = displays; display; display = nd) { @@ -1369,7 +1548,7 @@ int key; debug1("AT display %s\n", D_usertty); DoCommand(args + 1, argl + 1); if (display) - Msg(0, "command from %s: %s %s", + OutputMsg(0, "command from %s: %s %s", s, args[1], args[2] ? args[2] : ""); display = NULL; flayer = 0; @@ -1398,7 +1577,7 @@ int key; debug1("AT display %s\n", D_usertty); DoCommand(args + 1, argl + 1); if (display) - Msg(0, "command from %s: %s %s", + OutputMsg(0, "command from %s: %s %s", s, args[1], args[2] ? args[2] : ""); display = NULL; fore = NULL; @@ -1414,7 +1593,7 @@ int key; struct win *nw; int ch; - n++; + n++; ch = args[0][n]; args[0][n] = '\0'; if (!*args[0] || (i = WindowByNumber(args[0])) < 0) @@ -1443,17 +1622,17 @@ int key; if (fore && fore->w_layer.l_cvlist) { display = fore->w_layer.l_cvlist->c_display; - Msg(0, "command from %s: %s %s", + OutputMsg(0, "command from %s: %s %s", s, args[1], args[2] ? args[2] : ""); } } display = NULL; fore = NULL; if (i < 0) - Msg(0, "%s: at '%s': no such window.\n", rc_name, args[0]); + OutputMsg(0, "%s: at '%s': no such window.\n", rc_name, args[0]); break; } - else if (i < MAXWIN && (fore = wtab[i])) + else if (i < maxwin && (fore = wtab[i])) { args[0][n] = ch; /* must restore string in case of bind */ debug2("AT window %d (%s)\n", fore->w_number, fore->w_title); @@ -1464,14 +1643,14 @@ int key; if (fore && fore->w_layer.l_cvlist) { display = fore->w_layer.l_cvlist->c_display; - Msg(0, "command from %s: %s %s", + OutputMsg(0, "command from %s: %s %s", s, args[1], args[2] ? args[2] : ""); } display = NULL; fore = NULL; } else - Msg(0, "%s: at [identifier][%%|*|#] command [args]", rc_name); + OutputMsg(0, "%s: at [identifier][%%|*|#] command [args]", rc_name); break; } } @@ -1490,7 +1669,7 @@ int key; i = FindEncoding(args[1]); if (i == -1) { - Msg(0, "%s: readreg: unknown encoding", rc_name); + OutputMsg(0, "%s: readreg: unknown encoding", rc_name); break; } args += 2; @@ -1504,12 +1683,12 @@ int key; */ if ((s = *args) == NULL) { - Input("Copy to register:", 1, INP_RAW, copy_reg_fn, NULL); + Input("Copy to register:", 1, INP_RAW, copy_reg_fn, NULL, 0); break; } if (*argl != 1) { - Msg(0, "%s: copyreg: character, ^x, or (octal) \\032 expected.", rc_name); + OutputMsg(0, "%s: copyreg: character, ^x, or (octal) \\032 expected.", rc_name); break; } ch = args[0][0]; @@ -1520,7 +1699,7 @@ int key; { if (args[2]) { - Msg(0, "%s: readreg: too many arguments", rc_name); + OutputMsg(0, "%s: readreg: too many arguments", rc_name); break; } if ((s = ReadFile(args[1], &n))) @@ -1553,7 +1732,7 @@ int key; i = FindEncoding(args[1]); if (i == -1) { - Msg(0, "%s: register: unknown encoding", rc_name); + OutputMsg(0, "%s: register: unknown encoding", rc_name); break; } args += 2; @@ -1562,12 +1741,12 @@ int key; #endif if (argc != 2) { - Msg(0, "%s: register: illegal number of arguments.", rc_name); + OutputMsg(0, "%s: register: illegal number of arguments.", rc_name); break; } if (*argl != 1) { - Msg(0, "%s: register: character, ^x, or (octal) \\032 expected.", rc_name); + OutputMsg(0, "%s: register: character, ^x, or (octal) \\032 expected.", rc_name); break; } ch = args[0][0]; @@ -1585,8 +1764,8 @@ int key; #endif } } -#endif else +#endif { struct plop *plp = plop_tab + (int)(unsigned char)ch; @@ -1602,12 +1781,12 @@ int key; case RC_PROCESS: if ((s = *args) == NULL) { - Input("Process register:", 1, INP_RAW, process_fn, NULL); + Input("Process register:", 1, INP_RAW, process_fn, NULL, 0); break; } if (*argl != 1) { - Msg(0, "%s: process: character, ^x, or (octal) \\032 expected.", rc_name); + OutputMsg(0, "%s: process: character, ^x, or (octal) \\032 expected.", rc_name); break; } ch = args[0][0]; @@ -1615,12 +1794,17 @@ int key; break; case RC_STUFF: s = *args; + if (!args[0]) + { + Input("Stuff:", 100, INP_COOKED, StuffFin, NULL, 0); + break; + } n = *argl; if (args[1]) { if (strcmp(s, "-k")) { - Msg(0, "%s: stuff: invalid option %s", rc_name, s); + OutputMsg(0, "%s: stuff: invalid option %s", rc_name, s); break; } s = args[1]; @@ -1629,7 +1813,7 @@ int key; break; if (i == T_OCAPS) { - Msg(0, "%s: stuff: unknown key '%s'", rc_name, s); + OutputMsg(0, "%s: stuff: unknown key '%s'", rc_name, s); break; } #ifdef MAPKEYS @@ -1651,7 +1835,7 @@ int key; ShowWindows(-1); break; case RC_VERSION: - Msg(0, "screen %s", version); + OutputMsg(0, "screen %s", version); break; case RC_TIME: if (*args) @@ -1659,7 +1843,7 @@ int key; timestring = SaveStr(*args); break; } - Msg(0, "%s", MakeWinMsg(timestring, fore, '%')); + OutputMsg(0, "%s", MakeWinMsg(timestring, fore, '%')); break; case RC_INFO: ShowInfo(); @@ -1674,7 +1858,7 @@ int key; { if ((ktabp = FindKtab(args[1], 0)) == 0) { - Msg(0, "Unknown command class '%s'", args[1]); + OutputMsg(0, "Unknown command class '%s'", args[1]); break; } } @@ -1733,15 +1917,15 @@ int key; break; } if (n < 0 || n >= (int)(sizeof(types)/sizeof(*types))) - Msg(0, "%s invalid, chose one of %s, %s or %s", *args, types[0], types[1], types[2]); + OutputMsg(0, "%s invalid, chose one of %s, %s or %s", *args, types[0], types[1], types[2]); else { breaktype = n; - Msg(0, "breaktype set to (%d) %s", n, types[n]); + OutputMsg(0, "breaktype set to (%d) %s", n, types[n]); } } else - Msg(0, "breaktype is (%d) %s", breaktype, types[breaktype]); + OutputMsg(0, "breaktype is (%d) %s", breaktype, types[breaktype]); } break; case RC_POW_BREAK: @@ -1775,7 +1959,7 @@ int key; { if (!flayer) { - Msg(0, "%s: %s: window required", rc_name, comms[nr].name); + OutputMsg(0, "%s: %s: window required", rc_name, comms[nr].name); break; } w = flayer->l_width; @@ -1785,7 +1969,7 @@ int key; { if (!display) { - Msg(0, "%s: %s: display required", rc_name, comms[nr].name); + OutputMsg(0, "%s: %s: display required", rc_name, comms[nr].name); break; } w = D_width; @@ -1793,7 +1977,7 @@ int key; } if (*args && args[0][0] == '-') { - Msg(0, "%s: %s: unknown option %s", rc_name, comms[nr].name, *args); + OutputMsg(0, "%s: %s: unknown option %s", rc_name, comms[nr].name, *args); break; } if (nr == RC_HEIGHT) @@ -1840,17 +2024,17 @@ int key; } if (*args && args[1] && args[2]) { - Msg(0, "%s: %s: too many arguments", rc_name, comms[nr].name); + OutputMsg(0, "%s: %s: too many arguments", rc_name, comms[nr].name); break; } if (w <= 0) { - Msg(0, "Illegal width"); + OutputMsg(0, "Illegal width"); break; } if (h <= 0) { - Msg(0, "Illegal height"); + OutputMsg(0, "Illegal height"); break; } if (what == 1) @@ -1876,22 +2060,30 @@ int key; break; } if (h == D_height) - Msg(0, "Your termcap does not specify how to change the terminal's width to %d.", w); + OutputMsg(0, "Your termcap does not specify how to change the terminal's width to %d.", w); else if (w == D_width) - Msg(0, "Your termcap does not specify how to change the terminal's height to %d.", h); + OutputMsg(0, "Your termcap does not specify how to change the terminal's height to %d.", h); else - Msg(0, "Your termcap does not specify how to change the terminal's resolution to %dx%d.", w, h); + OutputMsg(0, "Your termcap does not specify how to change the terminal's resolution to %dx%d.", w, h); } } break; case RC_TITLE: + if (queryflag >= 0) + { + if (fore) + OutputMsg(0, "%s", fore->w_title); + else + queryflag = -1; + break; + } if (*args == 0) InputAKA(); else ChangeAKA(fore, *args, strlen(*args)); break; case RC_COLON: - Input(":", 100, INP_COOKED, Colonfin, NULL); + Input(":", 100, INP_EVERY, Colonfin, NULL, 0); if (*args && **args) { s = *args; @@ -1901,14 +2093,14 @@ int key; break; case RC_LASTMSG: if (D_status_lastmsg) - Msg(0, "%s", D_status_lastmsg); + OutputMsg(0, "%s", D_status_lastmsg); break; case RC_SCREEN: DoScreen("key", args); break; case RC_WRAP: if (ParseSwitch(act, &fore->w_wrap) == 0 && msgok) - Msg(0, "%cwrap", fore->w_wrap ? '+' : '-'); + OutputMsg(0, "%cwrap", fore->w_wrap ? '+' : '-'); break; case RC_FLOW: if (*args) @@ -1935,7 +2127,7 @@ int key; } SetFlow(fore->w_flow & FLOW_NOW); if (msgok) - Msg(0, "%cflow%s", (fore->w_flow & FLOW_NOW) ? '+' : '-', + OutputMsg(0, "%cflow%s", (fore->w_flow & FLOW_NOW) ? '+' : '-', (fore->w_flow & FLOW_AUTOFLAG) ? "(auto)" : ""); break; #ifdef MULTIUSER @@ -1969,7 +2161,7 @@ int key; if (!AclCheckPermWin(D_user, ACL_WRITE, fore)) fore->w_wlockuser = D_user; } - Msg(0, "writelock %s", (fore->w_wlock == WLOCK_AUTO) ? "auto" : + OutputMsg(0, "writelock %s", (fore->w_wlock == WLOCK_AUTO) ? "auto" : ((fore->w_wlock == WLOCK_OFF) ? "off" : "on")); break; #endif @@ -1987,6 +2179,10 @@ int key; break; case RC_MONITOR: n = fore->w_monitor != MON_OFF; +#ifdef MULTIUSER + if (display) + n = n && (ACLBYTE(fore->w_mon_notify, D_user->u_id) & ACLBIT(D_user->u_id)); +#endif if (ParseSwitch(act, &n)) break; if (n) @@ -2000,7 +2196,7 @@ int key; #endif if (fore->w_monitor == MON_OFF) fore->w_monitor = MON_ON; - Msg(0, "Window %d (%s) is now being monitored for all activity.", fore->w_number, fore->w_title); + OutputMsg(0, "Window %d (%s) is now being monitored for all activity.", fore->w_number, fore->w_title); } else { @@ -2017,7 +2213,7 @@ int key; if (i < 0) #endif fore->w_monitor = MON_OFF; - Msg(0, "Window %d (%s) is no longer being monitored for activity.", fore->w_number, fore->w_title); + OutputMsg(0, "Window %d (%s) is no longer being monitored for activity.", fore->w_number, fore->w_title); } break; #ifdef MULTI @@ -2027,15 +2223,7 @@ int key; #endif case RC_WINDOWLIST: if (!*args) - display_wlist(0, WLIST_NUM); - else if (!strcmp(*args, "-m") && !args[1]) - display_wlist(0, WLIST_MRU); - else if (!strcmp(*args, "-b") && !args[1]) - display_wlist(1, WLIST_NUM); - else if (!strcmp(*args, "-b") && !strcmp(args[1], "-m") && !args[2]) - display_wlist(1, WLIST_MRU); - else if (!strcmp(*args, "-m") && !strcmp(args[1], "-b") && !args[2]) - display_wlist(1, WLIST_MRU); + display_windows(0, WLIST_NUM, (struct win *)0); else if (!strcmp(*args, "string")) { if (args[1]) @@ -2045,7 +2233,7 @@ int key; wliststr = SaveStr(args[1]); } if (msgok) - Msg(0, "windowlist string is '%s'", wliststr); + OutputMsg(0, "windowlist string is '%s'", wliststr); } else if (!strcmp(*args, "title")) { @@ -2056,10 +2244,29 @@ int key; wlisttit = SaveStr(args[1]); } if (msgok) - Msg(0, "windowlist title is '%s'", wlisttit); + OutputMsg(0, "windowlist title is '%s'", wlisttit); } else - Msg(0, "usage: windowlist [-b] [string [string] | title [title]]"); + { + int flag = 0; + int blank = 0; + for (i = 0; i < argc; i++) + if (!args[i]) + continue; + else if (!strcmp(args[i], "-m")) + flag |= WLIST_MRU; + else if (!strcmp(args[i], "-b")) + blank = 1; + else if (!strcmp(args[i], "-g")) + flag |= WLIST_NESTED; + else + { + OutputMsg(0, "usage: windowlist [-b] [-g] [-m] [string [string] | title [title]]"); + break; + } + if (i == argc) + display_windows(blank, flag, (struct win *)0); + } break; case RC_HELP: if (argc == 2 && !strcmp(*args, "-c")) @@ -2067,7 +2274,7 @@ int key; struct action *ktabp; if ((ktabp = FindKtab(args[1], 0)) == 0) { - Msg(0, "Unknown command class '%s'", args[1]); + OutputMsg(0, "Unknown command class '%s'", args[1]); break; } display_help(args[1], ktabp); @@ -2082,10 +2289,11 @@ int key; case RC_COPY: if (flayer->l_layfn != &WinLf) { - Msg(0, "Must be on a window layer"); + OutputMsg(0, "Must be on a window layer"); break; } MarkRoutine(); + WindowChanged(fore, 'P'); break; case RC_HISTORY: { @@ -2094,7 +2302,7 @@ int key; if (flayer->l_layfn != &WinLf) { - Msg(0, "Must be on a window layer"); + OutputMsg(0, "Must be on a window layer"); break; } if (GetHistory() == 0) @@ -2118,7 +2326,7 @@ int key; */ if ((s = *args) == NULL) { - Input("Paste from register:", 1, INP_RAW, ins_reg_fn, NULL); + Input("Paste from register:", 1, INP_RAW, ins_reg_fn, NULL, 0); break; } if (args[1] == 0 && !fore) /* no window? */ @@ -2129,7 +2337,7 @@ int key; */ if (args[1] && argl[1] != 1) { - Msg(0, "%s: paste destination: character, ^x, or (octal) \\032 expected.", + OutputMsg(0, "%s: paste destination: character, ^x, or (octal) \\032 expected.", rc_name); break; } @@ -2168,7 +2376,7 @@ int key; } if (l == 0) { - Msg(0, "empty buffer"); + OutputMsg(0, "empty buffer"); break; } /* @@ -2189,7 +2397,7 @@ int key; */ if ((dbuf = (char *)malloc(l)) == 0) { - Msg(0, strnomem); + OutputMsg(0, "%s", strnomem); break; } l = 0; @@ -2251,7 +2459,7 @@ int key; case RC_WRITEBUF: if (!user->u_plop.buf) { - Msg(0, "empty buffer"); + OutputMsg(0, "empty buffer"); break; } #ifdef ENCODINGS @@ -2267,7 +2475,7 @@ int key; enc = FindEncoding(args[1]); if (enc == -1) { - Msg(0, "%s: writebuf: unknown encoding", rc_name); + OutputMsg(0, "%s: writebuf: unknown encoding", rc_name); break; } if (enc != oldplop.enc) @@ -2276,7 +2484,7 @@ int key; newbuf = malloc(l + 1); if (!newbuf) { - Msg(0, strnomem); + OutputMsg(0, "%s", strnomem); break; } user->u_plop.len = RecodeBuf((unsigned char *)oldplop.buf, oldplop.len, oldplop.enc, enc, (unsigned char *)newbuf); @@ -2287,7 +2495,7 @@ int key; } #endif if (args[0] && args[1]) - Msg(0, "%s: writebuf: too many arguments", rc_name); + OutputMsg(0, "%s: writebuf: too many arguments", rc_name); else WriteFile(user, args[0], DUMP_EXCHANGE); #ifdef ENCODINGS @@ -2305,7 +2513,7 @@ int key; i = FindEncoding(args[1]); if (i == -1) { - Msg(0, "%s: readbuf: unknown encoding", rc_name); + OutputMsg(0, "%s: readbuf: unknown encoding", rc_name); break; } args += 2; @@ -2313,7 +2521,7 @@ int key; #endif if (args[0] && args[1]) { - Msg(0, "%s: readbuf: too many arguments", rc_name); + OutputMsg(0, "%s: readbuf: too many arguments", rc_name); break; } if ((s = ReadFile(args[0] ? args[0] : BufferFile, &n))) @@ -2333,7 +2541,7 @@ int key; case RC_IGNORECASE: (void)ParseSwitch(act, &search_ic); if (msgok) - Msg(0, "Will %signore case in searches", search_ic ? "" : "not "); + OutputMsg(0, "Will %signore case in searches", search_ic ? "" : "not "); break; #endif /* COPY_PASTE */ case RC_ESCAPE: @@ -2343,7 +2551,7 @@ int key; SetEscape(user, (int)(unsigned char)args[0][0], (int)(unsigned char)args[0][1]); else { - Msg(0, "%s: two characters required after escape.", rc_name); + OutputMsg(0, "%s: two characters required after escape.", rc_name); break; } /* Change defescape if master user. This is because we only @@ -2359,7 +2567,7 @@ int key; SetEscape(NULL, (int)(unsigned char)args[0][0], (int)(unsigned char)args[0][1]); else { - Msg(0, "%s: two characters required after defescape.", rc_name); + OutputMsg(0, "%s: two characters required after defescape.", rc_name); break; } #ifdef MAPKEYS @@ -2369,7 +2577,7 @@ int key; case RC_CHDIR: s = *args ? *args : home; if (chdir(s) == -1) - Msg(errno, "%s", s); + OutputMsg(errno, "%s", s); break; case RC_SHELL: case RC_DEFSHELL: @@ -2380,7 +2588,7 @@ int key; if (*args) (void)ParseSaveStr(act, &hardcopydir); if (msgok) - Msg(0, "hardcopydir is %s\n", hardcopydir && *hardcopydir ? hardcopydir : "<cwd>"); + OutputMsg(0, "hardcopydir is %s\n", hardcopydir && *hardcopydir ? hardcopydir : "<cwd>"); break; case RC_LOGFILE: if (*args) @@ -2389,19 +2597,19 @@ int key; { log_flush = atoi(args[1]); if (msgok) - Msg(0, "log flush timeout set to %ds\n", log_flush); + OutputMsg(0, "log flush timeout set to %ds\n", log_flush); break; } if (ParseSaveStr(act, &screenlogfile) || !msgok) break; } - Msg(0, "logfile is '%s'", screenlogfile); + OutputMsg(0, "logfile is '%s'", screenlogfile); break; case RC_LOGTSTAMP: if (!*args || !strcmp(*args, "on") || !strcmp(*args, "off")) { if (ParseSwitch(act, &logtstamp_on) == 0 && msgok) - Msg(0, "timestamps turned %s", logtstamp_on ? "on" : "off"); + OutputMsg(0, "timestamps turned %s", logtstamp_on ? "on" : "off"); } else if (!strcmp(*args, "string")) { @@ -2412,7 +2620,7 @@ int key; logtstamp_string = SaveStr(args[1]); } if (msgok) - Msg(0, "logfile timestamp is '%s'", logtstamp_string); + OutputMsg(0, "logfile timestamp is '%s'", logtstamp_string); } else if (!strcmp(*args, "after")) { @@ -2422,10 +2630,10 @@ int key; if (!msgok) break; } - Msg(0, "timestamp printed after %ds\n", logtstamp_after); + OutputMsg(0, "timestamp printed after %ds\n", logtstamp_after); } else - Msg(0, "usage: logtstamp [after [n]|string [str]|on|off]"); + OutputMsg(0, "usage: logtstamp [after [n]|string [str]|on|off]"); break; case RC_SHELLTITLE: (void)ParseSaveStr(act, &nwin_default.aka); @@ -2434,7 +2642,7 @@ int key; case RC_TERMCAPINFO: case RC_TERMINFO: if (!rc_name || !*rc_name) - Msg(0, "Sorry, too late now. Place that in your .screenrc file."); + OutputMsg(0, "Sorry, too late now. Place that in your .screenrc file."); break; case RC_SLEEP: break; /* Already handled */ @@ -2444,7 +2652,7 @@ int key; break; if (strlen(s) >= 20) { - Msg(0, "%s: term: argument too long ( < 20)", rc_name); + OutputMsg(0, "%s: term: argument too long ( < 20)", rc_name); free(s); break; } @@ -2476,9 +2684,12 @@ int key; s = MakeWinMsg(s, fore, '%'); } if (s) - Msg(0, "%s", s); + OutputMsg(0, "%s", s); else - Msg(0, "%s: 'echo [-n] [-p] \"string\"' expected.", rc_name); + { + OutputMsg(0, "%s: 'echo [-n] [-p] \"string\"' expected.", rc_name); + queryflag = -1; + } break; case RC_BELL: case RC_BELL_MSG: @@ -2486,7 +2697,7 @@ int key; { char buf[256]; AddXChars(buf, sizeof(buf), BellString); - Msg(0, "bell_msg is '%s'", buf); + OutputMsg(0, "bell_msg is '%s'", buf); break; } (void)ParseSaveStr(act, &BellString); @@ -2498,7 +2709,7 @@ int key; else if (ParseSaveStr(act, &BufferFile)) break; if (msgok) - Msg(0, "Bufferfile is now '%s'", BufferFile); + OutputMsg(0, "Bufferfile is now '%s'", BufferFile); break; #endif case RC_ACTIVITY: @@ -2510,7 +2721,7 @@ int key; { char buf[256]; AddXChars(buf, sizeof(buf), PowDetachString); - Msg(0, "pow_detach_msg is '%s'", buf); + OutputMsg(0, "pow_detach_msg is '%s'", buf); break; } (void)ParseSaveStr(act, &PowDetachString); @@ -2585,13 +2796,29 @@ int key; if (ParseOnOff(act, &n) == 0) nwin_default.monitor = (n == 0) ? MON_OFF : MON_ON; break; + case RC_DEFMOUSETRACK: + if (ParseOnOff(act, &n) == 0) + defmousetrack = (n == 0) ? 0 : 1000; + break; + case RC_MOUSETRACK: + if (!args[0]) + { + OutputMsg(0, "Mouse tracking for this display is turned %s", D_mousetrack ? "on" : "off"); + } + else if (ParseOnOff(act, &n) == 0) + { + D_mousetrack = n == 0 ? 0 : 1000; + if (D_fore) + MouseMode(D_fore->w_mouse); + } + break; case RC_DEFSILENCE: if (ParseOnOff(act, &n) == 0) nwin_default.silence = (n == 0) ? SILENCE_OFF : SILENCE_ON; break; case RC_VERBOSE: if (!*args) - Msg(0, "W%s echo command when creating windows.", + OutputMsg(0, "W%s echo command when creating windows.", VerboseCreate ? "ill" : "on't"); else if (ParseOnOff(act, &n) == 0) VerboseCreate = n; @@ -2599,7 +2826,7 @@ int key; case RC_HARDSTATUS: if (display) { - Msg(0, "%s", ""); /* wait till mintime (keep gcc quiet) */ + OutputMsg(0, "%s", ""); /* wait till mintime (keep gcc quiet) */ RemoveStatus(); } if (args[0] && strcmp(args[0], "on") && strcmp(args[0], "off")) @@ -2622,13 +2849,13 @@ int key; { char buf[256]; AddXChars(buf, sizeof(buf), hstatusstring); - Msg(0, "hardstatus string is '%s'", buf); + OutputMsg(0, "hardstatus string is '%s'", buf); break; } } else { - Msg(0, "%s: usage: hardstatus [always]lastline|ignore|message|string [string]", rc_name); + OutputMsg(0, "%s: usage: hardstatus [always]lastline|ignore|message|string [string]", rc_name); break; } if (new_use != -1) @@ -2661,7 +2888,7 @@ int key; } (void)ParseSwitch(act, &use_hardstatus); if (msgok) - Msg(0, "messages displayed on %s", use_hardstatus ? "hardstatus line" : "window"); + OutputMsg(0, "messages displayed on %s", use_hardstatus ? "hardstatus line" : "window"); break; case RC_CAPTION: if (strcmp(args[0], "always") == 0 || strcmp(args[0], "splitonly") == 0) @@ -2679,13 +2906,13 @@ int key; { char buf[256]; AddXChars(buf, sizeof(buf), captionstring); - Msg(0, "caption string is '%s'", buf); + OutputMsg(0, "caption string is '%s'", buf); break; } } else { - Msg(0, "%s: usage: caption always|splitonly|string <string>", rc_name); + OutputMsg(0, "%s: usage: caption always|splitonly|string <string>", rc_name); break; } if (!args[1]) @@ -2702,12 +2929,12 @@ int key; if (TtyGrabConsole(fore->w_ptyfd, n, rc_name)) break; if (n == 0) - Msg(0, "%s: releasing console %s", rc_name, HostName); + OutputMsg(0, "%s: releasing console %s", rc_name, HostName); else if (console_window) - Msg(0, "%s: stealing console %s from window %d (%s)", rc_name, + OutputMsg(0, "%s: stealing console %s from window %d (%s)", rc_name, HostName, console_window->w_number, console_window->w_title); else - Msg(0, "%s: grabbing console %s", rc_name, HostName); + OutputMsg(0, "%s: grabbing console %s", rc_name, HostName); console_window = n ? fore : 0; break; case RC_ALLPARTIAL: @@ -2716,7 +2943,7 @@ int key; if (!all_norefresh && fore) Activate(-1); if (msgok) - Msg(0, all_norefresh ? "No refresh on window change!\n" : + OutputMsg(0, all_norefresh ? "No refresh on window change!\n" : "Window specific refresh\n"); break; case RC_PARTIAL: @@ -2727,21 +2954,21 @@ int key; if (ParseSwitch(act, &visual_bell) || !msgok) break; if (visual_bell == 0) - Msg(0, "switched to audible bell."); + OutputMsg(0, "switched to audible bell."); else - Msg(0, "switched to visual bell."); + OutputMsg(0, "switched to visual bell."); break; case RC_VBELLWAIT: if (ParseNum1000(act, &VBellWait) == 0 && msgok) - Msg(0, "vbellwait set to %.10g seconds", VBellWait/1000.); + OutputMsg(0, "vbellwait set to %.10g seconds", VBellWait/1000.); break; case RC_MSGWAIT: if (ParseNum1000(act, &MsgWait) == 0 && msgok) - Msg(0, "msgwait set to %.10g seconds", MsgWait/1000.); + OutputMsg(0, "msgwait set to %.10g seconds", MsgWait/1000.); break; case RC_MSGMINWAIT: if (ParseNum1000(act, &MsgMinWait) == 0 && msgok) - Msg(0, "msgminwait set to %.10g seconds", MsgMinWait/1000.); + OutputMsg(0, "msgminwait set to %.10g seconds", MsgMinWait/1000.); break; case RC_SILENCEWAIT: if (ParseNum(act, &SilenceWait)) @@ -2751,47 +2978,36 @@ int key; for (p = windows; p; p = p->w_next) p->w_silencewait = SilenceWait; if (msgok) - Msg(0, "silencewait set to %d seconds", SilenceWait); + OutputMsg(0, "silencewait set to %d seconds", SilenceWait); break; case RC_NUMBER: if (*args == 0) - Msg(0, "This is window %d (%s).\n", fore->w_number, fore->w_title); + OutputMsg(0, queryflag >= 0 ? "%d (%s)" : "This is window %d (%s).", fore->w_number, fore->w_title); else { int old = fore->w_number; - - if (ParseNum(act, &n) || n >= maxwin) + int rel = 0, parse; + if (args[0][0] == '+') + rel = 1; + else if (args[0][0] == '-') + rel = -1; + if (rel) + ++act->args[0]; + parse = ParseNum(act, &n); + if (rel) + --act->args[0]; + if (parse) break; - p = wtab[n]; - wtab[n] = fore; - fore->w_number = n; - wtab[old] = p; - if (p) - p->w_number = old; -#ifdef MULTIUSER - /* exchange the acls for these windows. */ - AclWinSwap(old, n); -#endif -#ifdef UTMPOK - /* exchange the utmp-slots for these windows */ - if ((fore->w_slot != (slot_t) -1) && (fore->w_slot != (slot_t) 0)) + if (rel > 0) + n += old; + else if (rel < 0) + n = old - n; + if (!WindowChangeNumber(fore, n)) { - RemoveUtmp(fore); - SetUtmp(fore); - } - if (p && (p->w_slot != (slot_t) -1) && (p->w_slot != (slot_t) 0)) - { - /* XXX: first display wins? */ - display = fore->w_layer.l_cvlist ? fore->w_layer.l_cvlist->c_display : 0; - RemoveUtmp(p); - SetUtmp(p); + /* Window number could not be changed. */ + queryflag = -1; + return; } -#endif - - WindowChanged(fore, 'n'); - WindowChanged((struct win *)0, 'w'); - WindowChanged((struct win *)0, 'W'); - WindowChanged((struct win *)0, 0); } break; case RC_SILENCE: @@ -2821,7 +3037,7 @@ int key; if (!msgok) break; - Msg(0, "The window is now being monitored for %d sec. silence.", fore->w_silencewait); + OutputMsg(0, "The window is now being monitored for %d sec. silence.", fore->w_silencewait); } else { @@ -2843,7 +3059,7 @@ int key; } if (!msgok) break; - Msg(0, "The window is no longer being monitored for silence."); + OutputMsg(0, "The window is no longer being monitored for silence."); } break; #ifdef COPY_PASTE @@ -2851,15 +3067,20 @@ int key; (void)ParseNum(act, &nwin_default.histheight); break; case RC_SCROLLBACK: + if (flayer->l_layfn == &MarkLf) + { + OutputMsg(0, "Cannot resize scrollback buffer in copy/scrollback mode."); + break; + } (void)ParseNum(act, &n); ChangeWindowSize(fore, fore->w_width, fore->w_height, n); if (msgok) - Msg(0, "scrollback set to %d", fore->w_histheight); + OutputMsg(0, "scrollback set to %d", fore->w_histheight); break; #endif case RC_SESSIONNAME: if (*args == 0) - Msg(0, "This session is named '%s'\n", SockName); + OutputMsg(0, "This session is named '%s'\n", SockName); else { char buf[MAXPATHLEN]; @@ -2869,7 +3090,7 @@ int key; break; if (!*s || strlen(s) + (SockName - SockPath) > MAXPATHLEN - 13 || index(s, '/')) { - Msg(0, "%s: bad session name '%s'\n", rc_name, s); + OutputMsg(0, "%s: bad session name '%s'\n", rc_name, s); free(s); break; } @@ -2878,17 +3099,18 @@ int key; free(s); if ((access(buf, F_OK) == 0) || (errno != ENOENT)) { - Msg(0, "%s: inappropriate path: '%s'.", rc_name, buf); + OutputMsg(0, "%s: inappropriate path: '%s'.", rc_name, buf); break; } if (rename(SockPath, buf)) { - Msg(errno, "%s: failed to rename(%s, %s)", rc_name, SockPath, buf); + OutputMsg(errno, "%s: failed to rename(%s, %s)", rc_name, SockPath, buf); break; } debug2("rename(%s, %s) done\n", SockPath, buf); strcpy(SockPath, buf); MakeNewEnv(); + WindowChanged((struct win *)0, 'S'); } break; case RC_SETENV: @@ -2913,12 +3135,12 @@ int key; break; case RC_SLOWPASTE: if (*args == 0) - Msg(0, fore->w_slowpaste ? + OutputMsg(0, fore->w_slowpaste ? "Slowpaste in window %d is %d milliseconds." : "Slowpaste in window %d is unset.", fore->w_number, fore->w_slowpaste); else if (ParseNum(act, &fore->w_slowpaste) == 0 && msgok) - Msg(0, fore->w_slowpaste ? + OutputMsg(0, fore->w_slowpaste ? "Slowpaste in window %d set to %d milliseconds." : "Slowpaste in window %d now unset.", fore->w_number, fore->w_slowpaste); @@ -2926,7 +3148,7 @@ int key; case RC_MARKKEYS: if (CompileKeys(*args, *argl, mark_key_tab)) { - Msg(0, "%s: markkeys: syntax error.", rc_name); + OutputMsg(0, "%s: markkeys: syntax error.", rc_name); break; } debug1("markkeys %s\n", *args); @@ -2934,7 +3156,7 @@ int key; # ifdef FONT case RC_PASTEFONT: if (ParseSwitch(act, &pastefont) == 0 && msgok) - Msg(0, "Will %spaste font settings", pastefont ? "" : "not "); + OutputMsg(0, "Will %spaste font settings", pastefont ? "" : "not "); break; # endif case RC_CRLF: @@ -2942,7 +3164,7 @@ int key; break; case RC_COMPACTHIST: if (ParseSwitch(act, &compacthist) == 0 && msgok) - Msg(0, "%scompacting history lines", compacthist ? "" : "not "); + OutputMsg(0, "%scompacting history lines", compacthist ? "" : "not "); break; #endif #ifdef NETHACK @@ -2958,7 +3180,7 @@ int key; { char buf[256]; AddXChars(buf, sizeof(buf), VisualBellString); - Msg(0, "vbell_msg is '%s'", buf); + OutputMsg(0, "vbell_msg is '%s'", buf); break; } (void)ParseSaveStr(act, &VisualBellString); @@ -2969,12 +3191,12 @@ int key; break; if (n < 0 || n > 0777) { - Msg(0, "%s: mode: Invalid tty mode %o", rc_name, n); + OutputMsg(0, "%s: mode: Invalid tty mode %o", rc_name, n); break; } TtyMode = n; if (msgok) - Msg(0, "Ttymode set to %03o", TtyMode); + OutputMsg(0, "Ttymode set to %03o", TtyMode); break; case RC_AUTODETACH: (void)ParseOnOff(act, &auto_detach); @@ -2992,7 +3214,7 @@ int key; if (!strcmp(user->u_password, "none")) { if (n) - Msg(0, "Password checking disabled"); + OutputMsg(0, "Password checking disabled"); free(user->u_password); user->u_password = NullStr; } @@ -3001,36 +3223,67 @@ int key; { if (!fore) { - Msg(0, "%s: password: window required", rc_name); + OutputMsg(0, "%s: password: window required", rc_name); break; } - Input("New screen password:", 100, INP_NOECHO, pass1, display ? (char *)D_user : (char *)users); + Input("New screen password:", 100, INP_NOECHO, pass1, display ? (char *)D_user : (char *)users, 0); } break; #endif /* PASSWORD */ case RC_BIND: { struct action *ktabp = ktab; + int kflag = 0; - if (argc > 2 && !strcmp(*args, "-c")) + for (;;) { - ktabp = FindKtab(args[1], 1); - if (ktabp == 0) - break; - args += 2; - argl += 2; + if (argc > 2 && !strcmp(*args, "-c")) + { + ktabp = FindKtab(args[1], 1); + if (ktabp == 0) + break; + args += 2; + argl += 2; + argc -= 2; + } + else if (argc > 1 && !strcmp(*args, "-k")) + { + kflag = 1; + args++; + argl++; + argc--; + } + else + break; } +#ifdef MAPKEYS + if (kflag) + { + for (n = 0; n < KMAP_KEYS; n++) + if (strcmp(term[n + T_CAPS].tcname, *args) == 0) + break; + if (n == KMAP_KEYS) + { + OutputMsg(0, "%s: bind: unknown key '%s'", rc_name, *args); + break; + } + n += 256; + } + else +#endif if (*argl != 1) { - Msg(0, "%s: bind: character, ^x, or (octal) \\032 expected.", rc_name); + OutputMsg(0, "%s: bind: character, ^x, or (octal) \\032 expected.", rc_name); break; } - n = (unsigned char)args[0][0]; + else + n = (unsigned char)args[0][0]; + if (args[1]) { if ((i = FindCommnr(args[1])) == RC_ILLEGAL) { - Msg(0, "%s: bind: unknown command '%s'", rc_name, args[1]); + OutputMsg(0, "%s: bind: unknown command '%s'", rc_name, args[1]); break; } if (CheckArgNum(i, args + 2) < 0) @@ -3071,13 +3324,13 @@ int key; } else { - Msg(0, "%s: bindkey: invalid option %s", rc_name, *args); + OutputMsg(0, "%s: bindkey: invalid option %s", rc_name, *args); return; } } if (df && mf) { - Msg(0, "%s: bindkey: -d does not work with -m", rc_name); + OutputMsg(0, "%s: bindkey: -d does not work with -m", rc_name); break; } if (*args == 0) @@ -3094,12 +3347,12 @@ int key; { if (af) { - Msg(0, "%s: bindkey: -a only works with -k", rc_name); + OutputMsg(0, "%s: bindkey: -a only works with -k", rc_name); break; } if (*argl == 0) { - Msg(0, "%s: bindkey: empty string makes no sense", rc_name); + OutputMsg(0, "%s: bindkey: empty string makes no sense", rc_name); break; } for (i = 0, kme = kmap_exts; i < kmap_extn; i++, kme++) @@ -3115,7 +3368,7 @@ int key; { if (!args[1]) { - Msg(0, "%s: bindkey: keybinding not found", rc_name); + OutputMsg(0, "%s: bindkey: keybinding not found", rc_name); break; } kmap_extn += 8; @@ -3127,6 +3380,7 @@ int key; kme->str = 0; kme->dm.nr = kme->mm.nr = kme->um.nr = RC_ILLEGAL; kme->dm.args = kme->mm.args = kme->um.args = noargs; + kme->dm.argl = kme->mm.argl = kme->um.argl = 0; } i -= 8; kme -= 8; @@ -3147,7 +3401,7 @@ int key; break; if (i == T_OCAPS) { - Msg(0, "%s: bindkey: unknown key '%s'", rc_name, *args); + OutputMsg(0, "%s: bindkey: unknown key '%s'", rc_name, *args); break; } if (af && i >= T_CURSOR && i < T_OCAPS) @@ -3160,7 +3414,7 @@ int key; { if ((newnr = FindCommnr(args[1])) == RC_ILLEGAL) { - Msg(0, "%s: bindkey: unknown command '%s'", rc_name, args[1]); + OutputMsg(0, "%s: bindkey: unknown command '%s'", rc_name, args[1]); break; } if (CheckArgNum(newnr, args + 2) < 0) @@ -3198,13 +3452,13 @@ int key; break; if (n < 0) { - Msg(0, "%s: maptimeout: illegal time %d", rc_name, n); + OutputMsg(0, "%s: maptimeout: illegal time %d", rc_name, n); break; } maptimeout = n; } if (*args == 0 || msgok) - Msg(0, "maptimeout is %dms", maptimeout); + OutputMsg(0, "maptimeout is %dms", maptimeout); break; case RC_MAPNOTNEXT: D_dontmap = 1; @@ -3224,7 +3478,7 @@ int key; if (UserDel(args[0], NULL)) break; if (msgok) - Msg(0, "%s removed from acl database", args[0]); + OutputMsg(0, "%s removed from acl database", args[0]); break; case RC_ACLGRP: /* @@ -3239,7 +3493,7 @@ int key; if (AclLinkUser(args[0], args[1])) break; if (msgok) - Msg(0, "User %s joined acl-group %s", args[0], args[1]); + OutputMsg(0, "User %s joined acl-group %s", args[0], args[1]); } else /* remove all groups from user */ { @@ -3265,7 +3519,7 @@ int key; if (!(u = *FindUserPtr(args[0]))) { if (msgok) - Msg(0, "User %s does not exist.", args[0]); + OutputMsg(0, "User %s does not exist.", args[0]); break; } g = u->u_group; @@ -3280,7 +3534,7 @@ int key; } if (ngroups) *(--p) = '\0'; - Msg(0, "%s's group%s: %s.", args[0], (ngroups == 1) ? "" : "s", + OutputMsg(0, "%s's group%s: %s.", args[0], (ngroups == 1) ? "" : "s", (ngroups == 0) ? "none" : buf); } break; @@ -3291,7 +3545,7 @@ int key; char *err = 0; if (AclUmask(display ? D_user : users, s, &err)) - Msg(0, "umask: %s\n", err); + OutputMsg(0, "umask: %s\n", err); } break; case RC_MULTIUSER: @@ -3300,7 +3554,7 @@ int key; multi = n ? "" : 0; chsock(); if (msgok) - Msg(0, "Multiuser mode %s", multi ? "enabled" : "disabled"); + OutputMsg(0, "Multiuser mode %s", multi ? "enabled" : "disabled"); break; #endif /* MULTIUSER */ #ifdef PSEUDOS @@ -3321,11 +3575,11 @@ int key; else break; if (msgok && i == -1) - Msg(0, "display set to blocking mode"); + OutputMsg(0, "display set to blocking mode"); else if (msgok && i == 0) - Msg(0, "display set to nonblocking mode, no timeout"); + OutputMsg(0, "display set to nonblocking mode, no timeout"); else if (msgok) - Msg(0, "display set to nonblocking mode, %.10gs timeout", i/1000.); + OutputMsg(0, "display set to nonblocking mode, %.10gs timeout", i/1000.); D_nonblock = i; if (D_nonblock <= 0) evdeq(&D_blockedev); @@ -3354,7 +3608,7 @@ int key; fore->w_gr = 0; #endif if (ParseSwitch(act, &fore->w_gr) == 0 && msgok) - Msg(0, "Will %suse GR", fore->w_gr ? "" : "not "); + OutputMsg(0, "Will %suse GR", fore->w_gr ? "" : "not "); #ifdef ENCODINGS if (fore->w_gr == 0 && fore->w_FontE) fore->w_gr = 2; @@ -3362,12 +3616,12 @@ int key; break; case RC_C1: if (ParseSwitch(act, &fore->w_c1) == 0 && msgok) - Msg(0, "Will %suse C1", fore->w_c1 ? "" : "not "); + OutputMsg(0, "Will %suse C1", fore->w_c1 ? "" : "not "); break; #ifdef COLOR case RC_BCE: if (ParseSwitch(act, &fore->w_bce) == 0 && msgok) - Msg(0, "Will %serase with background color", fore->w_bce ? "" : "not "); + OutputMsg(0, "Will %serase with background color", fore->w_bce ? "" : "not "); break; #endif #ifdef ENCODINGS @@ -3377,7 +3631,7 @@ int key; if (*args && !strcmp(args[0], "-d")) { if (!args[1]) - Msg(0, "encodings directory is %s", screenencodings ? screenencodings : "<unset>"); + OutputMsg(0, "encodings directory is %s", screenencodings ? screenencodings : "<unset>"); else { free(screenencodings); @@ -3388,18 +3642,18 @@ int key; if (*args && !strcmp(args[0], "-l")) { if (!args[1]) - Msg(0, "encoding: -l: argument required"); + OutputMsg(0, "encoding: -l: argument required"); else if (LoadFontTranslation(-1, args[1])) - Msg(0, "encoding: could not load utf8 encoding file"); + OutputMsg(0, "encoding: could not load utf8 encoding file"); else if (msgok) - Msg(0, "encoding: utf8 encoding file loaded"); + OutputMsg(0, "encoding: utf8 encoding file loaded"); break; } #else if (*args && (!strcmp(args[0], "-l") || !strcmp(args[0], "-d"))) { if (msgok) - Msg(0, "encoding: screen is not compiled for UTF-8."); + OutputMsg(0, "encoding: screen is not compiled for UTF-8."); break; } #endif @@ -3412,7 +3666,7 @@ int key; n = FindEncoding(args[i]); if (n == -1) { - Msg(0, "encoding: unknown encoding '%s'", args[i]); + OutputMsg(0, "encoding: unknown encoding '%s'", args[i]); break; } if (i == 0 && fore) @@ -3429,7 +3683,7 @@ int key; n = FindEncoding(*args); if (n == -1) { - Msg(0, "defencoding: unknown encoding '%s'", *args); + OutputMsg(0, "defencoding: unknown encoding '%s'", *args); break; } nwin_default.encoding = n; @@ -3443,7 +3697,7 @@ int key; { nwin_default.encoding = n ? UTF8 : 0; if (msgok) - Msg(0, "Will %suse UTF-8 encoding for new windows", n ? "" : "not "); + OutputMsg(0, "Will %suse UTF-8 encoding for new windows", n ? "" : "not "); } break; case RC_UTF8: @@ -3459,14 +3713,14 @@ int key; n = 1; else { - Msg(0, "utf8: illegal argument (%s)", args[i]); + OutputMsg(0, "utf8: illegal argument (%s)", args[i]); break; } if (i == 0) { WinSwitchEncoding(fore, n ? UTF8 : 0); if (msgok) - Msg(0, "Will %suse UTF-8 encoding", n ? "" : "not "); + OutputMsg(0, "Will %suse UTF-8 encoding", n ? "" : "not "); } else if (display) D_encoding = n ? UTF8 : 0; @@ -3488,15 +3742,54 @@ int key; if (*args == 0 || msgok) { if (printcmd) - Msg(0, "using '%s' as print command", printcmd); + OutputMsg(0, "using '%s' as print command", printcmd); else - Msg(0, "using termcap entries for printing"); + OutputMsg(0, "using termcap entries for printing"); break; } break; case RC_DIGRAPH: - Input("Enter digraph: ", 10, INP_EVERY, digraph_fn, NULL); + if (argl && argl[0] > 0 && argl[1] > 0) + { + if (argl[0] != 2) + { + OutputMsg(0, "Two characters expected to define a digraph"); + break; + } + i = digraph_find(args[0]); + digraphs[i].d[0] = args[0][0]; + digraphs[i].d[1] = args[0][1]; + if (!parse_input_int(args[1], argl[1], &digraphs[i].value)) + { + if (!(digraphs[i].value = atoi(args[1]))) + { + if (!args[1][1]) + digraphs[i].value = (int)args[1][0]; +#ifdef UTF8 + else + { + int t; + unsigned char *s = args[1]; + digraphs[i].value = 0; + while (*s) + { + t = FromUtf8(*s++, &digraphs[i].value); + if (t == -1) + continue; + if (t == -2) + digraphs[i].value = 0; + else + digraphs[i].value = t; + break; + } + } +#endif + } + } + break; + } + Input("Enter digraph: ", 10, INP_EVERY, digraph_fn, NULL, 0); if (*args && **args) { s = *args; @@ -3512,7 +3805,7 @@ int key; *buf = 0; if (nwin_default.hstatus) AddXChars(buf, sizeof(buf), nwin_default.hstatus); - Msg(0, "default hstatus is '%s'", buf); + OutputMsg(0, "default hstatus is '%s'", buf); break; } (void)ParseSaveStr(act, &nwin_default.hstatus); @@ -3541,20 +3834,20 @@ int key; *buf = 0; if (nwin_default.charset) AddXChars(buf, sizeof(buf), nwin_default.charset); - Msg(0, "default charset is '%s'", buf); + OutputMsg(0, "default charset is '%s'", buf); break; } n = strlen(*args); if (n == 0 || n > 6) { - Msg(0, "%s: %s: string has illegal size.", rc_name, comms[nr].name); + OutputMsg(0, "%s: %s: string has illegal size.", rc_name, comms[nr].name); break; } if (n > 4 && ( ((args[0][4] < '0' || args[0][4] > '3') && args[0][4] != '.') || ((args[0][5] < '0' || args[0][5] > '3') && args[0][5] && args[0][5] != '.'))) { - Msg(0, "%s: %s: illegal mapping number.", rc_name, comms[nr].name); + OutputMsg(0, "%s: %s: illegal mapping number.", rc_name, comms[nr].name); break; } if (nr == RC_CHARSET) @@ -3592,7 +3885,7 @@ int key; } if (*s || i < 0 || i >= 8) { - Msg(0, "%s: attrcolor: unknown attribute '%s'.", rc_name, args[0]); + OutputMsg(0, "%s: attrcolor: unknown attribute '%s'.", rc_name, args[0]); break; } n = 0; @@ -3608,6 +3901,40 @@ int key; nattr2color = n; break; #endif + case RC_RENDITION: + i = -1; + if (strcmp(args[0], "bell") == 0) + { + i = REND_BELL; + } + else if (strcmp(args[0], "monitor") == 0) + { + i = REND_MONITOR; + } + else if (strcmp(args[0], "silence") == 0) + { + i = REND_SILENCE; + } + else if (strcmp(args[0], "so") != 0) + { + OutputMsg(0, "Invalid option '%s' for rendition", args[0]); + break; + } + + ++args; + ++argl; + + if (i != -1) + { + renditions[i] = ParseAttrColor(args[0], args[1], 1); + WindowChanged((struct win *)0, 'w'); + WindowChanged((struct win *)0, 'W'); + WindowChanged((struct win *)0, 0); + break; + } + + /* We are here, means we want to set the sorendition. */ + /* FALLTHROUGH*/ case RC_SORENDITION: i = 0; if (*args) @@ -3616,13 +3943,14 @@ int key; if (i == -1) break; ApplyAttrColor(i, &mchar_so); + WindowChanged((struct win *)0, 0); debug2("--> %x %x\n", mchar_so.attr, mchar_so.color); } if (msgok) #ifdef COLOR - Msg(0, "Standout attributes 0x%02x color 0x%02x", (unsigned char)mchar_so.attr, 0x99 ^ (unsigned char)mchar_so.color); + OutputMsg(0, "Standout attributes 0x%02x color 0x%02x", (unsigned char)mchar_so.attr, 0x99 ^ (unsigned char)mchar_so.color); #else - Msg(0, "Standout attributes 0x%02x ", (unsigned char)mchar_so.attr); + OutputMsg(0, "Standout attributes 0x%02x ", (unsigned char)mchar_so.attr); #endif break; @@ -3635,7 +3963,7 @@ int key; s = NULL; if (!*args) { - Msg(0, "%s:%s screen login", HostName, SockPath); + OutputMsg(0, "%s:%s screen login", HostName, SockPath); InputSu(D_fore, &D_user, NULL); } else if (!args[1]) @@ -3645,11 +3973,15 @@ int key; else s = DoSu(&D_user, args[0], args[1], args[2]); if (s) - Msg(0, "%s", s); + OutputMsg(0, "%s", s); break; #endif /* MULTIUSER */ case RC_SPLIT: - AddCanvas(); + s = args[0]; + if (s && !strcmp(s, "-v")) + AddCanvas(SLICE_HORI); + else + AddCanvas(SLICE_VERT); Activate(-1); break; case RC_REMOVE: @@ -3669,78 +4001,108 @@ int key; LaySetCursor(); break; case RC_FOCUS: - if (!*args || !strcmp(*args, "down")) - D_forecv = D_forecv->c_next ? D_forecv->c_next : D_cvlist; - else if (!strcmp(*args, "up")) + { + struct canvas *cv = 0; + if (!*args || !strcmp(*args, "next")) + cv = D_forecv->c_next ? D_forecv->c_next : D_cvlist; + else if (!strcmp(*args, "prev")) + { + for (cv = D_cvlist; cv->c_next && cv->c_next != D_forecv; cv = cv->c_next) + ; + } + else if (!strcmp(*args, "top")) + cv = D_cvlist; + else if (!strcmp(*args, "bottom")) + { + for (cv = D_cvlist; cv->c_next; cv = cv->c_next) + ; + } + else if (!strcmp(*args, "up")) + cv = FindCanvas(D_forecv->c_xs, D_forecv->c_ys - 1); + else if (!strcmp(*args, "down")) + cv = FindCanvas(D_forecv->c_xs, D_forecv->c_ye + 2); + else if (!strcmp(*args, "left")) + cv = FindCanvas(D_forecv->c_xs - 1, D_forecv->c_ys); + else if (!strcmp(*args, "right")) + cv = FindCanvas(D_forecv->c_xe + 1, D_forecv->c_ys); + else + { + OutputMsg(0, "%s: usage: focus [next|prev|up|down|left|right|top|bottom]", rc_name); + break; + } + SetForeCanvas(display, cv); + } + break; + case RC_RESIZE: + i = 0; + if (D_forecv->c_slorient == SLICE_UNKN) { - struct canvas *cv; - for (cv = D_cvlist; cv->c_next && cv->c_next != D_forecv; cv = cv->c_next) - ; - D_forecv = cv; + OutputMsg(0, "resize: need more than one region"); + break; } - else if (!strcmp(*args, "top")) - D_forecv = D_cvlist; - else if (!strcmp(*args, "bottom")) + for (; *args; args++) { - struct canvas *cv; - for (cv = D_cvlist; cv->c_next; cv = cv->c_next) - ; - D_forecv = cv; + if (!strcmp(*args, "-h")) + i |= RESIZE_FLAG_H; + else if (!strcmp(*args, "-v")) + i |= RESIZE_FLAG_V; + else if (!strcmp(*args, "-b")) + i |= RESIZE_FLAG_H | RESIZE_FLAG_V; + else if (!strcmp(*args, "-p")) + i |= D_forecv->c_slorient == SLICE_VERT ? RESIZE_FLAG_H : RESIZE_FLAG_V; + else if (!strcmp(*args, "-l")) + i |= RESIZE_FLAG_L; + else + break; } - else + if (*args && args[1]) { - Msg(0, "%s: usage: focus [up|down|top|bottom]", rc_name); + OutputMsg(0, "%s: usage: resize [-h] [-v] [-l] [num]\n", rc_name); break; } - fore = D_fore = Layer2Window(D_forecv->c_layer); - flayer = D_forecv->c_layer; -#ifdef RXVT_OSC - if (D_xtermosc[2] || D_xtermosc[3]) - { - Activate(-1); - break; - } -#endif - RefreshHStatus(); -#ifdef RXVT_OSC - RefreshXtermOSC(); -#endif - flayer = D_forecv->c_layer; - CV_CALL(D_forecv, LayRestore();LaySetCursor()); - WindowChanged(0, 'F'); - break; - case RC_RESIZE: if (*args) - ResizeRegions(*args); + ResizeRegions(*args, i); else - Input("resize # lines: ", 20, INP_COOKED, ResizeFin, (char*)0); + Input(resizeprompts[i], 20, INP_EVERY, ResizeFin, (char*)0, i); break; case RC_SETSID: (void)ParseSwitch(act, &separate_sids); break; case RC_EVAL: - for (; *args; args++) + args = SaveArgs(args); + for (i = 0; args[i]; i++) { - char *ss = SaveStr(*args); - if (*ss) - Colonfin(ss, strlen(ss), (char *)0); - free(ss); + if (args[i][0]) + Colonfin(args[i], strlen(args[i]), (char *)0); + free(args[i]); } + free(args); break; case RC_ALTSCREEN: (void)ParseSwitch(act, &use_altscreen); if (msgok) - Msg(0, "Will %sdo alternate screen switching", use_altscreen ? "" : "not "); + OutputMsg(0, "Will %sdo alternate screen switching", use_altscreen ? "" : "not "); break; case RC_MAXWIN: + if (!args[0]) + { + OutputMsg(0, "maximum windows allowed: %d", maxwin); + break; + } if (ParseNum(act, &n)) break; if (n < 1) - Msg(0, "illegal maxwin number specified"); - else if (n > maxwin) - Msg(0, "may only decrease maxwin number"); + OutputMsg(0, "illegal maxwin number specified"); + else if (n > 2048) + OutputMsg(0, "maximum 2048 windows allowed"); + else if (n > maxwin && windows) + OutputMsg(0, "may increase maxwin only when there's no window"); else - maxwin = n; + { + if (!windows) + wtab = realloc(wtab, n * sizeof(struct win *)); + maxwin = n; + } break; case RC_BACKTICK: if (ParseBase(act, *args, &n, 10, "decimal")) @@ -3752,7 +4114,7 @@ int key; int lifespan, tick; if (argc < 4) { - Msg(0, "%s: usage: backtick num [lifespan tick cmd args...]", rc_name); + OutputMsg(0, "%s: usage: backtick num [lifespan tick cmd args...]", rc_name); break; } if (ParseBase(act, args[1], &lifespan, 10, "decimal")) @@ -3777,6 +4139,21 @@ int key; break; #ifdef BLANKER_PRG case RC_BLANKERPRG: + if (!args[0]) + { + if (blankerprg) + { + char path[MAXPATHLEN]; + char *p = path, **pp; + for (pp = blankerprg; *pp; pp++) + p += snprintf(p, sizeof(path) - (p - path) - 1, "%s ", *pp); + *(p - 1) = '\0'; + OutputMsg(0, "blankerprg: %s", path); + } + else + OutputMsg(0, "No blankerprg set."); + break; + } if (blankerprg) { char **pp; @@ -3801,7 +4178,7 @@ int key; { if ((i = FindCommnr(args[1])) == RC_ILLEGAL) { - Msg(0, "%s: idle: unknown command '%s'", rc_name, args[1]); + OutputMsg(0, "%s: idle: unknown command '%s'", rc_name, args[1]); break; } if (CheckArgNum(i, args + 2) < 0) @@ -3816,11 +4193,310 @@ int key; if (msgok) { if (idletimo) - Msg(0, "idle timeout %ds, %s", idletimo / 1000, comms[idleaction.nr].name); + OutputMsg(0, "idle timeout %ds, %s", idletimo / 1000, comms[idleaction.nr].name); + else + OutputMsg(0, "idle off"); + } + break; + case RC_FOCUSMINSIZE: + for (i = 0; i < 2 && args[i]; i++) + { + if (!strcmp(args[i], "max") || !strcmp(args[i], "_")) + n = -1; + else + n = atoi(args[i]); + if (i == 0) + focusminwidth = n; + else + focusminheight = n; + } + if (msgok) + { + char b[2][20]; + for (i = 0; i < 2; i++) + { + n = i == 0 ? focusminwidth : focusminheight; + if (n == -1) + strcpy(b[i], "max"); + else + sprintf(b[i], "%d", n); + } + OutputMsg(0, "focus min size is %s %s\n", b[0], b[1]); + } + break; + case RC_GROUP: + if (*args) + { + fore->w_group = 0; + if (args[0][0]) + { + fore->w_group = WindowByName(*args); + if (fore->w_group == fore || (fore->w_group && fore->w_group->w_type != W_TYPE_GROUP)) + fore->w_group = 0; + } + WindowChanged((struct win *)0, 'w'); + WindowChanged((struct win *)0, 'W'); + WindowChanged((struct win *)0, 0); + } + if (msgok) + { + if (fore->w_group) + OutputMsg(0, "window group is %d (%s)\n", fore->w_group->w_number, fore->w_group->w_title); + else + OutputMsg(0, "window belongs to no group"); + } + break; + case RC_LAYOUT: + // A number of the subcommands for "layout" are ignored, or not processed correctly when there + // is no attached display. + + if (!strcmp(args[0], "title")) + { + if (!display) + { + if (!args[1]) // There is no display, and there is no new title. Ignore. + break; + if (!layout_attach || layout_attach == &layout_last_marker) + layout_attach = CreateLayout(args[1], 0); + else + RenameLayout(layout_attach, args[1]); + break; + } + + if (!D_layout) + { + OutputMsg(0, "not on a layout"); + break; + } + if (!args[1]) + { + OutputMsg(0, "current layout is %d (%s)", D_layout->lay_number, D_layout->lay_title); + break; + } + RenameLayout(D_layout, args[1]); + } + else if (!strcmp(args[0], "number")) + { + if (!display) + { + if (args[1] && layout_attach && layout_attach != &layout_last_marker) + RenumberLayout(layout_attach, atoi(args[1])); + break; + } + + if (!D_layout) + { + OutputMsg(0, "not on a layout"); + break; + } + if (!args[1]) + { + OutputMsg(0, "This is layout %d (%s).\n", D_layout->lay_number, D_layout->lay_title); + break; + } + RenumberLayout(D_layout, atoi(args[1])); + break; + } + else if (!strcmp(args[0], "autosave")) + { + if (!display) + { + if (args[1] && layout_attach && layout_attach != &layout_last_marker) + { + if (!strcmp(args[1], "on")) + layout_attach->lay_autosave = 1; + else if (!strcmp(args[1], "off")) + layout_attach->lay_autosave = 0; + } + break; + } + + if (!D_layout) + { + OutputMsg(0, "not on a layout"); + break; + } + if (args[1]) + { + if (!strcmp(args[1], "on")) + D_layout->lay_autosave = 1; + else if (!strcmp(args[1], "off")) + D_layout->lay_autosave = 0; + else + { + OutputMsg(0, "invalid argument. Give 'on' or 'off"); + break; + } + } + if (msgok) + OutputMsg(0, "autosave is %s", D_layout->lay_autosave ? "on" : "off"); + } + else if (!strcmp(args[0], "new")) + { + char *t = args[1]; + n = 0; + if (t) + { + while (*t >= '0' && *t <= '9') + t++; + if (t != args[1] && (!*t || *t == ':')) + { + n = atoi(args[1]); + if (*t) + t++; + } + else + t = args[1]; + } + if (!t || !*t) + t = "layout"; + NewLayout(t, n); + Activate(-1); + } + else if (!strcmp(args[0], "save")) + { + if (!args[1]) + { + OutputMsg(0, "usage: layout save <name>"); + break; + } + if (display) + SaveLayout(args[1], &D_canvas); + } + else if (!strcmp(args[0], "select")) + { + if (!display) + { + if (args[1]) + layout_attach = FindLayout(args[1]); + break; + } + if (!args[1]) + { + Input("Switch to layout: ", 20, INP_COOKED, SelectLayoutFin, NULL, 0); + break; + } + SelectLayoutFin(args[1], strlen(args[1]), (char *)0); + } + else if (!strcmp(args[0], "next")) + { + if (!display) + { + if (layout_attach && layout_attach != &layout_last_marker) + layout_attach = layout_attach->lay_next ? layout_attach->lay_next : layouts;; + break; + } + struct layout *lay = D_layout; + if (lay) + lay = lay->lay_next ? lay->lay_next : layouts; + else + lay = layouts; + if (!lay) + { + OutputMsg(0, "no layout defined"); + break; + } + if (lay == D_layout) + break; + LoadLayout(lay, &D_canvas); + Activate(-1); + } + else if (!strcmp(args[0], "prev")) + { + struct layout *lay = display ? D_layout : layout_attach; + struct layout *target = lay; + if (lay) + { + for (lay = layouts; lay->lay_next && lay->lay_next != target; lay = lay->lay_next) + ; + } + else + lay = layouts; + + if (!display) + { + layout_attach = lay; + break; + } + + if (!lay) + { + OutputMsg(0, "no layout defined"); + break; + } + if (lay == D_layout) + break; + LoadLayout(lay, &D_canvas); + Activate(-1); + } + else if (!strcmp(args[0], "attach")) + { + if (!args[1]) + { + if (!layout_attach) + OutputMsg(0, "no attach layout set"); + else if (layout_attach == &layout_last_marker) + OutputMsg(0, "will attach to last layout"); + else + OutputMsg(0, "will attach to layout %d (%s)", layout_attach->lay_number, layout_attach->lay_title); + break; + } + if (!strcmp(args[1], ":last")) + layout_attach = &layout_last_marker; + else if (!args[1][0]) + layout_attach = 0; + else + { + struct layout *lay; + lay = FindLayout(args[1]); + if (!lay) + { + OutputMsg(0, "unknown layout '%s'", args[1]); + break; + } + layout_attach = lay; + } + } + else if (!strcmp(args[0], "show")) + { + ShowLayouts(-1); + } + else if (!strcmp(args[0], "remove")) + { + struct layout *lay = display ? D_layout : layouts; + if (args[1]) + { + lay = layouts ? FindLayout(args[1]) : (struct layout *)0; + if (!lay) + { + OutputMsg(0, "unknown layout '%s'", args[1]); + break; + } + } + if (lay) + RemoveLayout(lay); + } + else if (!strcmp(args[0], "dump")) + { + if (!display) + OutputMsg(0, "Must have a display for 'layout dump'."); + else if (!LayoutDumpCanvas(&D_canvas, args[1] ? args[1] : "layout-dump")) + OutputMsg(errno, "Error dumping layout."); else - Msg(0, "idle off"); + OutputMsg(0, "Layout dumped to \"%s\"", args[1] ? args[1] : "layout-dump"); } + else + OutputMsg(0, "unknown layout subcommand"); + break; +#ifdef DW_CHARS + case RC_CJKWIDTH: + if(ParseSwitch(act, &cjkwidth) == 0) + { + if(msgok) + OutputMsg(0, "Treat ambiguous width characters as %s width", cjkwidth ? "full" : "half"); + } break; +#endif default: #ifdef HAVE_BRAILLE /* key == -2: input from braille keybord, msgok always 0 */ @@ -3835,6 +4511,7 @@ int key; break; } } +#undef OutputMsg void DoCommand(argv, argl) @@ -3842,10 +4519,26 @@ char **argv; int *argl; { struct action act; + const char *cmd = *argv; - if ((act.nr = FindCommnr(*argv)) == RC_ILLEGAL) + act.quiet = 0; + /* For now, we actually treat both 'supress error' and 'suppress normal message' as the + * same, and ignore all messages on either flag. If we wanted to do otherwise, we would + * need to change the definition of 'OutputMsg' slightly. */ + if (*cmd == '@') /* Suppress error */ + { + act.quiet |= 0x01; + cmd++; + } + if (*cmd == '-') /* Suppress normal message */ { - Msg(0, "%s: unknown command '%s'", rc_name, *argv); + act.quiet |= 0x02; + cmd++; + } + + if ((act.nr = FindCommnr(cmd)) == RC_ILLEGAL) + { + Msg(0, "%s: unknown command '%s'", rc_name, cmd); return; } act.args = argv + 1; @@ -3875,9 +4568,9 @@ int *argl; return; } if ((pp = (char **)malloc((unsigned)(argc + 1) * sizeof(char **))) == 0) - Panic(0, strnomem); + Panic(0, "%s", strnomem); if ((lp = (int *)malloc((unsigned)(argc) * sizeof(int *))) == 0) - Panic(0, strnomem); + Panic(0, "%s", strnomem); act->nr = nr; act->args = pp; act->argl = lp; @@ -3899,7 +4592,7 @@ char **args; while (args[argc]) argc++; if ((pp = ap = (char **)malloc((unsigned)(argc + 1) * sizeof(char **))) == 0) - Panic(0, strnomem); + Panic(0, "%s", strnomem); while (argc--) *pp++ = SaveStr(*args++); *pp = 0; @@ -3931,6 +4624,7 @@ int bufl, *argl; delim = 0; for (;;) { + *lp = 0; while (*p && (*p == ' ' || *p == '\t')) ++p; #ifdef PSEUDOS @@ -3963,7 +4657,7 @@ int bufl, *argl; { if (*p == delim) delim = 0; - else if (delim != '\'' && *p == '\\' && (p[1] == '\'' || p[1] == '"' || p[1] == '\\' || p[1] == '$' || p[1] == '#' || p[1] == '^' || (p[1] >= '0' && p[1] <= '7'))) + else if (delim != '\'' && *p == '\\' && (p[1] == 'n' || p[1] == 'r' || p[1] == 't' || p[1] == '\'' || p[1] == '"' || p[1] == '\\' || p[1] == '$' || p[1] == '#' || p[1] == '^' || (p[1] >= '0' && p[1] <= '7'))) { p++; if (*p >= '0' && *p <= '7') @@ -3982,12 +4676,21 @@ int bufl, *argl; pp++; } else - *pp++ = *p; + { + switch (*p) + { + case 'n': *pp = '\n'; break; + case 'r': *pp = '\r'; break; + case 't': *pp = '\t'; break; + default: *pp = *p; break; + } + pp++; + } } else if (delim != '\'' && *p == '$' && (p[1] == '{' || p[1] == ':' || (p[1] >= 'a' && p[1] <= 'z') || (p[1] >= 'A' && p[1] <= 'Z') || (p[1] >= '0' && p[1] <= '9') || p[1] == '_')) { - char *ps, *pe, op, *v, xbuf[11]; + char *ps, *pe, op, *v, xbuf[11], path[MAXPATHLEN]; int vl; ps = ++p; @@ -4029,6 +4732,22 @@ int bufl, *argl; sprintf(xbuf, "%d", display ? D_width : -1); else if (!strcmp(ps, "LINES")) sprintf(xbuf, "%d", display ? D_height : -1); + else if (!strcmp(ps, "PID")) + sprintf(xbuf, "%d", getpid()); + else if (!strcmp(ps, "PWD")) + { + if (getcwd(path, sizeof(path) - 1) == 0) + v = "?"; + else + v = path; + } + else if (!strcmp(ps, "STY")) + { + if ((v = strchr(SockName, '.'))) /* Skip the PID */ + v++; + else + v = SockName; + } else v = getenv(ps); } @@ -4300,7 +5019,7 @@ char *str; int i; struct win *p; - if ((i = WindowByNumber(str)) < 0 || i >= MAXWIN) + if ((i = WindowByNumber(str)) < 0 || i >= maxwin) { if ((p = WindowByName(str))) return p->w_number; @@ -4405,7 +5124,7 @@ int n; struct win *p; debug1("SwitchWindow %d\n", n); - if (n < 0 || n >= MAXWIN) + if (n < 0 || n >= maxwin) { ShowWindows(-1); return; @@ -4436,100 +5155,6 @@ int n; Activate(fore->w_norefresh); } - -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) - { - 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; - - /* add our canvas to the layer's canvaslist */ - 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 && 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(); - } - } - } -} - - /* * SetForeWindow changes the window in the input focus of the display. * Puts window wi in canvas display->d_forecv. @@ -4603,15 +5228,21 @@ static int NextWindow() { register struct win **pp; - int n = fore ? fore->w_number : -1; + int n = fore ? fore->w_number : maxwin; + struct win *group = fore ? fore->w_group : 0; - for (pp = wtab + n + 1; pp != wtab + n; pp++) + for (pp = fore ? wtab + n + 1 : wtab; pp != wtab + n; pp++) { - if (pp == wtab + MAXWIN) + if (pp == wtab + maxwin) pp = wtab; if (*pp) - break; + { + if (!fore || group == (*pp)->w_group) + break; + } } + if (pp == wtab + n) + return -1; return pp - wtab; } @@ -4619,15 +5250,21 @@ static int PreviousWindow() { register struct win **pp; - int n = fore ? fore->w_number : MAXWIN - 1; + int n = fore ? fore->w_number : -1; + struct win *group = fore ? fore->w_group : 0; for (pp = wtab + n - 1; pp != wtab + n; pp--) { - if (pp < wtab) - pp = wtab + MAXWIN - 1; + if (pp == wtab - 1) + pp = wtab + maxwin - 1; if (*pp) - break; + { + if (!fore || group == (*pp)->w_group) + break; + } } + if (pp == wtab + n) + return -1; return pp - wtab; } @@ -4653,6 +5290,7 @@ struct win *wi; struct win **pp, *p; struct canvas *cv; int gotone; + struct layout *lay; /* * Remove window from linked list. @@ -4697,6 +5335,11 @@ struct win *wi; Activate(-1); } } + + /* do the same for the layouts */ + for (lay = layouts; lay; lay = lay->lay_next) + UpdateLayoutCanvas(&lay->lay_canvas, wi); + FreeWindow(wi); WindowChanged((struct win *)0, 'w'); WindowChanged((struct win *)0, 'W'); @@ -4748,14 +5391,22 @@ int where; int l; s = ss = buf; - for (pp = ((flags & 4) && where >= 0) ? wtab + where + 1: wtab; pp < wtab + MAXWIN; pp++) + if ((flags & 8) && where < 0) { + *s = 0; + return ss; + } + for (pp = ((flags & 4) && where >= 0) ? wtab + where + 1: wtab; pp < wtab + maxwin; pp++) + { + int rend = -1; if (pp - wtab == where && ss == buf) - ss = s; + ss = s; if ((p = *pp) == 0) continue; if ((flags & 1) && display && p == D_fore) continue; + if (display && D_fore && D_fore->w_group != p->w_group) + continue; cmd = p->w_title; l = strlen(cmd); @@ -4768,9 +5419,24 @@ int where; *s++ = ' '; *s++ = ' '; } - sprintf(s, "%d", p->w_number); if (p->w_number == where) - ss = s; + { + ss = s; + if (flags & 8) + break; + } + if (!(flags & 4) || where < 0 || ((flags & 4) && where < p->w_number)) + { + if (p->w_monitor == MON_DONE && renditions[REND_MONITOR] != -1) + rend = renditions[REND_MONITOR]; + else if ((p->w_bell == BELL_DONE || p->w_bell == BELL_FOUND) && renditions[REND_BELL] != -1) + rend = renditions[REND_BELL]; + else if ((p->w_silence == SILENCE_FOUND || p->w_silence == SILENCE_DONE) && renditions[REND_SILENCE] != -1) + rend = renditions[REND_SILENCE]; + } + if (rend != -1) + AddWinMsgRend(s, rend); + sprintf(s, "%d", p->w_number); s += strlen(s); if (display && p == D_fore) *s++ = '*'; @@ -4783,6 +5449,8 @@ int where; *s++ = ' '; strncpy(s, cmd, l); s += l; + if (rend != -1) + AddWinMsgRend(s, -1); } *s = 0; return ss; @@ -4808,7 +5476,11 @@ struct win *p; #endif if (p->w_layer.l_cvlist && p->w_layer.l_cvlist->c_lnext) *s++ = '&'; - if (p->w_monitor == MON_DONE) + if (p->w_monitor == MON_DONE +#ifdef MULTIUSER + && (ACLBYTE(p->w_mon_notify, D_user->u_id) & ACLBIT(D_user->u_id)) +#endif + ) *s++ = '@'; if (p->w_bell == BELL_DONE) *s++ = '!'; @@ -4821,7 +5493,7 @@ struct win *p; strcpy(s, "(L)"); s += 3; } - if (p->w_ptyfd < 0) + if (p->w_ptyfd < 0 && p->w_type != W_TYPE_GROUP) *s++ = 'Z'; *s = 0; return s; @@ -4841,7 +5513,7 @@ struct win *p; s = buf; for (display = displays; display; display = display->d_next) { - if (D_user == olddisplay->d_user) + if (olddisplay && D_user == olddisplay->d_user) continue; for (cv = D_cvlist; cv; cv = cv->c_next) if (Layer2Window(cv->c_layer) == p) @@ -4877,13 +5549,11 @@ int where; char buf[1024]; char *s, *ss; - if (!display) - return; - if (where == -1 && D_fore) + if (display && where == -1 && D_fore) where = D_fore->w_number; ss = AddWindows(buf, sizeof(buf), 0, where); s = buf + strlen(buf); - if (ss - buf > D_width / 2) + if (display && ss - buf > D_width / 2) { ss -= D_width / 2; if (s - ss < D_width) @@ -4927,7 +5597,12 @@ ShowInfo() if (wp->w_origin) sprintf(p += strlen(p), " org"); if (wp->w_keypad) sprintf(p += strlen(p), " app"); if (wp->w_log) sprintf(p += strlen(p), " log"); - if (wp->w_monitor != MON_OFF) sprintf(p += strlen(p), " mon"); + if (wp->w_monitor != MON_OFF +#ifdef MULTIUSER + && (ACLBYTE(wp->w_mon_notify, D_user->u_id) & ACLBIT(D_user->u_id)) +#endif + ) + sprintf(p += strlen(p), " mon"); if (wp->w_mouse) sprintf(p += strlen(p), " mouse"); #ifdef COLOR if (wp->w_bce) sprintf(p += strlen(p), " bce"); @@ -5062,7 +5737,7 @@ InputAKA() { char *s, *ss; int n; - Input("Set window's title to: ", sizeof(fore->w_akabuf) - 1, INP_COOKED, AKAfin, NULL); + Input("Set window's title to: ", sizeof(fore->w_akabuf) - 1, INP_COOKED, AKAfin, NULL, 0); s = fore->w_title; if (!s) return; @@ -5083,16 +5758,69 @@ int len; char *data; /* dummy */ { char mbuf[256]; - if (len) + + RemoveStatus(); + if (buf[len] == '\t') { - len = strlen(buf) + 1; - if (len > (int)sizeof(mbuf)) - RcLine(buf, len); - else + int m, x; + int l = 0, r = RC_LAST; + int showmessage = 0; + char *s = buf; + + while (*s && s - buf < len) + if (*s++ == ' ') + return; + + /* Showing a message when there's no hardstatus or caption cancels the input */ + if (display && + (captionalways || D_has_hstatus == HSTATUS_LASTLINE || (D_canvas.c_slperp && D_canvas.c_slperp->c_slnext))) + showmessage = 1; + + while (l <= r) { - bcopy(buf, mbuf, len); - RcLine(mbuf, sizeof mbuf); + m = (l + r) / 2; + x = strncmp(buf, comms[m].name, len); + if (x > 0) + l = m + 1; + else if (x < 0) + r = m - 1; + else + { + s = mbuf; + for (l = m - 1; l >= 0 && strncmp(buf, comms[l].name, len) == 0; l--) + ; + for (m = ++l; m <= r && strncmp(buf, comms[m].name, len) == 0 && s - mbuf < sizeof(mbuf); m++) + s += snprintf(s, sizeof(mbuf) - (s - mbuf), " %s", comms[m].name); + if (l < m - 1) + { + if (showmessage) + Msg(0, "Possible commands:%s", mbuf); + } + else + { + s = mbuf; + len = snprintf(mbuf, sizeof(mbuf), "%s \t", comms[l].name + len); + if (len > 0 && len < sizeof(mbuf)) + LayProcess(&s, &len); + } + break; + } } + if (l > r && showmessage) + Msg(0, "No commands matching '%*s'", len, buf); + return; + } + + if (!len || buf[len]) + return; + + len = strlen(buf) + 1; + if (len > (int)sizeof(mbuf)) + RcLine(buf, len); + else + { + bcopy(buf, mbuf, len); + RcLine(mbuf, sizeof mbuf); } } @@ -5116,11 +5844,40 @@ char *data; /* dummy */ return; SwitchWindow(n); } + +static void +SelectLayoutFin(buf, len, data) +char *buf; +int len; +char *data; /* dummy */ +{ + struct layout *lay; + + if (!len || !display) + return; + if (len == 1 && *buf == '-') + { + LoadLayout((struct layout *)0, (struct canvas *)0); + Activate(0); + return; + } + lay = FindLayout(buf); + if (!lay) + Msg(0, "No such layout\n"); + else if (lay == D_layout) + Msg(0, "This IS layout %d (%s).\n", lay->lay_number, lay->lay_title); + else + { + LoadLayout(lay, &D_canvas); + Activate(0); + } +} + static void InputSelect() { - Input("Switch to window: ", 20, INP_COOKED, SelectFin, NULL); + Input("Switch to window: ", 20, INP_COOKED, SelectFin, NULL, 0); } static char setenv_var[31]; @@ -5160,10 +5917,10 @@ char *arg; { strncpy(setenv_var, arg, sizeof(setenv_var) - 1); sprintf(setenv_buf, "Enter value for %s: ", setenv_var); - Input(setenv_buf, 30, INP_COOKED, SetenvFin2, NULL); + Input(setenv_buf, 30, INP_COOKED, SetenvFin2, NULL, 0); } else - Input("Setenv: Enter variable name: ", 30, INP_COOKED, SetenvFin1, NULL); + Input("Setenv: Enter variable name: ", 30, INP_COOKED, SetenvFin1, NULL, 0); } /* @@ -5276,7 +6033,7 @@ char *fn, **av; if (*buf != '\0') nwin.aka = buf; num = atoi(*av); - if (num < 0 || num > MAXWIN - 1) + if (num < 0 || (maxwin && num > maxwin - 1) || (!maxwin && num > MAXWIN - 1)) { Msg(0, "%s: illegal screen number %d.", fn, num); num = 0; @@ -5393,7 +6150,7 @@ char *data; /* dummy */ { if ((pp->buf = (char *)malloc(D_user->u_plop.len)) == NULL) { - Msg(0, strnomem); + Msg(0, "%s", strnomem); return; } bcopy(D_user->u_plop.buf, pp->buf, D_user->u_plop.len); @@ -5413,16 +6170,15 @@ char *data; /* dummy */ { struct plop *pp = plop_tab + (int)(unsigned char)*buf; - - if (!fore) - return; /* Input() should not call us w/o fore, but you never know... */ - if (*buf == '.') - Msg(0, "ins_reg_fn: Warning: pasting real register '.'!"); if (len) { *buf = 0; return; } + if (!fore) + return; /* Input() should not call us w/o fore, but you never know... */ + if (*buf == '.') + Msg(0, "ins_reg_fn: Warning: pasting real register '.'!"); if (pp->buf) { MakePaster(&fore->w_paster, pp->buf, pp->len, 0); @@ -5457,7 +6213,7 @@ static void confirm_fn(buf, len, data) char *buf; int len; -char *data; /* dummy */ +char *data; { struct action act; @@ -5466,9 +6222,10 @@ char *data; /* dummy */ *buf = 0; return; } - act.nr = (int)data; + act.nr = *(int *)data; act.args = noargs; act.argl = 0; + act.quiet = 0; DoAction(&act, -1); } @@ -5500,11 +6257,11 @@ char *data; if (buf && len) strncpy(p, buf, 1 + (l < len) ? l : len); if (!*i->name) - Input("Screen User: ", sizeof(i->name) - 1, INP_COOKED, su_fin, (char *)i); + Input("Screen User: ", sizeof(i->name) - 1, INP_COOKED, su_fin, (char *)i, 0); else if (!*i->pw1) - Input("User's UNIX Password: ", sizeof(i->pw1)-1, INP_COOKED|INP_NOECHO, su_fin, (char *)i); + Input("User's UNIX Password: ", sizeof(i->pw1)-1, INP_COOKED|INP_NOECHO, su_fin, (char *)i, 0); else if (!*i->pw2) - Input("User's Screen Password: ", sizeof(i->pw2)-1, INP_COOKED|INP_NOECHO, su_fin, (char *)i); + Input("User's Screen Password: ", sizeof(i->pw2)-1, INP_COOKED|INP_NOECHO, su_fin, (char *)i, 0); else { if ((p = DoSu(i->up, i->name, i->pw2, i->pw1))) @@ -5550,7 +6307,7 @@ char *data; free((char *)u->u_password); u->u_password = SaveStr(buf); bzero(buf, strlen(buf)); - Input("Retype new password:", 100, INP_NOECHO, pass2, data); + Input("Retype new password:", 100, INP_NOECHO, pass2, data, 0); } static void @@ -5600,7 +6357,7 @@ char *data; #endif if (!(u->u_plop.buf = SaveStr(u->u_password))) { - Msg(0, strnomem); + Msg(0, "%s", strnomem); D_user->u_plop.len = 0; } else @@ -5612,6 +6369,18 @@ char *data; } #endif /* PASSWORD */ +static int +digraph_find(buf) +const char *buf; +{ + int i; + for (i = 0; i < MAX_DIGRAPH && digraphs[i].d[0]; i++) + if ((digraphs[i].d[0] == (unsigned char)buf[0] && digraphs[i].d[1] == (unsigned char)buf[1]) || + (digraphs[i].d[0] == (unsigned char)buf[1] && digraphs[i].d[1] == (unsigned char)buf[0])) + break; + return i; +} + static void digraph_fn(buf, len, data) char *buf; @@ -5623,6 +6392,7 @@ char *data; /* dummy */ ch = buf[len]; if (ch) { + buf[len + 1] = ch; /* so we can restore it later */ if (ch < ' ' || ch == '\177') return; if (len >= 1 && ((*buf == 'U' && buf[1] == '+') || (*buf == '0' && (buf[1] == 'x' || buf[1] == 'X')))) @@ -5653,47 +6423,23 @@ char *data; /* dummy */ buf[len] = '\n'; return; } - buf[len] = buf[len + 1]; /* gross */ - len++; - if (len < 2) + if (len < 1) return; - if (len >= 1 && ((*buf == 'U' && buf[1] == '+') || (*buf == '0' && (buf[1] == 'x' || buf[1] == 'X')))) + if (buf[len + 1]) { - x = 0; - for (i = 2; i < len; i++) - { - if (buf[i] >= '0' && buf[i] <= '9') - x = x * 16 | (buf[i] - '0'); - else if (buf[i] >= 'a' && buf[i] <= 'f') - x = x * 16 | (buf[i] - ('a' - 10)); - else if (buf[i] >= 'A' && buf[i] <= 'F') - x = x * 16 | (buf[i] - ('A' - 10)); - else - break; - } + buf[len] = buf[len + 1]; /* stored above */ + len++; } - else if (buf[0] == '0') - { - x = 0; - for (i = 1; i < len; i++) - { - if (buf[i] < '0' || buf[i] > '7') - break; - x = x * 8 | (buf[i] - '0'); - } - } - else + if (len < 2) + return; + if (!parse_input_int(buf, len, &x)) { - for (i = 0; i < (int)(sizeof(digraphs)/sizeof(*digraphs)); i++) - if ((digraphs[i][0] == (unsigned char)buf[0] && digraphs[i][1] == (unsigned char)buf[1]) || - (digraphs[i][0] == (unsigned char)buf[1] && digraphs[i][1] == (unsigned char)buf[0])) - break; - if (i == (int)(sizeof(digraphs)/sizeof(*digraphs))) + i = digraph_find(buf); + if ((x = digraphs[i].value) <= 0) { Msg(0, "Unknown digraph"); return; } - x = digraphs[i][2]; } i = 1; *buf = x; @@ -5711,12 +6457,26 @@ StuffKey(i) int i; { struct action *act; + int discard = 0; debug1("StuffKey #%d", i); #ifdef DEBUG if (i < KMAP_KEYS) debug1(" - %s", term[i + T_CAPS].tcname); #endif + + if (i < KMAP_KEYS && D_ESCseen) + { + struct action *act = &D_ESCseen[i + 256]; + if (act->nr != RC_ILLEGAL) + { + D_ESCseen = 0; + DoAction(act, i + 256); + return 0; + } + discard = 1; + } + if (i >= T_CURSOR - T_CAPS && i < T_KEYPAD - T_CAPS && D_cursorkeys) i += T_OCAPS - T_CURSOR; else if (i >= T_KEYPAD - T_CAPS && i < T_OCAPS - T_CAPS && D_keypad) @@ -5726,14 +6486,21 @@ int i; fore = D_fore; act = 0; #ifdef COPY_PASTE - if (InMark() || InInput() || InWList()) + if (flayer && flayer->l_mode == 1) act = i < KMAP_KEYS+KMAP_AKEYS ? &mmtab[i] : &kmap_exts[i - (KMAP_KEYS+KMAP_AKEYS)].mm; #endif if ((!act || act->nr == RC_ILLEGAL) && !D_mapdefault) act = i < KMAP_KEYS+KMAP_AKEYS ? &umtab[i] : &kmap_exts[i - (KMAP_KEYS+KMAP_AKEYS)].um; - D_mapdefault = 0; if (!act || act->nr == RC_ILLEGAL) act = i < KMAP_KEYS+KMAP_AKEYS ? &dmtab[i] : &kmap_exts[i - (KMAP_KEYS+KMAP_AKEYS)].dm; + + if (discard && (!act || act->nr != RC_COMMAND)) + { + D_ESCseen = 0; + return 0; + } + D_mapdefault = 0; + if (act == 0 || act->nr == RC_ILLEGAL) return -1; DoAction(act, 0); @@ -5873,53 +6640,245 @@ char *str; #endif +static int +CalcSlicePercent(cv, percent) +struct canvas *cv; +int percent; +{ + int w, wsum, up; + if (!cv || !cv->c_slback) + return percent; + up = CalcSlicePercent(cv->c_slback->c_slback, percent); + w = cv->c_slweight; + for (cv = cv->c_slback->c_slperp, wsum = 0; cv; cv = cv->c_slnext) + wsum += cv->c_slweight; + if (wsum == 0) + return 0; + return (up * w) / wsum; +} + +static int +ChangeCanvasSize(fcv, abs, diff, gflag, percent) +struct canvas *fcv; /* make this canvas bigger */ +int abs; /* mode: 0:rel 1:abs 2:max */ +int diff; /* change this much */ +int gflag; /* go up if neccessary */ +int percent; +{ + struct canvas *cv; + int done, have, m, dir; + + debug3("ChangeCanvasSize abs %d diff %d percent=%d\n", abs, diff, percent); + if (abs == 0 && diff == 0) + return 0; + if (abs == 2) + { + if (diff == 0) + fcv->c_slweight = 0; + else + { + for (cv = fcv->c_slback->c_slperp; cv; cv = cv->c_slnext) + cv->c_slweight = 0; + fcv->c_slweight = 1; + cv = fcv->c_slback->c_slback; + if (gflag && cv && cv->c_slback) + ChangeCanvasSize(cv, abs, diff, gflag, percent); + } + return diff; + } + if (abs) + { + if (diff < 0) + diff = 0; + if (percent && diff > percent) + diff = percent; + } + if (percent) + { + int wsum, up; + for (cv = fcv->c_slback->c_slperp, wsum = 0; cv; cv = cv->c_slnext) + wsum += cv->c_slweight; + if (wsum) + { + up = gflag ? CalcSlicePercent(fcv->c_slback->c_slback, percent) : percent; + debug3("up=%d, wsum=%d percent=%d\n", up, wsum, percent); + if (wsum < 1000) + { + int scale = wsum < 10 ? 1000 : 100; + for (cv = fcv->c_slback->c_slperp; cv; cv = cv->c_slnext) + cv->c_slweight *= scale; + wsum *= scale; + debug1("scaled wsum to %d\n", wsum); + } + for (cv = fcv->c_slback->c_slperp; cv; cv = cv->c_slnext) + { + if (cv->c_slweight) + { + cv->c_slweight = (cv->c_slweight * up) / percent; + if (cv->c_slweight == 0) + cv->c_slweight = 1; + } + debug1(" - weight %d\n", cv->c_slweight); + } + diff = (diff * wsum) / percent; + percent = wsum; + } + } + else + { + if (abs && diff == (fcv->c_slorient == SLICE_VERT ? fcv->c_ye - fcv->c_ys + 2 : fcv->c_xe - fcv->c_xs + 2)) + return 0; + /* fix weights to real size (can't be helped, sorry) */ + for (cv = fcv->c_slback->c_slperp; cv; cv = cv->c_slnext) + { + cv->c_slweight = cv->c_slorient == SLICE_VERT ? cv->c_ye - cv->c_ys + 2 : cv->c_xe - cv->c_xs + 2; + debug1(" - weight %d\n", cv->c_slweight); + } + } + if (abs) + diff = diff - fcv->c_slweight; + debug1("diff = %d\n", diff); + if (diff == 0) + return 0; + if (diff < 0) + { + cv = fcv->c_slnext ? fcv->c_slnext : fcv->c_slprev; + fcv->c_slweight += diff; + cv->c_slweight -= diff; + return diff; + } + done = 0; + dir = 1; + for (cv = fcv->c_slnext; diff > 0; cv = dir > 0 ? cv->c_slnext : cv->c_slprev) + { + if (!cv) + { + debug1("reached end, dir is %d\n", dir); + if (dir == -1) + break; + dir = -1; + cv = fcv; + continue; + } + if (percent) + m = 1; + else + m = cv->c_slperp ? CountCanvasPerp(cv) * 2 : 2; + debug2("min is %d, have %d\n", m, cv->c_slweight); + if (cv->c_slweight > m) + { + have = cv->c_slweight - m; + if (have > diff) + have = diff; + debug1("subtract %d\n", have); + cv->c_slweight -= have; + done += have; + diff -= have; + } + } + if (diff && gflag) + { + /* need more room! */ + cv = fcv->c_slback->c_slback; + if (cv && cv->c_slback) + done += ChangeCanvasSize(fcv->c_slback->c_slback, 0, diff, gflag, percent); + } + fcv->c_slweight += done; + debug1("ChangeCanvasSize returns %d\n", done); + return done; +} + static void -ResizeRegions(arg) +ResizeRegions(arg, flags) char *arg; +int flags; { struct canvas *cv; - int nreg, dsize, diff, siz; + int diff, l; + int gflag = 0, abs = 0, percent = 0; + int orient = 0; ASSERT(display); - for (nreg = 0, cv = D_cvlist; cv; cv = cv->c_next) - nreg++; - if (nreg < 2) + if (!*arg) + return; + if (D_forecv->c_slorient == SLICE_UNKN) { Msg(0, "resize: need more than one region"); return; } - dsize = D_height - (D_has_hstatus == HSTATUS_LASTLINE); + gflag = flags & RESIZE_FLAG_L ? 0 : 1; + orient |= flags & RESIZE_FLAG_H ? SLICE_HORI : 0; + orient |= flags & RESIZE_FLAG_V ? SLICE_VERT : 0; + if (orient == 0) + orient = D_forecv->c_slorient; + l = strlen(arg); if (*arg == '=') { /* make all regions the same height */ - int h = dsize; - int hh, i = 0; - for (cv = D_cvlist; cv; cv = cv->c_next) - { - hh = h / nreg-- - 1; - cv->c_ys = i; - cv->c_ye = i + hh - 1; - cv->c_yoff = i; - i += hh + 1; - h -= hh + 1; + struct canvas *cv = gflag ? &D_canvas : D_forecv->c_slback; + if (cv->c_slperp->c_slorient & orient) + EqualizeCanvas(cv->c_slperp, gflag); + /* can't use cv->c_slorient directly as it can be D_canvas */ + if ((cv->c_slperp->c_slorient ^ (SLICE_HORI ^ SLICE_VERT)) & orient) + { + if (cv->c_slback) + { + cv = cv->c_slback; + EqualizeCanvas(cv->c_slperp, gflag); + } + else + EqualizeCanvas(cv, gflag); } + ResizeCanvas(cv); + RecreateCanvasChain(); RethinkDisplayViewports(); ResizeLayersToCanvases(); return; } - siz = D_forecv->c_ye - D_forecv->c_ys + 1; - if (*arg == '+') - diff = atoi(arg + 1); - else if (*arg == '-') - diff = -atoi(arg + 1); - else if (!strcmp(arg, "min")) - diff = 1 - siz; - else if (!strcmp(arg, "max")) - diff = dsize - (nreg - 1) * 2 - 1 - siz; + if (!strcmp(arg, "min") || !strcmp(arg, "0")) + { + abs = 2; + diff = 0; + } + else if (!strcmp(arg, "max") || !strcmp(arg, "_")) + { + abs = 2; + diff = 1; + } else - diff = atoi(arg) - siz; - if (diff == 0) + { + if (l > 0 && arg[l - 1] == '%') + percent = 1000; + if (*arg == '+') + diff = atoi(arg + 1); + else if (*arg == '-') + diff = -atoi(arg + 1); + else + { + diff = atoi(arg); /* +1 because of caption line */ + if (diff < 0) + diff = 0; + abs = diff == 0 ? 2 : 1; + } + } + if (!abs && !diff) return; + if (percent) + diff = diff * percent / 100; + cv = D_forecv; + if (cv->c_slorient & orient) + ChangeCanvasSize(cv, abs, diff, gflag, percent); + if (cv->c_slback->c_slorient & orient) + ChangeCanvasSize(cv->c_slback, abs, diff, gflag, percent); + + ResizeCanvas(&D_canvas); + RecreateCanvasChain(); + RethinkDisplayViewports(); + ResizeLayersToCanvases(); + return; + +#if 0 + if (siz + diff < 1) diff = 1 - siz; if (siz + diff > dsize - (nreg - 1) * 2 - 1) @@ -5977,6 +6936,7 @@ char *arg; } RethinkDisplayViewports(); ResizeLayersToCanvases(); +#endif } static void @@ -5985,7 +6945,72 @@ char *buf; int len; char *data; { - ResizeRegions(buf); + int ch; + int flags = *(int *)data; + ch = ((unsigned char *)buf)[len]; + if (ch == 0) + { + ResizeRegions(buf, flags); + return; + } + if (ch == 'h') + flags ^= RESIZE_FLAG_H; + else if (ch == 'v') + flags ^= RESIZE_FLAG_V; + else if (ch == 'b') + flags |= RESIZE_FLAG_H|RESIZE_FLAG_V; + else if (ch == 'p') + flags ^= D_forecv->c_slorient == SLICE_VERT ? RESIZE_FLAG_H : RESIZE_FLAG_V; + else if (ch == 'l') + flags ^= RESIZE_FLAG_L; + else + return; + inp_setprompt(resizeprompts[flags], NULL); + *(int *)data = flags; + buf[len] = '\034'; +} + +void +SetForeCanvas(d, cv) +struct display *d; +struct canvas *cv; +{ + struct display *odisplay = display; + if (d->d_forecv == cv) + return; + + display = d; + D_forecv = cv; + if ((focusminwidth && (focusminwidth < 0 || D_forecv->c_xe - D_forecv->c_xs + 1 < focusminwidth)) || + (focusminheight && (focusminheight < 0 || D_forecv->c_ye - D_forecv->c_ys + 1 < focusminheight))) + { + ResizeCanvas(&D_canvas); + RecreateCanvasChain(); + RethinkDisplayViewports(); + ResizeLayersToCanvases(); /* redisplays */ + } + fore = D_fore = Layer2Window(D_forecv->c_layer); + if (D_other == fore) + D_other = 0; + flayer = D_forecv->c_layer; +#ifdef RXVT_OSC + if (D_xtermosc[2] || D_xtermosc[3]) + { + Activate(-1); + } + else +#endif + { + RefreshHStatus(); +#ifdef RXVT_OSC + RefreshXtermOSC(); +#endif + flayer = D_forecv->c_layer; + CV_CALL(D_forecv, LayRestore();LaySetCursor()); + WindowChanged(0, 'F'); + } + + display = odisplay; } #ifdef RXVT_OSC @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,9 +19,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -34,7 +39,7 @@ #endif /* for solaris 2.1, Unixware (SVR4.2) and possibly others */ -#ifdef HAVE_SVR4_PTYS +#ifdef HAVE_STROPTS_H # include <sys/stropts.h> #endif @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,9 +19,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,9 +19,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -146,60 +151,22 @@ int wi, he; int change_fore; { struct win *p; - struct canvas *cv, **cvpp; + struct canvas *cv; int wwi; - int y, h, hn; debug2("ChangeScreenSize from (%d,%d) ", D_width, D_height); debug3("to (%d,%d) (change_fore: %d)\n",wi, he, change_fore); - /* - * STRATEGY: keep the ratios. - * if canvas doesn't fit anymore, throw it off. - * (ATTENTION: cvlist must be sorted!) - */ - y = 0; - h = he; - if (D_has_hstatus == HSTATUS_LASTLINE) - { - if (h > 1) - h--; - else - D_has_hstatus = 0; /* sorry */ - } - for (cvpp = &D_cvlist; (cv = *cvpp); ) + cv = &D_canvas; + cv->c_xe = wi - 1; + cv->c_ye = he - 1 - ((cv->c_slperp && cv->c_slperp->c_slnext) || captionalways) - (D_has_hstatus == HSTATUS_LASTLINE); + cv->c_blank.l_height = cv->c_ye - cv->c_ys + 1; + if (cv->c_slperp) { - if (h < 2 && cvpp != &D_cvlist) - { - /* kill canvas */ - SetCanvasWindow(cv, 0); - *cvpp = cv->c_next; - free(cv); - if (D_forecv == cv) - D_forecv = 0; - continue; - } - hn = (cv->c_ye - cv->c_ys + 1) * he / D_height; - if (hn == 0) - hn = 1; - if (hn + 2 >= h || cv->c_next == 0) - hn = h - 1; - if ((!captionalways && cv == D_cvlist && h - hn < 2) || hn == 0) - hn = h; - ASSERT(hn > 0); - cv->c_xs = 0; - cv->c_xe = wi - 1; - cv->c_ys = y; - cv->c_ye = y + hn - 1; - - cv->c_xoff = cv->c_xs; - cv->c_yoff = cv->c_ys; - - y += hn + 1; - h -= hn + 1; - cvpp = &cv->c_next; + ResizeCanvas(cv); + RecreateCanvasChain(); + RethinkDisplayViewports(); } - RethinkDisplayViewports(); if (D_forecv == 0) D_forecv = D_cvlist; if (D_forecv) @@ -226,7 +193,7 @@ int change_fore; debug2("Default size: (%d,%d)\n", D_defwidth, D_defheight); if (change_fore) ResizeLayersToCanvases(); - if (D_CWS == NULL && displays->d_next == 0) + if (change_fore == 2 && D_CWS == NULL && displays->d_next == 0) { /* adapt all windows - to be removed ? */ for (p = windows; p; p = p->w_next) @@ -356,6 +323,34 @@ kaablamm() Msg(0, "Aborted because of window size change."); } +/* Kills non-resizable layers. */ +#define RESIZE_OR_KILL_LAYERS(l, wi, he) do \ + { \ + struct layer *_last = NULL, *_iter; \ + flayer = (l); \ + while (flayer->l_next) \ + { \ + if (LayResize(wi, he) == 0) \ + { \ + _last = flayer; \ + flayer = flayer->l_next; \ + } \ + else \ + { \ + struct canvas *_cv; \ + for (_cv = flayer->l_cvlist; _cv; _cv = _cv->c_lnext) \ + _cv->c_display->d_kaablamm = 1; \ + ExitOverlayPage(); \ + if (_last) \ + _last->l_next = flayer; \ + } \ + } \ + /* We assume that the bottom-most layer, i.e. when flayer->l_next == 0, \ + * is always resizable. Currently, WinLf and BlankLf can be the bottom-most layers. \ + */ \ + LayResize(wi, he); \ + } while (0) + void ResizeLayer(l, wi, he, norefdisp) struct layer *l; @@ -371,52 +366,39 @@ struct display *norefdisp; return; p = Layer2Window(l); + /* If 'flayer' and 'l' are for the same window, then we will not + * restore 'flayer'. */ if (oldflayer && (l == oldflayer || Layer2Window(oldflayer) == p)) - while (oldflayer->l_next) - oldflayer = oldflayer->l_next; - + oldflayer = NULL; + + flayer = l; + if (p) { + /* It's a window layer. Kill the overlays on it in all displays. */ for (d = displays; d; d = d->d_next) for (cv = d->d_cvlist; cv; cv = cv->c_next) { if (p == Layer2Window(cv->c_layer)) { - flayer = cv->c_layer; - if (flayer->l_next) - d->d_kaablamm = 1; - while (flayer->l_next) - ExitOverlayPage(); + /* Canvas 'cv' on display 'd' shows this window. Remove any non-resizable + * layers over it. */ + RESIZE_OR_KILL_LAYERS(cv->c_layer, wi, he); } } - l = p->w_savelayer; - } - flayer = l; - if (p == 0 && flayer->l_next && flayer->l_next->l_next == 0 && LayResize(wi, he) == 0) - { - flayer = flayer->l_next; - LayResize(wi, he); - flayer = l; } else { - if (flayer->l_next) - for (cv = flayer->l_cvlist; cv; cv = cv->c_lnext) - cv->c_display->d_kaablamm = 1; - while (flayer->l_next) - ExitOverlayPage(); + /* It's a Blank layer. Just kill the non-resizable overlays over it. */ + RESIZE_OR_KILL_LAYERS(flayer, wi, he); } - if (p) - flayer = &p->w_layer; - LayResize(wi, he); - /* now everybody is on flayer, redisplay */ - l = flayer; + for (display = displays; display; display = display->d_next) { if (display == norefdisp) continue; for (cv = D_cvlist; cv; cv = cv->c_next) - if (cv->c_layer == l) + if (Layer2Window(cv->c_layer) == p) { CV_CALL(cv, LayRedisplayLine(-1, -1, -1, 0)); RefreshArea(cv->c_xs, cv->c_ys, cv->c_xe, cv->c_ye, 0); @@ -427,11 +409,14 @@ struct display *norefdisp; D_kaablamm = 0; } } - flayer = oldflayer; + + /* If we started resizing a non-flayer layer, then restore the flayer. + * Otherwise, flayer should already be updated to the topmost foreground layer. */ + if (oldflayer) + flayer = oldflayer; display = olddisplay; } - static void FreeMline(ml) struct mline *ml; @@ -487,18 +472,16 @@ int xf, xt, l, w; bcopy((char *)mlf->image + xf, (char *)mlt->image + xt, l); if (mlf->attr != null && mlt->attr == null) { - if ((mlt->attr = (unsigned char *)malloc(w)) == 0) + if ((mlt->attr = (unsigned char *)calloc(w, 1)) == 0) mlt->attr = null, r = -1; - bzero((char *)mlt->attr, w); } if (mlt->attr != null) bcopy((char *)mlf->attr + xf, (char *)mlt->attr + xt, l); #ifdef FONT if (mlf->font != null && mlt->font == null) { - if ((mlt->font = (unsigned char *)malloc(w)) == 0) + if ((mlt->font = (unsigned char *)calloc(w, 1)) == 0) mlt->font = null, r = -1; - bzero((char *)mlt->font, w); } if (mlt->font != null) bcopy((char *)mlf->font + xf, (char *)mlt->font + xt, l); @@ -506,18 +489,16 @@ int xf, xt, l, w; #ifdef COLOR if (mlf->color != null && mlt->color == null) { - if ((mlt->color = (unsigned char *)malloc(w)) == 0) + if ((mlt->color = (unsigned char *)calloc(w, 1)) == 0) mlt->color = null, r = -1; - bzero((char *)mlt->color, w); } if (mlt->color != null) bcopy((char *)mlf->color + xf, (char *)mlt->color + xt, l); # ifdef COLORS256 if (mlf->colorx != null && mlt->colorx == null) { - if ((mlt->colorx = (unsigned char *)malloc(w)) == 0) + if ((mlt->colorx = (unsigned char *)calloc(w, 1)) == 0) mlt->colorx = null, r = -1; - bzero((char *)mlt->colorx, w); } if (mlt->colorx != null) bcopy((char *)mlf->colorx + xf, (char *)mlt->colorx + xt, l); @@ -534,6 +515,7 @@ CheckMaxSize(wi) int wi; { unsigned char *oldnull = null; + unsigned char *oldblank = blank; struct win *p; int i; struct mline *ml; @@ -553,11 +535,11 @@ int wi; #ifdef COLOR mline_old.color = (unsigned char *)xrealloc((char *)mline_old.color, maxwidth); # ifdef COLORS256 - mline_old.colorx = (unsigned char *)xrealloc((char *)mline_old.color, maxwidth); + mline_old.colorx = (unsigned char *)xrealloc((char *)mline_old.colorx, maxwidth); # endif #endif if (!(blank && null && mline_old.image && mline_old.attr IFFONT(&& mline_old.font) IFCOLOR(&& mline_old.color) IFCOLORX(&& mline_old.colorx))) - Panic(0, strnomem); + Panic(0, "%s", strnomem); MakeBlankLine(blank, maxwidth); bzero((char *)null, maxwidth); @@ -579,49 +561,34 @@ int wi; # endif #endif +#define RESET_AFC(x, bl) do { if (x == old##bl) x = bl; } while (0) + +#define RESET_LINES(lines, count) \ + do { \ + ml = lines; \ + for (i = 0; i < count; i++, ml++) \ + { \ + RESET_AFC(ml->image, blank); \ + RESET_AFC(ml->attr, null); \ + IFFONT(RESET_AFC(ml->font, null)); \ + IFCOLOR(RESET_AFC(ml->color, null)); \ + IFCOLORX(RESET_AFC(ml->colorx, null)); \ + } \ + } while (0) + /* We have to run through all windows to substitute - * the null references. + * the null and blank references. */ for (p = windows; p; p = p->w_next) { - ml = p->w_mlines; - for (i = 0; i < p->w_height; i++, ml++) - { - if (ml->attr == oldnull) - ml->attr = null; -#ifdef FONT - if (ml->font == oldnull) - ml->font = null; -#endif -#ifdef COLOR - if (ml->color == oldnull) - ml->color= null; -#ifdef COLORS256 - if (ml->colorx == oldnull) - ml->colorx = null; -#endif -#endif - } + RESET_LINES(p->w_mlines, p->w_height); + #ifdef COPY_PASTE - ml = p->w_hlines; - for (i = 0; i < p->w_histheight; i++, ml++) - { - if (ml->attr == oldnull) - ml->attr = null; -# ifdef FONT - if (ml->font == oldnull) - ml->font = null; -# endif -# ifdef COLOR - if (ml->color == oldnull) - ml->color= null; -# ifdef COLORS256 - if (ml->colorx == oldnull) - ml->colorx = null; -# endif -# endif - } + RESET_LINES(p->w_hlines, p->w_histheight); + RESET_LINES(p->w_alt.hlines, p->w_alt.histheight); #endif + + RESET_LINES(p->w_alt.mlines, p->w_alt.height); } } @@ -679,8 +646,23 @@ int wi, he, hi; int ncx, ncy, naka, t; int y, shift; - if (wi == 0) - he = hi = 0; + if (wi <= 0 || he <= 0) + wi = he = hi = 0; + + if (p->w_type == W_TYPE_GROUP) + return 0; + + if (wi > 1000) + { + Msg(0, "Window width too large. Truncated to 1000."); + wi = 1000; + } + + if (he > 1000) + { + Msg(0, "Window height too large. Truncated to 1000."); + he = 1000; + } if (p->w_width == wi && p->w_height == he && p->w_histheight == hi) { @@ -719,7 +701,7 @@ int wi, he, hi; if ((nmlines = (struct mline *)calloc(he, sizeof(struct mline))) == 0) { KillWindow(p); - Msg(0, strnomem); + Msg(0, "%s", strnomem); return -1; } } @@ -952,7 +934,7 @@ int wi, he, hi; #endif } KillWindow(p); - Msg(0, strnomem); + Msg(0, "%s", strnomem); return -1; } for (; t < wi; t++) @@ -967,8 +949,8 @@ int wi, he, hi; } } - /* Change w_Saved_y - this is only an estimate... */ - p->w_Saved_y += ncy - p->w_y; + /* Change w_saved.y - this is only an estimate... */ + p->w_saved.y += ncy - p->w_y; p->w_x = ncx; p->w_y = ncy; @@ -980,12 +962,16 @@ int wi, he, hi; p->w_x = wi; if (p->w_y >= he) p->w_y = he - 1; - if (p->w_Saved_x > wi) - p->w_Saved_x = wi; - if (p->w_Saved_y < 0) - p->w_Saved_y = 0; - if (p->w_Saved_y >= he) - p->w_Saved_y = he - 1; + if (p->w_saved.x > wi) + p->w_saved.x = wi; + if (p->w_saved.y < 0) + p->w_saved.y = 0; + if (p->w_saved.y >= he) + p->w_saved.y = he - 1; + if (p->w_alt.cursor.x > wi) + p->w_alt.cursor.x = wi; + if (p->w_alt.cursor.y >= he) + p->w_alt.cursor.y = he - 1; /* reset scrolling region */ p->w_top = 0; @@ -993,7 +979,8 @@ int wi, he, hi; /* signal new size to window */ #ifdef TIOCSWINSZ - if (wi && (p->w_width != wi || p->w_height != he) && p->w_ptyfd >= 0 && p->w_pid) + if (wi && (p->w_width != wi || p->w_height != he) + && p->w_width != 0 && p->w_height != 0 && p->w_ptyfd >= 0 && p->w_pid) { glwz.ws_col = wi; glwz.ws_row = he; @@ -1043,22 +1030,26 @@ struct win *p; { int i; - if (p->w_alt_mlines) - for (i = 0; i < p->w_alt_height; i++) - FreeMline(p->w_alt_mlines + i); - p->w_alt_mlines = 0; - p->w_alt_width = 0; - p->w_alt_height = 0; - p->w_alt_x = 0; - p->w_alt_y = 0; + if (p->w_alt.mlines) + { + for (i = 0; i < p->w_alt.height; i++) + FreeMline(p->w_alt.mlines + i); + free(p->w_alt.mlines); + } + p->w_alt.mlines = 0; + p->w_alt.width = 0; + p->w_alt.height = 0; #ifdef COPY_PASTE - if (p->w_alt_hlines) - for (i = 0; i < p->w_alt_histheight; i++) - FreeMline(p->w_alt_hlines + i); - p->w_alt_hlines = 0; - p->w_alt_histidx = 0; + if (p->w_alt.hlines) + { + for (i = 0; i < p->w_alt.histheight; i++) + FreeMline(p->w_alt.hlines + i); + free(p->w_alt.hlines); + } + p->w_alt.hlines = 0; + p->w_alt.histidx = 0; + p->w_alt.histheight = 0; #endif - p->w_alt_histheight = 0; } static void @@ -1068,37 +1059,50 @@ struct win *p; struct mline *ml; int t; - ml = p->w_alt_mlines; p->w_alt_mlines = p->w_mlines; p->w_mlines = ml; - t = p->w_alt_width; p->w_alt_width = p->w_width; p->w_width = t; - t = p->w_alt_height; p->w_alt_height = p->w_height; p->w_height = t; - t = p->w_alt_histheight; p->w_alt_histheight = p->w_histheight; p->w_histheight = t; - t = p->w_alt_x; p->w_alt_x = p->w_x; p->w_x = t; - t = p->w_alt_y; p->w_alt_y = p->w_y; p->w_y = t; +#define SWAP(item, t) do { (t) = p->w_alt. item; p->w_alt. item = p->w_##item; p->w_##item = (t); } while (0) + + SWAP(mlines, ml); + SWAP(width, t); + SWAP(height, t); + #ifdef COPY_PASTE - ml = p->w_alt_hlines; p->w_alt_hlines = p->w_hlines; p->w_hlines = ml; - t = p->w_alt_histidx; p->w_alt_histidx = p->w_histidx; p->w_histidx = t; + SWAP(histheight, t); + SWAP(hlines, ml); + SWAP(histidx, t); #endif +#undef SWAP } void EnterAltScreen(p) struct win *p; { - int ox = p->w_x, oy = p->w_y; - FreeAltScreen(p); - SwapAltScreen(p); - ChangeWindowSize(p, p->w_alt_width, p->w_alt_height, p->w_alt_histheight); - p->w_x = ox; - p->w_y = oy; + if (!p->w_alt.on) + { + /* If not already using the alternate screen buffer, then create + a new one and swap it with the 'real' screen buffer. */ + FreeAltScreen(p); + SwapAltScreen(p); + } + else + { + /* Already using the alternate buffer. Just clear the screen. To do so, it + is only necessary to reset the height(s) without resetting the width. */ + p->w_height = 0; + p->w_histheight = 0; + } + ChangeWindowSize(p, p->w_alt.width, p->w_alt.height, p->w_alt.histheight); + p->w_alt.on = 1; } void LeaveAltScreen(p) struct win *p; { - if (!p->w_alt_mlines) + if (!p->w_alt.on) return; SwapAltScreen(p); - ChangeWindowSize(p, p->w_alt_width, p->w_alt_height, p->w_alt_histheight); + ChangeWindowSize(p, p->w_alt.width, p->w_alt.height, p->w_alt.histheight); FreeAltScreen(p); + p->w_alt.on = 0; } @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,9 +19,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,12 +19,12 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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: sched.h,v 1.1.1.1 1993/06/16 23:51:13 jnweiger Exp $ FAU + * $Id$ GNU */ struct event @@ -1,4 +1,12 @@ -/* Copyright (c) 1993-2002 +/* 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 @@ -14,7 +22,7 @@ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) + * 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, @@ -23,9 +31,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -50,7 +58,7 @@ #include "config.h" -#ifdef SVR4 +#ifdef HAVE_STROPTS_H # include <sys/stropts.h> #endif @@ -113,6 +121,8 @@ int VBellWait, MsgWait, MsgMinWait, SilenceWait; extern struct acluser *users; extern struct display *displays, *display; +extern struct LayFuncs MarkLf; + extern int visual_bell; #ifdef COPY_PASTE @@ -124,6 +134,7 @@ extern char DefaultShell[]; extern char *zmodem_sendcmd; extern char *zmodem_recvcmd; #endif +extern struct layout *layout_last; char *ShellProg; @@ -158,6 +169,7 @@ int nversion; /* numerical version, used for secondary DA */ /* the attacher */ struct passwd *ppp; char *attach_tty; +int attach_fd = -1; char *attach_term; char *LoginName; struct mode attach_Mode; @@ -198,6 +210,7 @@ char *wlisttit; int auto_detach = 1; int iflag, rflag, dflag, lsflag, quietflag, wipeflag, xflag; int cmdflag; +int queryflag = -1; int adaptflag; #ifdef MULTIUSER @@ -211,20 +224,24 @@ int tty_oldmode = -1; #endif char HostName[MAXSTR]; -int MasterPid; +int MasterPid, PanicPid; int real_uid, real_gid, eff_uid, eff_gid; int default_startup; -int ZombieKey_destroy, ZombieKey_resurrect; +int ZombieKey_destroy, ZombieKey_resurrect, ZombieKey_onerror; char *preselect = NULL; /* only used in Attach() */ #ifdef UTF8 char *screenencodings; #endif +#ifdef DW_CHARS +int cjkwidth; +#endif + #ifdef NETHACK int nethackflag = 0; #endif -int maxwin = MAXWIN; +int maxwin; struct layer *flayer; @@ -329,6 +346,21 @@ pw_try_again: return ppp; } +static char * +locale_name(void) +{ + static char *s; + + if (!s) + { + s = getenv("LC_ALL"); + if (s == NULL) + s = getenv("LC_CTYPE"); + if (s == NULL) + s = getenv("LANG"); + } + return s; +} int main(ac, av) @@ -356,6 +388,7 @@ char **av; #ifdef MULTIUSER char *sockp; #endif + char *sty = 0; #if (defined(AUX) || defined(_AUX_SOURCE)) && defined(POSIX) setcompat(COMPAT_POSIX|COMPAT_BSDPROT); /* turn on seteuid support */ @@ -377,8 +410,8 @@ char **av; #ifdef DEBUG opendebug(1, 0); #endif - sprintf(version, "%d.%.2d.%.2d%s (%s) %s", REV, VERS, - PATCHLEVEL, STATE, ORIGIN, DATE); + snprintf(version, 59, "%d.%.2d.%.2d%s (%s%s) %s", REV, VERS, + PATCHLEVEL, STATE, ORIGIN, GIT_REV, DATE); nversion = REV * 10000 + VERS * 100 + PATCHLEVEL; debug2("-- screen debug started %s (%s)\n", *av, version); #ifdef POSIX @@ -436,10 +469,10 @@ char **av; screenlogfile = SaveStr("screenlog.%n"); logtstamp_string = SaveStr("-- %n:%t -- time-stamp -- %M/%d/%y %c:%s --\n"); hstatusstring = SaveStr("%h"); - captionstring = SaveStr("%3n %t"); + captionstring = SaveStr("%4n %t"); timestring = SaveStr("%c:%s %M %d %H%? %l%?"); - wlisttit = SaveStr("Num Name%=Flags"); - wliststr = SaveStr("%3n %t%=%f"); + wlisttit = SaveStr(" Num Name%=Flags"); + wliststr = SaveStr("%4n %t%=%f"); #ifdef COPY_PASTE BufferFile = SaveStr(DEFAULT_BUFFERFILE); #endif @@ -468,6 +501,9 @@ char **av; InitBuiltinTabs(); screenencodings = SaveStr(SCREENENCODINGS); #endif +#ifdef DW_CHARS + cjkwidth = 0; +#endif nwin = nwin_undef; nwin_options = nwin_undef; strcpy(screenterm, "screen"); @@ -648,6 +684,10 @@ char **av; case 'q': quietflag = 1; break; + case 'Q': + queryflag = 1; + cmdflag = 1; + break; case 'r': case 'R': #ifdef MULTI @@ -727,17 +767,12 @@ char **av; real_gid = getgid(); eff_uid = geteuid(); eff_gid = getegid(); - if (eff_uid != real_uid) - { - /* if running with s-bit, we must install a special signal - * handler routine that resets the s-bit, so that we get a - * core file anyway. - */ + #ifdef SIGBUS /* OOPS, linux has no bus errors! */ - signal(SIGBUS, CoreDump); + signal(SIGBUS, CoreDump); #endif /* SIGBUS */ - signal(SIGSEGV, CoreDump); - } + signal(SIGSEGV, CoreDump); + #ifdef USE_LOCALE setlocale(LC_ALL, ""); @@ -755,14 +790,50 @@ char **av; # else # ifdef UTF8 char *s; - if (((s = getenv("LC_ALL")) || (s = getenv("LC_CTYPE")) || - (s = getenv("LANG"))) && InStr(s, "UTF-8")) + if ((s = locale_name()) && InStr(s, "UTF-8")) nwin_options.encoding = UTF8; # endif debug1("environment says encoding=%d\n", nwin_options.encoding); #endif } +# ifdef DW_CHARS + { + char *s; + if ((s = locale_name())) + { + if(!strncmp(s, "zh_", 3) || !strncmp(s, "ja_", 3) || !strncmp(s, "ko_", 3)) + { + cjkwidth = 1; + } + } + } +#endif +#endif + if (nwin_options.aka) + { +#ifdef ENCODINGS + if (nwin_options.encoding > 0) + { + size_t len = strlen(nwin_options.aka); + size_t newsz; + char *newbuf = malloc(3 * len); + if (!newbuf) + Panic(0, "%s", strnomem); + newsz = RecodeBuf(nwin_options.aka, len, + nwin_options.encoding, 0, newbuf); + newbuf[newsz] = '\0'; + nwin_options.aka = newbuf; + } + else #endif + { + /* If we just use the original value from av, + subsequent shelltitle invocations will attempt to free + space we don't own... */ + nwin_options.aka = SaveStr(nwin_options.aka); + } + } + if (SockMatch && strlen(SockMatch) >= MAXSTR) Panic(0, "Ridiculously long socketname - try again."); if (cmdflag && !rflag && !dflag && !xflag) @@ -803,6 +874,12 @@ char **av; } ShellArgs[0] = ShellProg; home = getenv("HOME"); + if (!mflag && !SockMatch) + { + sty = getenv("STY"); + if (sty && *sty == 0) + sty = 0; + } #ifdef NETHACK if (!(nethackflag = (getenv("NETHACKOPTIONS") != NULL))) @@ -821,8 +898,6 @@ char **av; own_uid = multi_uid = real_uid; if (SockMatch && (sockp = index(SockMatch, '/'))) { - if (eff_uid) - Panic(0, "Must run suid root for multiuser support."); *sockp = 0; multi = SockMatch; SockMatch = sockp + 1; @@ -843,6 +918,9 @@ char **av; detached = 0; multiattach = 1; } + /* Special case: effective user is multiuser. */ + if (eff_uid && (multi_uid != eff_uid)) + Panic(0, "Must run suid root for multiuser support."); } if (SockMatch && *SockMatch == 0) SockMatch = 0; @@ -875,6 +953,29 @@ char **av; } #endif +#define SET_GUID() do \ + { \ + setgid(real_gid); \ + setuid(real_uid); \ + eff_uid = real_uid; \ + eff_gid = real_gid; \ + } while (0) + +#define SET_TTYNAME(fatal) do \ + { \ + if (!(attach_tty = ttyname(0))) \ + { \ + if (fatal) \ + Panic(0, "Must be connected to a terminal."); \ + else \ + attach_tty = ""; \ + } \ + else if (stat(attach_tty, &st)) \ + Panic(errno, "Cannot access '%s'", attach_tty); \ + if (strlen(attach_tty) >= MAXPATHLEN) \ + Panic(0, "TtyName too long - sorry."); \ + } while (0) + if (home == 0 || *home == '\0') home = ppp->pw_dir; if (strlen(LoginName) > 20) @@ -887,22 +988,31 @@ char **av; Panic(0, "$HOME too long - sorry."); attach_tty = ""; - if (!detached && !lsflag && !cmdflag && !(dflag && !mflag && !rflag && !xflag)) + if (!detached && !lsflag && !cmdflag && !(dflag && !mflag && !rflag && !xflag) && !(!mflag && !SockMatch && sty && !xflag)) { +#ifndef NAMEDPIPE + int fl; +#endif + /* ttyname implies isatty */ - if (!(attach_tty = ttyname(0))) - Panic(0, "Must be connected to a terminal."); - if (strlen(attach_tty) >= MAXPATHLEN) - Panic(0, "TtyName too long - sorry."); - if (stat(attach_tty, &st)) - Panic(errno, "Cannot access '%s'", attach_tty); + SET_TTYNAME(1); #ifdef MULTIUSER tty_mode = (int)st.st_mode & 0777; #endif - if ((n = secopen(attach_tty, O_RDWR | O_NONBLOCK, 0)) < 0) - Panic(0, "Cannot open your terminal '%s' - please check.", attach_tty); - close(n); - debug1("attach_tty is %s\n", attach_tty); + +#ifndef NAMEDPIPE + fl = fcntl(0, F_GETFL, 0); + if (fl != -1 && (fl & (O_RDWR|O_RDONLY|O_WRONLY)) == O_RDWR) + attach_fd = 0; +#endif + if (attach_fd == -1) + { + if ((n = secopen(attach_tty, O_RDWR | O_NONBLOCK, 0)) < 0) + Panic(0, "Cannot open your terminal '%s' - please check.", attach_tty); + close(n); + } + debug2("attach_tty is %s, attach_fd is %d\n", attach_tty, attach_fd); + if ((attach_term = getenv("TERM")) == 0 || *attach_term == 0) Panic(0, "Please set a terminal type."); if (strlen(attach_term) > sizeof(D_termname) - 1) @@ -971,7 +1081,7 @@ char **av; else { SockDir = SOCKDIR; - if (lstat(SockDir, &st)) + if (stat(SockDir, &st)) { n = (eff_uid == 0 && (real_uid || eff_gid == real_gid)) ? 0755 : (eff_gid != real_gid) ? 0775 : @@ -1052,10 +1162,7 @@ char **av; if (multi) real_uid = multi_uid; #endif - setgid(real_gid); - setuid(real_uid); - eff_uid = real_uid; - eff_gid = real_gid; + SET_GUID(); i = FindSocket((int *)NULL, &fo, &oth, SockMatch); if (quietflag) exit(8 + (fo ? ((oth || i) ? 2 : 1) : 0) + i); @@ -1067,26 +1174,12 @@ char **av; signal(SIG_BYE, AttacherFinit); /* prevent races */ if (cmdflag) { - char *sty = 0; - /* attach_tty is not mandatory */ - if ((attach_tty = ttyname(0)) == 0) - attach_tty = ""; - if (strlen(attach_tty) >= MAXPATHLEN) - Panic(0, "TtyName too long - sorry."); + SET_TTYNAME(0); if (!*av) Panic(0, "Please specify a command."); - setgid(real_gid); - setuid(real_uid); - eff_uid = real_uid; - eff_gid = real_gid; - if (!mflag && !SockMatch) - { - sty = getenv("STY"); - if (sty && *sty == 0) - sty = 0; - } - SendCmdMessage(sty, SockMatch, av); + SET_GUID(); + SendCmdMessage(sty, SockMatch, av, queryflag >= 0); exit(0); } else if (rflag || xflag) @@ -1105,26 +1198,21 @@ char **av; } else if (dflag && !mflag) { - (void) Attach(MSG_DETACH); + SET_TTYNAME(0); + Attach(MSG_DETACH); Msg(0, "[%s %sdetached.]\n", SockName, (dflag > 1 ? "power " : "")); eexit(0); /* NOTREACHED */ } - if (!SockMatch && !mflag) + if (!SockMatch && !mflag && sty) { - register char *sty; - - if ((sty = getenv("STY")) != 0 && *sty != '\0') - { - setgid(real_gid); - setuid(real_uid); - eff_uid = real_uid; - eff_gid = real_gid; - nwin_options.args = av; - SendCreateMsg(sty, &nwin); - exit(0); - /* NOTREACHED */ - } + /* attach_tty is not mandatory */ + SET_TTYNAME(0); + SET_GUID(); + nwin_options.args = av; + SendCreateMsg(sty, &nwin); + exit(0); + /* NOTREACHED */ } nwin_compose(&nwin_default, &nwin_options, &nwin_default); @@ -1155,14 +1243,14 @@ char **av; socknamebuf[NAME_MAX] = 0; #endif sprintf(SockPath + strlen(SockPath), "/%s", socknamebuf); - setgid(real_gid); - setuid(real_uid); - eff_uid = real_uid; - eff_gid = real_gid; + SET_GUID(); Attacher(); /* NOTREACHED */ } + if (!detached) + PanicPid = getppid(); + if (DefaultEsc == -1) DefaultEsc = Ctrl('a'); if (DefaultMetaEsc == -1) @@ -1196,9 +1284,13 @@ char **av; #endif if (!detached) { - /* reopen tty. must do this, because fd 0 may be RDONLY */ - if ((n = secopen(attach_tty, O_RDWR, 0)) < 0) - Panic(0, "Cannot reopen '%s' - please check.", attach_tty); + if (attach_fd == -1) + { + if ((n = secopen(attach_tty, O_RDWR, 0)) < 0) + Panic(0, "Cannot reopen '%s' - please check.", attach_tty); + } + else + n = dup(attach_fd); } else n = -1; @@ -1222,6 +1314,7 @@ char **av; { if (MakeDisplay(LoginName, attach_tty, attach_term, n, getppid(), &attach_Mode) == 0) Panic(0, "Could not alloc display"); + PanicPid = 0; #ifdef ENCODINGS D_encoding = nwin_options.encoding > 0 ? nwin_options.encoding : 0; debug1("D_encoding = %d\n", D_encoding); @@ -1255,12 +1348,12 @@ char **av; #ifdef ETCSCREENRC # ifdef ALLOW_SYSSCREENRC if ((ap = getenv("SYSSCREENRC"))) - StartRc(ap); + (void)StartRc(ap, 0); else # endif - StartRc(ETCSCREENRC); + (void)StartRc(ETCSCREENRC, 0); #endif - StartRc(RcFileName); + (void)StartRc(RcFileName, 0); # ifdef UTMPOK # ifndef UTNOKEEP InitUtmp(); @@ -1326,12 +1419,21 @@ char **av; debug("We open one default window, as screenrc did not specify one.\n"); if (MakeWindow(&nwin) == -1) { - Msg(0, "Sorry, could not find a PTY."); - sleep(5); + fd_set rfd; + struct timeval tv = { MsgWait/1000, 1000*(MsgWait%1000) }; + FD_SET(0, &rfd); + + Msg(0, "Sorry, could not find a PTY or TTY."); + // allow user to exit early by pressing any key. + select(1, &rfd, NULL, NULL, &tv); Finit(0); /* NOTREACHED */ } } + else if (ac) /* Screen was invoked with a command */ + { + MakeWindow(&nwin); + } #ifdef HAVE_BRAILLE StartBraille(); @@ -1340,7 +1442,7 @@ char **av; if (display && default_startup) display_copyright(); signal(SIGINT, SigInt); - if (rflag && (rflag & 1) == 0) + if (rflag && (rflag & 1) == 0 && !quietflag) { Msg(0, "New screen..."); rflag = 0; @@ -1365,14 +1467,62 @@ char **av; } void -WindowDied(p) +WindowDied(p, wstat, wstat_valid) struct win *p; +#ifdef BSDWAIT + union wait wstat; +#else + int wstat; +#endif +int wstat_valid; { - if (ZombieKey_destroy) + int killit = 0; + + if (p->w_destroyev.data == (char *)p) + { + wstat = p->w_exitstatus; + wstat_valid = 1; + evdeq(&p->w_destroyev); + p->w_destroyev.data = 0; + } + +#if defined(BSDJOBS) && !defined(BSDWAIT) + if (!wstat_valid && p->w_pid > 0) { - char buf[100], *s; + /* EOF on file descriptor. The process is probably also dead. + * try a waitpid */ + if (waitpid(p->w_pid, &wstat, WNOHANG | WUNTRACED) == p->w_pid) + { + p->w_pid = 0; + wstat_valid = 1; + } + } +#endif + if (ZombieKey_destroy && ZombieKey_onerror && wstat_valid && + WIFEXITED(wstat) && WEXITSTATUS(wstat) == 0) + killit = 1; + + if (ZombieKey_destroy && !killit) + { + char buf[100], *s, reason[100]; time_t now; + if (wstat_valid) { + if (WIFEXITED(wstat)) + if (WEXITSTATUS(wstat)) + sprintf(reason, "terminated with exit status %d", WEXITSTATUS(wstat)); + else + sprintf(reason, "terminated normally"); + else if (WIFSIGNALED(wstat)) + sprintf(reason, "terminated with signal %d%s", WTERMSIG(wstat), +#ifdef WCOREDUMP + WCOREDUMP(wstat) ? " (core file generated)" : ""); +#else + ""); +#endif + } else + sprintf(reason, "detached from window"); + (void) time(&now); s = ctime(&now); if (s && *s) @@ -1388,11 +1538,12 @@ struct win *p; #endif CloseDevice(p); + p->w_deadpid = p->w_pid; p->w_pid = 0; ResetWindow(p); /* p->w_y = p->w_bot; */ p->w_y = MFindUsedLine(p, p->w_bot, 1); - sprintf(buf, "\n\r=== Window terminated (%s) ===", s ? s : "?"); + sprintf(buf, "\n\r=== Command %s (%s) ===", reason, s ? s : "?"); WriteString(p, buf, strlen(buf)); WindowChanged(p, 'f'); } @@ -1483,39 +1634,55 @@ SigInt SIGDEFARG static sigret_t CoreDump SIGDEFARG { + /* if running with s-bit, we must reset the s-bit, so that we get a + * core file anyway. + */ + struct display *disp; char buf[80]; + char *dump_msg = " (core dumped)"; + + int running_w_s_bit = getuid() != geteuid(); +#if defined(SHADOWPW) && !defined(DEBUG) && !defined(DUMPSHADOW) + if (running_w_s_bit) + dump_msg = ""; +#endif + #if defined(SYSVSIGS) && defined(SIGHASARG) signal(sigsig, SIG_IGN); #endif setgid(getgid()); setuid(getuid()); unlink("core"); + #ifdef SIGHASARG - sprintf(buf, "\r\n[screen caught signal %d.%s]\r\n", sigsig, + sprintf(buf, "\r\n[screen caught signal %d.%s]\r\n", sigsig, dump_msg); #else - sprintf(buf, "\r\n[screen caught a fatal signal.%s]\r\n", + sprintf(buf, "\r\n[screen caught a fatal signal.%s]\r\n", dump_msg); #endif -#if defined(SHADOWPW) && !defined(DEBUG) && !defined(DUMPSHADOW) - "" -#else /* SHADOWPW && !DEBUG */ - " (core dumped)" -#endif /* SHADOWPW && !DEBUG */ - ); + for (disp = displays; disp; disp = disp->d_next) { + if (disp->d_nonblock < -1 || disp->d_nonblock > 1000000) + continue; fcntl(disp->d_userfd, F_SETFL, 0); SetTTY(disp->d_userfd, &D_OldMode); write(disp->d_userfd, buf, strlen(buf)); Kill(disp->d_userpid, SIG_BYE); } + + if (running_w_s_bit) + { #if defined(SHADOWPW) && !defined(DEBUG) && !defined(DUMPSHADOW) - Kill(getpid(), SIGKILL); - eexit(11); + Kill(getpid(), SIGKILL); + eexit(11); #else /* SHADOWPW && !DEBUG */ - abort(); + abort(); #endif /* SHADOWPW && !DEBUG */ + } + else + abort(); SIGRETURN; } @@ -1555,12 +1722,16 @@ DoWait() for (p = windows; p; p = next) { next = p->w_next; - if (pid == p->w_pid) + if ( (p->w_pid && pid == p->w_pid) || + (p->w_deadpid && pid == p->w_deadpid) ) { + /* child has ceased to exist */ + p->w_pid = 0; + #ifdef BSDJOBS if (WIFSTOPPED(wstat)) { - debug3("Window %d pid %d: WIFSTOPPED (sig %d)\n", p->w_number, p->w_pid, WSTOPSIG(wstat)); + debug3("Window %d pid %d: WIFSTOPPED (sig %d)\n", p->w_number, pid, WSTOPSIG(wstat)); #ifdef SIGTTIN if (WSTOPSIG(wstat) == SIGTTIN) { @@ -1577,13 +1748,22 @@ DoWait() #endif /* Try to restart process */ Msg(0, "Child has been stopped, restarting."); - if (killpg(p->w_pid, SIGCONT)) - kill(p->w_pid, SIGCONT); + if (killpg(pid, SIGCONT)) + kill(pid, SIGCONT); } else #endif { - WindowDied(p); + /* Screen will detect the window has died when the window's + * file descriptor signals EOF (which it will do when the process in + * the window terminates). So do this in a timeout of 10 seconds. + * (not doing this at all might also work) + * See #27061 for more details. + */ + p->w_destroyev.data = (char *)p; + p->w_exitstatus = wstat; + SetTimeout(&p->w_destroyev, 10 * 1000); + evenq(&p->w_destroyev); } break; } @@ -1620,14 +1800,13 @@ void Finit(i) int i; { - struct win *p, *next; - signal(SIGCHLD, SIG_DFL); signal(SIGHUP, SIG_IGN); debug1("Finit(%d);\n", i); - for (p = windows; p; p = next) + while (windows) { - next = p->w_next; + struct win *p = windows; + windows = windows->w_next; FreeWindow(p); } if (ServerSocket != -1) @@ -1652,7 +1831,7 @@ int i; RestoreLoginSlot(); #endif AddStr("[screen is terminating]\r\n"); - Flush(); + Flush(3); SetTTY(D_userfd, &D_OldMode); fcntl(D_userfd, F_SETFL, 0); freetty(); @@ -1721,6 +1900,17 @@ int mode; if (display == 0) return; +#define AddStrSock(msg) do { \ + if (SockName) \ + { \ + AddStr("[" msg " from "); \ + AddStr(SockName); \ + AddStr("]\r\n"); \ + } \ + else \ + AddStr("[" msg "]\r\n"); \ + } while (0) + signal(SIGHUP, SIG_IGN); debug1("Detach(%d)\n", mode); if (D_status) @@ -1734,7 +1924,7 @@ int mode; sign = SIG_BYE; break; case D_DETACH: - AddStr("[detached]\r\n"); + AddStrSock("detached"); sign = SIG_BYE; break; #ifdef BSDJOBS @@ -1744,14 +1934,14 @@ int mode; #endif #ifdef REMOTE_DETACH case D_REMOTE: - AddStr("[remote detached]\r\n"); + AddStrSock("remote detached"); sign = SIG_BYE; break; #endif #ifdef POW_DETACH case D_POWER: - AddStr("[power detached]\r\n"); - if (PowDetachString) + AddStrSock("power detached"); + if (PowDetachString) { AddStr(PowDetachString); AddStr("\r\n"); @@ -1760,8 +1950,8 @@ int mode; break; #ifdef REMOTE_DETACH case D_REMOTE_POWER: - AddStr("[remote power detached]\r\n"); - if (PowDetachString) + AddStrSock("remote power detached"); + if (PowDetachString) { AddStr(PowDetachString); AddStr("\r\n"); @@ -1812,6 +2002,8 @@ int mode; D_user->u_detachwin = D_fore->w_number; D_user->u_detachotherwin = D_other ? D_other->w_number : -1; } + AutosaveLayout(D_layout); + layout_last = D_layout; for (cv = D_cvlist; cv; cv = cv->c_next) { p = Layer2Window(cv->c_layer); @@ -1835,6 +2027,7 @@ int mode; debug2("Detach: Signal %d to Attacher(%d)!\n", sign, pid); debug("Detach returns, we are successfully detached.\n"); signal(SIGHUP, SigHup); +#undef AddStrSock } static int @@ -1859,7 +2052,7 @@ MakeNewEnv() free((char *)NewEnv); NewEnv = np = (char **) malloc((unsigned) (op - environ + 7 + 1) * sizeof(char **)); if (!NewEnv) - Panic(0, strnomem); + Panic(0, "%s", strnomem); sprintf(stybuf, "STY=%s", strlen(SockName) <= MAXSTR - 5 ? SockName : "?"); *np++ = stybuf; /* NewEnv[0] */ *np++ = Term; /* NewEnv[1] */ @@ -1882,33 +2075,37 @@ MakeNewEnv() *np = 0; } -void -/*VARARGS2*/ #if defined(USEVARARGS) && defined(__STDC__) -Msg(int err, char *fmt, VA_DOTS) + #define DEFINE_VARARGS_FN(fnname) void fnname (int err, const char *fmt, VA_DOTS) #else -Msg(err, fmt, VA_DOTS) -int err; -char *fmt; -VA_DECL -#endif + #define DEFINE_VARARGS_FN(fnname) void fnname(err, fmt, VA_DOTS) \ + int err; \ + const char *fmt; \ + VA_DECL +#endif + +#define PROCESS_MESSAGE(B) do { \ + char *p = B; \ + VA_LIST(ap) \ + VA_START(ap, fmt); \ + fmt = DoNLS(fmt); \ + (void)vsnprintf(p, sizeof(B) - 100, fmt, VA_ARGS(ap)); \ + VA_END(ap); \ + if (err) \ + { \ + p += strlen(p); \ + *p++ = ':'; \ + *p++ = ' '; \ + strncpy(p, strerror(err), B + sizeof(B) - p - 1); \ + B[sizeof(B) - 1] = 0; \ + } \ + } while (0) + +DEFINE_VARARGS_FN(Msg) { - VA_LIST(ap) char buf[MAXPATHLEN*2]; - char *p = buf; + PROCESS_MESSAGE(buf); - VA_START(ap, fmt); - fmt = DoNLS(fmt); - (void)vsnprintf(p, sizeof(buf) - 100, fmt, VA_ARGS(ap)); - VA_END(ap); - if (err) - { - p += strlen(p); - *p++ = ':'; - *p++ = ' '; - strncpy(p, strerror(err), buf + sizeof(buf) - p - 1); - buf[sizeof(buf) - 1] = 0; - } debug2("Msg('%s') (%#x);\n", buf, (unsigned int)display); if (display && displays) @@ -1931,41 +2128,26 @@ VA_DECL } else printf("%s\r\n", buf); + + if (queryflag >= 0) + write(queryflag, buf, strlen(buf)); } /* * Call FinitTerm for all displays, write a message to each and call eexit(); */ -void -/*VARARGS2*/ -#if defined(USEVARARGS) && defined(__STDC__) -Panic(int err, char *fmt, VA_DOTS) -#else -Panic(err, fmt, VA_DOTS) -int err; -char *fmt; -VA_DECL -#endif +DEFINE_VARARGS_FN(Panic) { - VA_LIST(ap) char buf[MAXPATHLEN*2]; - char *p = buf; + PROCESS_MESSAGE(buf); - VA_START(ap, fmt); - fmt = DoNLS(fmt); - (void)vsnprintf(p, sizeof(buf) - 100, fmt, VA_ARGS(ap)); - VA_END(ap); - if (err) - { - p += strlen(p); - *p++ = ':'; - *p++ = ' '; - strncpy(p, strerror(err), buf + sizeof(buf) - p - 1); - buf[sizeof(buf) - 1] = 0; - } debug3("Panic('%s'); display=%x displays=%x\n", buf, display, displays); if (displays == 0 && display == 0) - printf("%s\r\n", buf); + { + printf("%s\r\n", buf); + if (PanicPid) + Kill(PanicPid, SIG_BYE); + } else if (displays == 0) { /* no displays but a display - must have forked. @@ -1983,7 +2165,7 @@ VA_DECL if (D_status) RemoveStatus(); FinitTerm(); - Flush(); + Flush(3); #ifdef UTMPOK RestoreLoginSlot(); #endif @@ -2011,6 +2193,22 @@ VA_DECL eexit(1); } +DEFINE_VARARGS_FN(QueryMsg) +{ + char buf[MAXPATHLEN*2]; + + if (queryflag < 0) + return; + + PROCESS_MESSAGE(buf); + write(queryflag, buf, strlen(buf)); +} + +DEFINE_VARARGS_FN(Dummy) +{} + +#undef PROCESS_MESSAGE +#undef DEFINE_VARARGS_FN /* * '^' is allowed as an escape mechanism for control characters. jw. @@ -2026,7 +2224,7 @@ static const char months[] = "JanFebMarAprMayJunJulAugSepOctNovDec"; #endif static char winmsg_buf[MAXSTR]; -#define MAX_WINMSG_REND 16 /* rendition changes */ +#define MAX_WINMSG_REND 256 /* rendition changes */ static int winmsg_rend[MAX_WINMSG_REND]; static int winmsg_rendpos[MAX_WINMSG_REND]; static int winmsg_numrend; @@ -2048,7 +2246,7 @@ int padlen; r = winmsg_numrend; while (p >= buf) { - if (r && p - buf == winmsg_rendpos[r - 1]) + if (r && *p != 127 && p - buf == winmsg_rendpos[r - 1]) { winmsg_rendpos[--r] = pn - buf; continue; @@ -2062,6 +2260,8 @@ int padlen; while (i-- > 0) *pn-- = ' '; numpad--; + if (r && p - buf == winmsg_rendpos[r - 1]) + winmsg_rendpos[--r] = pn - buf; } } return pn2; @@ -2187,7 +2387,7 @@ char **cmdv; bt = (struct backtick *)malloc(sizeof *bt); if (!bt) { - Msg(0, strnomem); + Msg(0, "%s", strnomem); return; } bzero(bt, sizeof(*bt)); @@ -2209,7 +2409,7 @@ char **cmdv; bt->buf = (char *)malloc(MAXSTR); if (bt->buf == 0) { - Msg(0, strnomem); + Msg(0, "%s", strnomem); setbacktick(num, 0, 0, (char **)0); return; } @@ -2273,6 +2473,22 @@ time_t now; return bt->result; } +int +AddWinMsgRend(str, r) +const char *str; +int r; +{ + if (winmsg_numrend >= MAX_WINMSG_REND || str < winmsg_buf || + str >= winmsg_buf + MAXSTR) + return -1; + + winmsg_rend[winmsg_numrend] = r; + winmsg_rendpos[winmsg_numrend] = str - winmsg_buf; + winmsg_numrend++; + + return 0; +} + char * MakeWinMsgEv(str, win, esc, padlen, ev, rec) char *str; @@ -2528,9 +2744,7 @@ int rec; oldfore = D_fore; D_fore = win; } - ss = AddWindows(p, l - 1, (*s == 'w' ? 0 : 1) | (longflg ? 0 : 2) | (plusflg ? 4 : 0), win ? win->w_number : -1); - if (minusflg) - *ss = 0; + ss = AddWindows(p, l - 1, (*s == 'w' ? 0 : 1) | (longflg ? 0 : 2) | (plusflg ? 4 : 0) | (minusflg ? 8 : 0), win ? win->w_number : -1); if (display) D_fore = oldfore; } @@ -2601,12 +2815,46 @@ int rec; } p += strlen(p) - 1; break; + case 'S': + { + char *session_name; + *p = 0; + session_name = strchr(SockName, '.') + 1; + if ((int)strlen(session_name) < l) + { + strcpy(p, session_name); + if (*p) + qmflag = 1; + } + p += strlen(p) - 1; + } + break; + case 'p': + { + sprintf(p, "%d", (plusflg && display) ? D_userpid : getpid()); + p += strlen(p) - 1; + } + break; case 'F': p--; /* small hack */ if (display && ((ev && ev == &D_forecv->c_captev) || (!ev && win && win == D_fore))) + minusflg = !minusflg; + if (minusflg) qmflag = 1; break; + case 'P': + p--; +#ifdef COPY_PASTE + if (display && ev && ev != &D_hstatusev) /* Hack */ + { + /* Is the layer in the current canvas in copy mode? */ + struct canvas *cv = (struct canvas *)ev->data; + if (ev == &cv->c_captev && cv->c_layer->l_layfn == &MarkLf) + qmflag = 1; + } +#endif + break; case '>': truncpos = p - winmsg_buf; truncper = num > 100 ? 100 : num; @@ -2785,7 +3033,7 @@ int esc; return MakeWinMsgEv(s, win, esc, 0, (struct event *)0, 0); } -int +void PutWinMsg(s, start, max) char *s; int start, max; @@ -2796,7 +3044,18 @@ int start, max; int rendstackn = 0; if (s != winmsg_buf) - return 0; + { + /* sorry, no fancy coloring available */ + debug1("PutWinMsg %s plain\n", s); + l = strlen(s); + if (l > max) + l = max; + l -= start; + s += start; + while (l-- > 0) + PUTCHARLP(*s++); + return; + } rend = D_rend; p = 0; l = strlen(s); @@ -2846,7 +3105,6 @@ int start, max; PUTCHARLP(*s++); } } - return 1; } @@ -2959,7 +3217,7 @@ char *data; /* don't annoy the user with two messages */ if (p->w_monitor == MON_FOUND) p->w_monitor = MON_DONE; - WindowChanged(p, 'f'); + WindowChanged(p, 'f'); } if (p->w_monitor == MON_FOUND) { @@ -2979,7 +3237,16 @@ char *data; Msg(0, "%s", MakeWinMsg(ActivityString, p, '%')); p->w_monitor = MON_DONE; } - WindowChanged(p, 'f'); + WindowChanged(p, 'f'); + } + if (p->w_silence == SILENCE_FOUND) + { + /* Unset the flag if the user switched to this window. */ + if (p->w_layer.l_cvlist) + { + p->w_silence = SILENCE_ON; + WindowChanged(p, 'f'); + } } } @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,12 +19,12 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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: screen.h,v 1.12 1994/05/31 12:32:54 mlschroe Exp $ FAU + * $Id$ GNU */ #include "os.h" @@ -86,7 +91,7 @@ #define Ctrl(c) ((c)&037) -#define MAXSTR 256 +#define MAXSTR 512 #define MAXARGS 64 #define MSGWAIT 5 #define MSGMINWAIT 1 @@ -141,6 +146,7 @@ struct mode /* #include "logfile.h" */ /* (requires stat.h) struct logfile */ #include "image.h" +#include "canvas.h" #include "display.h" #include "window.h" @@ -167,12 +173,18 @@ struct mode #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) */ -#define MSG_VERSION 0 +#define MSG_VERSION 2 + #define MSG_REVISION (('m'<<24) | ('s'<<16) | ('g'<<8) | MSG_VERSION) struct msg { @@ -204,6 +216,7 @@ struct msg int meta_esc; /* his new meta esc character unless -1 */ char envterm[20 + 1]; /* terminal type */ int encoding; /* encoding of display */ + int detachfirst; /* whether to detach remote sessions first */ } attach; struct @@ -219,6 +232,8 @@ struct msg 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]; @@ -241,7 +256,7 @@ struct msg #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_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 */ @@ -256,8 +271,10 @@ struct msg #define DUMP_EXCHANGE 2 #define DUMP_SCROLLBACK 3 -#define SILENCE_OFF 0 -#define SILENCE_ON 1 +#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[]; @@ -293,3 +310,4 @@ struct baud_values */ #define WLIST_NUM 0 #define WLIST_MRU 1 +#define WLIST_NESTED 2 @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,9 +19,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -62,7 +67,7 @@ int dir; } else Input((dir > 0 ? "/" : "?"), sizeof(markdata->isstr)-1, INP_COOKED, - (dir > 0 ? searchend : backsearchend), NULL); + (dir > 0 ? searchend : backsearchend), NULL, 0); } static void @@ -364,7 +369,7 @@ int dir; 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); + is_process, NULL, 0); LGotoPos(flayer, markdata->cx, W2D(markdata->cy)); flayer->l_x = markdata->cx; flayer->l_y = W2D(markdata->cy); @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,9 +19,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -44,6 +49,7 @@ #endif #include "extern.h" +#include "list_generic.h" static int CheckPid __P((int)); static void ExecCreate __P((struct msg *)); @@ -53,20 +59,24 @@ static void DoCommandMsg __P((struct msg *)); static int sconnect __P((int, struct sockaddr *, int)); #endif static void FinishAttach __P((struct msg *)); +static void FinishDetach __P((struct msg *)); static void AskPassword __P((struct msg *)); extern char *RcFileName, *extra_incap, *extra_outcap; extern int ServerSocket, real_uid, real_gid, eff_uid, eff_gid; extern int dflag, iflag, rflag, lsflag, quietflag, wipeflag, xflag; +extern int queryflag; extern char *attach_tty, *LoginName, HostName[]; extern struct display *display, *displays; -extern struct win *fore, *wtab[], *console_window, *windows; +extern struct win *fore, **wtab, *console_window, *windows; extern struct layer *flayer; +extern struct layout *layout_attach, *layout_last, layout_last_marker; extern struct NewWindow nwin_undef; #ifdef MULTIUSER extern char *multi; #endif +extern int maxwin; extern char *getenv(); @@ -118,13 +128,14 @@ char *match; int firsts = -1, sockfd; char *firstn = NULL; int nfound = 0, ngood = 0, ndead = 0, nwipe = 0, npriv = 0; + int nperfect = 0; struct sent { struct sent *next; int mode; char *name; } *slist, **slisttail, *sent, *nsent; - + if (match) { matchlen = strlen(match); @@ -153,6 +164,7 @@ char *match; slisttail = &slist; while ((dp = readdir(dirp))) { + int cmatch = 0; name = dp->d_name; debug1("- %s\n", name); if (*name == 0 || *name == '.' || strlen(name) > 2*MAXSTR) @@ -172,7 +184,21 @@ char *match; if (strncmp(match, "tty", 3) && strncmp(n, "tty", 3) == 0) n += 3; if (strncmp(match, n, matchlen)) - continue; + { + if (n == name && *match > '0' && *match <= '9') + { + while (*n >= '0' && *n <= '9') + n++; + if (*n == '.') + n++; + if (strncmp(match, n, matchlen)) + continue; + } + else + continue; + } + else + cmatch = (*(n + matchlen) == 0); debug1(" -> matched %s\n", match); } sprintf(SockPath + sdirlen, "/%s", name); @@ -295,8 +321,12 @@ char *match; continue; } ngood++; - if (fdp && firsts == -1) + if (cmatch) + nperfect++; + if (fdp && (firsts == -1 || (cmatch && nperfect == 1))) { + if (firsts != -1) + close(firsts); firsts = sockfd; firstn = sent->name; debug(" taken.\n"); @@ -305,9 +335,11 @@ char *match; { debug(" discarded.\n"); close(sockfd); - } + } } (void)closedir(dirp); + if (!lsflag && nperfect == 1) + ngood = nperfect; if (nfound && (lsflag || ngood != 1) && !quietflag) { switch(ngood) @@ -387,7 +419,7 @@ char *match; *nfoundp = nfound - nwipe; return ngood; } - + /* ** @@ -419,7 +451,7 @@ MakeServerSocket() if (stat(SockPath, &st) == -1) Panic(errno, "stat"); if ((int)st.st_uid != real_uid) - Panic(0, "Unfortunatelly you are not its owner."); + Panic(0, "Unfortunately you are not its owner."); if ((st.st_mode & 0700) == 0600) Panic(0, "To resume it, use \"screen -r\""); else @@ -511,7 +543,7 @@ MakeServerSocket() if (stat(SockPath, &st) == -1) Panic(errno, "stat"); if (st.st_uid != real_uid) - Panic(0, "Unfortunatelly you are not its owner."); + Panic(0, "Unfortunately you are not its owner."); if ((st.st_mode & 0700) == 0600) Panic(0, "To resume it, use \"screen -r\""); else @@ -707,7 +739,7 @@ struct msg *mp; if (*buf) nwin.aka = buf; num = atoi(p); - if (num < 0 || num > MAXWIN - 1) + if (num < 0 || num > maxwin - 1) num = 0; nwin.StartAt = num; p += l + 1; @@ -776,38 +808,231 @@ char *s1, *s2; # define TTYCMP(a, b) strcmp(a, b) #endif +static int +CreateTempDisplay(m, recvfd, wi) +struct msg *m; +int recvfd; +struct win *wi; +{ + int pid; + int attach; + char *user; + int i; + struct mode Mode; + struct display *olddisplays = displays; + + switch (m->type) + { + case MSG_CONT: + case MSG_ATTACH: + pid = m->m.attach.apid; + user = m->m.attach.auser; + attach = 1; + break; +#ifdef REMOTE_DETACH + case MSG_DETACH: +# ifdef POW_DETACH + case MSG_POW_DETACH: +# endif /* POW_DETACH */ + pid = m->m.detach.dpid; + user = m->m.detach.duser; + attach = 0; + break; +#endif + default: + return -1; + } + + if (CheckPid(pid)) + { + Msg(0, "Attach attempt with bad pid(%d)!", pid); + return -1; + } + if (recvfd != -1) + { + char *myttyname; + i = recvfd; + recvfd = -1; + myttyname = ttyname(i); + if (myttyname == 0 || strcmp(myttyname, m->m_tty)) + { + Msg(errno, "Attach: passed fd does not match tty: %s - %s!", m->m_tty, myttyname ? myttyname : "NULL"); + close(i); + Kill(pid, SIG_BYE); + return -1; + } + } + else if ((i = secopen(m->m_tty, O_RDWR | O_NONBLOCK, 0)) < 0) + { + Msg(errno, "Attach: Could not open %s!", m->m_tty); + Kill(pid, SIG_BYE); + return -1; + } +#ifdef MULTIUSER + if (attach) + Kill(pid, SIGCONT); +#endif + +#if defined(ultrix) || defined(pyr) || defined(NeXT) + brktty(i); /* for some strange reason this must be done */ +#endif + + if (attach) + { + if (display || wi) + { + write(i, "Attaching from inside of screen?\n", 33); + close(i); + Kill(pid, SIG_BYE); + Msg(0, "Attach msg ignored: coming from inside."); + return -1; + } + +#ifdef MULTIUSER + if (strcmp(user, LoginName)) + if (*FindUserPtr(user) == 0) + { + write(i, "Access to session denied.\n", 26); + close(i); + Kill(pid, SIG_BYE); + Msg(0, "Attach: access denied for user %s.", user); + return -1; + } +#endif + + debug2("RecMsg: apid %d is o.k. and we just opened '%s'\n", pid, m->m_tty); +#ifndef MULTI + if (displays) + { + write(i, "Screen session in use.\n", 23); + close(i); + Kill(pid, SIG_BYE); + return -1; + } +#endif + } + + /* create new display */ + GetTTY(i, &Mode); + if (MakeDisplay(user, m->m_tty, attach ? m->m.attach.envterm : "", i, pid, &Mode) == 0) + { + write(i, "Could not make display.\n", 24); + close(i); + Msg(0, "Attach: could not make display for user %s", user); + Kill(pid, SIG_BYE); + return -1; + } +#ifdef ENCODINGS + if (attach) + { +# ifdef UTF8 + D_encoding = m->m.attach.encoding == 1 ? UTF8 : m->m.attach.encoding ? m->m.attach.encoding - 1 : 0; +# else + D_encoding = m->m.attach.encoding ? m->m.attach.encoding - 1 : 0; +# endif + if (D_encoding < 0 || !EncodingName(D_encoding)) + D_encoding = 0; + } +#endif + + if (iflag && olddisplays) + { + iflag = 0; +#if defined(TERMIO) || defined(POSIX) + olddisplays->d_NewMode.tio.c_cc[VINTR] = VDISABLE; + olddisplays->d_NewMode.tio.c_lflag &= ~ISIG; +#else /* TERMIO || POSIX */ + olddisplays->d_NewMode.m_tchars.t_intrc = -1; +#endif /* TERMIO || POSIX */ + SetTTY(olddisplays->d_userfd, &olddisplays->d_NewMode); + } + SetMode(&D_OldMode, &D_NewMode, D_flow, iflag); + SetTTY(D_userfd, &D_NewMode); + if (fcntl(D_userfd, F_SETFL, FNBLOCK)) + Msg(errno, "Warning: NBLOCK fcntl failed"); + return 0; +} + void ReceiveMsg() { - int left, len, i; + int left, len; static struct msg m; char *p; int ns = ServerSocket; - struct mode Mode; struct win *wi; -#ifdef REMOTE_DETACH - struct display *next; -#endif - struct display *olddisplays = displays; + int recvfd = -1; + struct acluser *user; #ifdef NAMEDPIPE debug("Ha, there was someone knocking on my fifo??\n"); if (fcntl(ServerSocket, F_SETFL, 0) == -1) Panic(errno, "BLOCK fcntl"); + p = (char *) &m; + left = sizeof(m); #else struct sockaddr_un a; + struct msghdr msg; + struct iovec iov; + char control[1024]; len = sizeof(a); debug("Ha, there was someone knocking on my socket??\n"); - if ((ns = accept(ns, (struct sockaddr *) &a, &len)) < 0) + if ((ns = accept(ns, (struct sockaddr *) &a, (void *)&len)) < 0) { Msg(errno, "accept"); return; } -#endif /* NAMEDPIPE */ p = (char *) &m; left = sizeof(m); + bzero(&msg, sizeof(msg)); + iov.iov_base = &m; + iov.iov_len = left; + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + msg.msg_controllen = sizeof(control); + msg.msg_control = &control; + while (left > 0) + { + len = recvmsg(ns, &msg, 0); + if (len < 0 && errno == EINTR) + continue; + if (len < 0) + { + close(ns); + Msg(errno, "read"); + return; + } + if (msg.msg_controllen) + { + struct cmsghdr *cmsg; + for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) + { + int cl; + char *cp; + if (cmsg->cmsg_level != SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS) + continue; + cp = (char *)CMSG_DATA(cmsg); + cl = cmsg->cmsg_len; + while(cl >= CMSG_LEN(sizeof(int))) + { + int passedfd; + bcopy(cp, &passedfd, sizeof(int)); + if (recvfd >= 0 && passedfd != recvfd) + close(recvfd); + recvfd = passedfd; + cl -= CMSG_LEN(sizeof(int)); + } + } + } + p += len; + left -= len; + break; + } + +#endif + while (left > 0) { len = read(ns, p, left); @@ -836,6 +1061,8 @@ ReceiveMsg() if (len < 0) { Msg(errno, "read"); + if (recvfd != -1) + close(recvfd); return; } if (left > 0) @@ -848,11 +1075,19 @@ ReceiveMsg() } if (m.protocol_revision != MSG_REVISION) { + if (recvfd != -1) + close(recvfd); Msg(0, "Invalid message (magic 0x%08x).", m.protocol_revision); return; } debug2("*** RecMsg: type %d tty %s\n", m.type, m.m_tty); + if (m.type != MSG_ATTACH && recvfd != -1) + { + close(recvfd); + recvfd = -1; + } + for (display = displays; display; display = display->d_next) if (TTYCMP(D_usertty, m.m_tty) == 0) break; @@ -876,7 +1111,11 @@ ReceiveMsg() RemoveStatus(); if (display && !D_tcinited && m.type != MSG_HANGUP) - return; /* ignore messages for bad displays */ + { + if (recvfd != -1) + close(recvfd); + return; /* ignore messages for bad displays */ + } switch (m.type) { @@ -889,12 +1128,8 @@ ReceiveMsg() * the window that issued the create message need not be an active * window. Then we create the window without having a display. * Resulting in another inactive window. - * - * Currently we enforce that at least one display exists. But why? - * jw. */ - if (displays) - ExecCreate(&m); + ExecCreate(&m); break; case MSG_CONT: if (display && D_userpid != 0 && kill(D_userpid, 0) == 0) @@ -903,93 +1138,8 @@ ReceiveMsg() /* FALLTHROUGH */ case MSG_ATTACH: - if (CheckPid(m.m.attach.apid)) - { - Msg(0, "Attach attempt with bad pid(%d)!", m.m.attach.apid); - break; - } - if ((i = secopen(m.m_tty, O_RDWR | O_NONBLOCK, 0)) < 0) - { - Msg(errno, "Attach: Could not open %s!", m.m_tty); - Kill(m.m.attach.apid, SIG_BYE); - break; - } -# ifdef MULTIUSER - Kill(m.m.attach.apid, SIGCONT); -# endif - -#if defined(ultrix) || defined(pyr) || defined(NeXT) - brktty(i); /* for some strange reason this must be done */ -#endif - - if (display || wi) - { - write(i, "Attaching from inside of screen?\n", 33); - close(i); - Kill(m.m.attach.apid, SIG_BYE); - Msg(0, "Attach msg ignored: coming from inside."); - break; - } - -#ifdef MULTIUSER - if (strcmp(m.m.attach.auser, LoginName)) - if (*FindUserPtr(m.m.attach.auser) == 0) - { - write(i, "Access to session denied.\n", 26); - close(i); - Kill(m.m.attach.apid, SIG_BYE); - Msg(0, "Attach: access denied for user %s.", m.m.attach.auser); - break; - } -#endif - - debug2("RecMsg: apid %d is o.k. and we just opened '%s'\n", m.m.attach.apid, m.m_tty); -#ifndef MULTI - if (displays) - { - write(i, "Screen session in use.\n", 23); - close(i); - Kill(m.m.attach.apid, SIG_BYE); - break; - } -#endif - - /* create new display */ - GetTTY(i, &Mode); - if (MakeDisplay(m.m.attach.auser, m.m_tty, m.m.attach.envterm, i, m.m.attach.apid, &Mode) == 0) - { - write(i, "Could not make display.\n", 24); - close(i); - Msg(0, "Attach: could not make display for user %s", m.m.attach.auser); - Kill(m.m.attach.apid, SIG_BYE); - break; - } -#ifdef ENCODINGS -# ifdef UTF8 - D_encoding = m.m.attach.encoding == 1 ? UTF8 : m.m.attach.encoding ? m.m.attach.encoding - 1 : 0; -# else - D_encoding = m.m.attach.encoding ? m.m.attach.encoding - 1 : 0; -# endif - if (D_encoding < 0 || !EncodingName(D_encoding)) - D_encoding = 0; -#endif - /* turn off iflag on a multi-attach... */ - if (iflag && olddisplays) - { - iflag = 0; -#if defined(TERMIO) || defined(POSIX) - olddisplays->d_NewMode.tio.c_cc[VINTR] = VDISABLE; - olddisplays->d_NewMode.tio.c_lflag &= ~ISIG; -#else /* TERMIO || POSIX */ - olddisplays->d_NewMode.m_tchars.t_intrc = -1; -#endif /* TERMIO || POSIX */ - SetTTY(olddisplays->d_userfd, &olddisplays->d_NewMode); - } - SetMode(&D_OldMode, &D_NewMode, D_flow, iflag); - SetTTY(D_userfd, &D_NewMode); - if (fcntl(D_userfd, F_SETFL, FNBLOCK)) - Msg(errno, "Warning: NBLOCK fcntl failed"); - + if (CreateTempDisplay(&m, recvfd, wi)) + break; #ifdef PASSWORD if (D_user->u_password && *D_user->u_password) AskPassword(&m); @@ -1009,19 +1159,39 @@ ReceiveMsg() # ifdef POW_DETACH case MSG_POW_DETACH: # endif /* POW_DETACH */ - for (display = displays; display; display = next) +#ifdef PASSWORD + user = *FindUserPtr(m.m.detach.duser); + if (user && user->u_password && *user->u_password) { - next = display->d_next; -# ifdef POW_DETACH - if (m.type == MSG_POW_DETACH) - Detach(D_REMOTE_POWER); - else -# endif /* POW_DETACH */ - if (m.type == MSG_DETACH) - Detach(D_REMOTE); + if (CreateTempDisplay(&m, recvfd, 0)) + break; + AskPassword(&m); } + else +#endif /* PASSWORD */ + FinishDetach(&m); break; #endif + case MSG_QUERY: + { + char *oldSockPath = SaveStr(SockPath); + strcpy(SockPath, m.m.command.writeback); + int s = MakeClientSocket(0); + strcpy(SockPath, oldSockPath); + Free(oldSockPath); + if (s >= 0) + { + queryflag = s; + DoCommandMsg(&m); + close(s); + } + else + queryflag = -1; + + Kill(m.m.command.apid, (queryflag >= 0) ? SIGCONT : SIG_BYE); /* Send SIG_BYE if an error happened */ + queryflag = -1; + } + break; case MSG_COMMAND: DoCommandMsg(&m); break; @@ -1030,6 +1200,32 @@ ReceiveMsg() } } +void +ReceiveRaw(s) +int s; +{ + char rd[256]; + int len = 0; +#ifdef NAMEDPIPE + if (fcntl(s, F_SETFL, 0) == -1) + Panic(errno, "BLOCK fcntl"); +#else + struct sockaddr_un a; + len = sizeof(a); + if ((s = accept(s, (struct sockaddr *) &a, (void *)&len)) < 0) + { + Msg(errno, "accept"); + return; + } +#endif + while ((len = read(s, rd, 255)) > 0) + { + rd[len] = 0; + printf("%s", rd); + } + close(s); +} + #if defined(_SEQUENT_) && !defined(NAMEDPIPE) #undef connect /* @@ -1117,6 +1313,15 @@ struct msg *m; ASSERT(display); pid = D_userpid; +#ifdef REMOTE_DETACH + if (m->m.attach.detachfirst == MSG_DETACH +# ifdef POW_DETACH + || m->m.attach.detachfirst == MSG_POW_DETACH +# endif + ) + FinishDetach(m); +#endif + #if defined(pyr) || defined(xelos) || defined(sequent) /* * Kludge for systems with braindamaged termcap routines, @@ -1143,12 +1348,12 @@ struct msg *m; #ifdef ETCSCREENRC # ifdef ALLOW_SYSSCREENRC if ((p = getenv("SYSSCREENRC"))) - StartRc(p); + StartRc(p, 1); else # endif - StartRc(ETCSCREENRC); + StartRc(ETCSCREENRC, 1); #endif - StartRc(RcFileName); + StartRc(RcFileName, 1); if (InitTermcap(m->m.attach.columns, m->m.attach.lines)) { FreeDisplay(); @@ -1180,6 +1385,17 @@ struct msg *m; #endif D_fore = NULL; + if (layout_attach) + { + struct layout *lay = layout_attach; + if (lay == &layout_last_marker) + lay = layout_last; + if (lay) + { + LoadLayout(lay, &D_canvas); + SetCanvasWindow(D_forecv, 0); + } + } /* * there may be a window that we remember from last detach: */ @@ -1203,6 +1419,15 @@ struct msg *m; fore = 0; noshowwin = 1; } + else if (!strcmp(m->m.attach.preselect, "+")) + { + struct action newscreen; + char *na = 0; + newscreen.nr = RC_SCREEN; + newscreen.args = &na; + newscreen.quiet = 0; + DoAction(&newscreen, -1); + } else fore = FindNiceWindow(fore, m->m.attach.preselect); } @@ -1216,9 +1441,11 @@ struct msg *m; if (!AclCheckPermCmd(D_user, ACL_EXEC, &comms[RC_WINDOWLIST])) #endif { + struct display *olddisplay = display; flayer = D_forecv->c_layer; - display_wlist(1, WLIST_NUM); + display_windows(1, WLIST_NUM, (struct win *)0); noshowwin = 1; + display = olddisplay; /* display_windows can change display */ } } Activate(0); @@ -1242,6 +1469,59 @@ struct msg *m; # endif /* SIG_NODEBUG */ } +static void +FinishDetach(m) +struct msg *m; +{ + struct display *next, **d, *det; + int pid; + + if (m->type == MSG_ATTACH) + pid = D_userpid; + else + pid = m->m.detach.dpid; + + /* Remove the temporary display prompting for the password from the list */ + for (d = &displays; (det = *d); d = &det->d_next) + { + if (det->d_userpid == pid) + break; + } + if (det) + { + *d = det->d_next; + det->d_next = 0; + } + + for (display = displays; display; display = next) + { + next = display->d_next; +# ifdef POW_DETACH + if (m->type == MSG_POW_DETACH) + Detach(D_REMOTE_POWER); + else +# endif /* POW_DETACH */ + if (m->type == MSG_DETACH) + Detach(D_REMOTE); + else if (m->type == MSG_ATTACH) + { +#ifdef POW_DETACH + if (m->m.attach.detachfirst == MSG_POW_DETACH) + Detach(D_REMOTE_POWER); + else +#endif + if (m->m.attach.detachfirst == MSG_DETACH) + Detach(D_REMOTE); + } + } + display = displays = det; + if (m->type != MSG_ATTACH) + { + if (display) + FreeDisplay(); + Kill(pid, SIGCONT); + } +} #ifdef PASSWORD static void PasswordProcessInput __P((char *, int)); @@ -1260,7 +1540,7 @@ struct msg *m; ASSERT(display); pwdata = (struct pwdata *)malloc(sizeof(struct pwdata)); if (!pwdata) - Panic(0, strnomem); + Panic(0, "%s", strnomem); pwdata->l = 0; pwdata->m = *m; D_processinputdata = (char *)pwdata; @@ -1304,7 +1584,16 @@ int ilen; AddStr("\r\n"); D_processinputdata = 0; D_processinput = ProcessInput; - FinishAttach(&pwdata->m); +#ifdef REMOTE_DETACH + if (pwdata->m.type == MSG_DETACH +# ifdef POW_DETACH + || pwdata->m.type == MSG_POW_DETACH +# endif + ) + FinishDetach(&pwdata->m); + else +#endif + FinishAttach(&pwdata->m); free(pwdata); return; } @@ -1333,14 +1622,40 @@ int ilen; } #endif +/* 'end' is exclusive, i.e. you should *not* write in *end */ +static char * +strncpy_escape_quote(dst, src, end) +char *dst; +const char *src, *end; +{ + while (*src && dst < end) + { + if (*src == '"') + { + if (dst + 2 < end) /* \\ \" \0 */ + *dst++ = '\\'; + else + return NULL; + } + *dst++ = *src++; + } + if (dst >= end) + return NULL; + + *dst = '\0'; + return dst; +} + static void DoCommandMsg(mp) struct msg *mp; { char *args[MAXARGS]; int argl[MAXARGS]; - int n, *lp; - register char **pp = args, *p = mp->m.command.cmd; + char fullcmd[MAXSTR]; + register char *fc; + int n; + register char *p = mp->m.command.cmd; struct acluser *user; #ifdef MULTIUSER extern struct acluser *EffectiveAclUser; /* acls.c */ @@ -1348,22 +1663,36 @@ struct msg *mp; extern struct acluser *users; /* acls.c */ #endif - lp = argl; n = mp->m.command.nargs; if (n > MAXARGS - 1) n = MAXARGS - 1; - for (; n > 0; n--) + for (fc = fullcmd; n > 0; n--) { - *pp++ = p; - *lp = strlen(p); - p += *lp++ + 1; + int len = strlen(p); + *fc++ = '"'; + if (!(fc = strncpy_escape_quote(fc, p, fullcmd + sizeof(fullcmd) - 2))) /* '"' ' ' */ + { + Msg(0, "Remote command too long."); + queryflag = -1; + return; + } + p += len + 1; + *fc++ = '"'; + *fc++ = ' '; + } + if (fc != fullcmd) + *--fc = 0; + if (Parse(fullcmd, sizeof fullcmd, args, argl) <= 0) + { + queryflag = -1; + return; } - *pp = 0; #ifdef MULTIUSER user = *FindUserPtr(mp->m.attach.auser); if (user == 0) { Msg(0, "Unknown user %s tried to send a command!", mp->m.attach.auser); + queryflag = -1; return; } #else @@ -1372,7 +1701,8 @@ struct msg *mp; #ifdef PASSWORD if (user->u_password && *user->u_password) { - Msg(0, "User %s has a password, cannot use -X option.", mp->m.attach.auser); + Msg(0, "User %s has a password, cannot use remote commands (using -Q or -X option).", mp->m.attach.auser); + queryflag = -1; return; } #endif @@ -1393,7 +1723,15 @@ struct msg *mp; { int i = -1; if (strcmp(mp->m.command.preselect, "-")) - i = WindowByNoN(mp->m.command.preselect); + { + i = WindowByNoN(mp->m.command.preselect); + if (i < 0 || !wtab[i]) + { + Msg(0, "Could not find pre-select window."); + queryflag = -1; + return; + } + } fore = i >= 0 ? wtab[i] : 0; } else if (!fore) @@ -1406,6 +1744,8 @@ struct msg *mp; fore = FindNiceWindow(fore, 0); } } + if (!fore) + fore = windows; /* sigh */ #ifdef MULTIUSER EffectiveAclUser = user; #endif @@ -1424,3 +1764,45 @@ struct msg *mp; EffectiveAclUser = 0; #endif } + +#ifndef NAMEDPIPE + +int +SendAttachMsg(s, m, fd) +int s; +struct msg *m; +int fd; +{ + int r; + struct msghdr msg; + struct iovec iov; + char buf[CMSG_SPACE(sizeof(int))]; + struct cmsghdr *cmsg; + + iov.iov_base = (char *)m; + iov.iov_len = sizeof(*m); + bzero(&msg, sizeof(msg)); + msg.msg_name = 0; + msg.msg_namelen = 0; + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + msg.msg_control = buf; + msg.msg_controllen = sizeof(buf); + cmsg = CMSG_FIRSTHDR(&msg); + cmsg->cmsg_level = SOL_SOCKET; + cmsg->cmsg_type = SCM_RIGHTS; + cmsg->cmsg_len = CMSG_LEN(sizeof(int)); + bcopy(&fd, CMSG_DATA(cmsg), sizeof(int)); + msg.msg_controllen = cmsg->cmsg_len; + while(1) + { + r = sendmsg(s, &msg, 0); + if (r == -1 && errno == EINTR) + continue; + if (r == -1) + return -1; + return 0; + } +} + +#endif @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,9 +19,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -64,6 +69,7 @@ static void TelDosub __P((struct win *)); #define TO_NAWS 31 #define TO_TSPEED 32 #define TO_LFLOW 33 +#define TO_LINEMODE 34 #define TO_XDISPLOC 35 #define TO_NEWENV 39 @@ -90,7 +96,7 @@ char *data; strncpy(buf + 1, strerror(errno), sizeof(buf) - 2); buf[sizeof(buf) - 1] = 0; WriteString(p, buf, strlen(buf)); - WindowDied(p); + WindowDied(p, 0, 0); return; } WriteString(p, "connected.\r\n", 12); @@ -406,13 +412,13 @@ int cmd, opt; int repl = 0; if (cmd == TC_WONT) - debug2("[WONT %c %d]\n", TO_S[opt], opt); + debug2("[<-WONT %c %d]\n", TO_S[opt], opt); if (cmd == TC_WILL) - debug2("[WILL %c %d]\n", TO_S[opt], opt); + debug2("[<-WILL %c %d]\n", TO_S[opt], opt); if (cmd == TC_DONT) - debug2("[DONT %c %d]\n", TO_S[opt], opt); + debug2("[<-DONT %c %d]\n", TO_S[opt], opt); if (cmd == TC_DO) - debug2("[DO %c %d]\n", TO_S[opt], opt); + debug2("[<-DO %c %d]\n", TO_S[opt], opt); switch(cmd) { @@ -458,6 +464,16 @@ int cmd, opt; b[0] = TC_IAC; b[1] = repl; b[2] = opt; + + if (repl == TC_WONT) + debug2("[->WONT %c %d]\n", TO_S[opt], opt); + if (repl == TC_WILL) + debug2("[->WILL %c %d]\n", TO_S[opt], opt); + if (repl == TC_DONT) + debug2("[->DONT %c %d]\n", TO_S[opt], opt); + if (repl == TC_DO) + debug2("[->DO %c %d]\n", TO_S[opt], opt); + TelReply(p, (char *)b, 3); if (cmd == TC_DO && opt == TO_NAWS) TelWindowSize(p); @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,9 +19,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -173,6 +178,10 @@ struct term term[T_N] = /* keycaps */ /* define T_CAPS */ + +/* mouse */ + { "Km", T_STR }, KMAPDEF("\033[M") KMAPMDEF("\222") + /* nolist */ { "k0", T_STR }, KMAPDEF("\033[10~") { "k1", T_STR }, KMAPDEF("\033OP") @@ -231,7 +240,7 @@ struct term term[T_N] = { "kh", T_STR }, KMAPDEF("\033[1~") KMAPMDEF("\201") { "@1", T_STR }, { "kH", T_STR }, KMAPDEF("\033[4~") KMAPMDEF("\205") - { "@7", T_STR }, + { "@7", T_STR }, KMAPDEF("\033[4~") KMAPMDEF("\205") { "kN", T_STR }, KMAPDEF("\033[6~") KMAPMDEF("\006") { "kP", T_STR }, KMAPDEF("\033[5~") KMAPMDEF("\002") { "kI", T_STR }, KMAPDEF("\033[2~") diff --git a/termcap.c b/src/termcap.c index 0e7186e..32ae63d 100644 --- a/termcap.c +++ b/src/termcap.c @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,9 +19,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -26,8 +31,6 @@ #include "screen.h" #include "extern.h" -#undef DEBUGG - extern struct display *display, *displays; extern int real_uid, real_gid, eff_uid, eff_gid; extern struct term term[]; /* terminal capabilities */ @@ -39,6 +42,7 @@ extern int hardstatusemu; extern struct action umtab[]; extern struct action mmtab[]; extern struct action dmtab[]; +extern struct action ktab[]; extern struct kmap_ext *kmap_exts; extern int kmap_extn; extern int DefaultEsc; @@ -133,7 +137,7 @@ int he; if ((D_tentry = (char *)malloc(TERMCAP_BUFSIZE + (extra_incap ? strlen(extra_incap) + 1 : 0))) == 0) { - Msg(0, strnomem); + Msg(0, "%s", strnomem); return -1; } @@ -220,7 +224,8 @@ int he; /* ISO2022 */ if ((D_EA && InStr(D_EA, "\033(B")) || (D_AS && InStr(D_AS, "\033(0"))) D_CG0 = 1; - if (InStr(D_termname, "xterm") || InStr(D_termname, "rxvt")) + if (InStr(D_termname, "xterm") || InStr(D_termname, "rxvt") || + (D_CKM && InStr(D_CKM, "\033[M"))) D_CXT = 1; /* "be" seems to be standard for xterms... */ if (D_CXT) @@ -255,7 +260,7 @@ int he; D_US = D_UE = 0; if (D_SG > 0) D_SO = D_SE = 0; - /* Unfortunatelly there is no 'mg' capability. + /* Unfortunately there is no 'mg' capability. * For now we think that mg > 0 if sg and ug > 0. */ if (D_UG > 0 && D_SG > 0) @@ -529,9 +534,9 @@ int map; a1 = 0; if (a2 && a2->nr == RC_ILLEGAL) a2 = 0; - if (a1 && a1->nr == RC_STUFF && strcmp(a1->args[0], s) == 0) + if (a1 && a1->nr == RC_STUFF && a1->args[0] && strcmp(a1->args[0], s) == 0) a1 = 0; - if (a2 && a2->nr == RC_STUFF && strcmp(a2->args[0], s) == 0) + if (a2 && a2->nr == RC_STUFF && a2->args[0] && strcmp(a2->args[0], s) == 0) a2 = 0; domap |= (a1 || a2); if (tab == umtab) @@ -547,7 +552,8 @@ int map; else break; } - + if (n < KMAP_KEYS) + domap = 1; if (map == 0 && domap) return 0; if (map && !domap) @@ -1190,12 +1196,11 @@ char *s; char **ctable; int l, c; - if ((D_xtable = (char ***)malloc(256 * sizeof(char **))) == 0) + if ((D_xtable = (char ***)calloc(256, sizeof(char **))) == 0) { - Msg(0, strnomem); + Msg(0, "%s", strnomem); return -1; } - bzero((char *)D_xtable, 256 * sizeof(char **)); while (*s) { @@ -1209,13 +1214,12 @@ char *s; templnsub = 0; if (D_xtable[curchar] == 0) { - if ((D_xtable[curchar] = (char **)malloc(257 * sizeof(char *))) == 0) + if ((D_xtable[curchar] = (char **)calloc(257, sizeof(char *))) == 0) { - Msg(0, strnomem); + Msg(0, "%s", strnomem); FreeTransTable(); return -1; } - bzero((char *)D_xtable[curchar], 257 * sizeof(char *)); } ctable = D_xtable[curchar]; for(; *s && *s != ','; s++) @@ -1246,7 +1250,7 @@ char *s; l = l * templnsub + templlen; if ((ctable[c] = (char *)malloc(l + 1)) == 0) { - Msg(0, strnomem); + Msg(0, "%s", strnomem); FreeTransTable(); return -1; } diff --git a/terminfo/8bits b/src/terminfo/8bits index b616622..b616622 100644 --- a/terminfo/8bits +++ b/src/terminfo/8bits diff --git a/terminfo/README b/src/terminfo/README index 45b39e6..45b39e6 100644 --- a/terminfo/README +++ b/src/terminfo/README diff --git a/terminfo/checktc.c b/src/terminfo/checktc.c index ccc9485..ccc9485 100644 --- a/terminfo/checktc.c +++ b/src/terminfo/checktc.c diff --git a/terminfo/screencap b/src/terminfo/screencap index 4820d92..4820d92 100644 --- a/terminfo/screencap +++ b/src/terminfo/screencap diff --git a/terminfo/screeninfo.src b/src/terminfo/screeninfo.src index c6ca4d9..c5f254a 100644 --- a/terminfo/screeninfo.src +++ b/src/terminfo/screeninfo.src @@ -47,7 +47,7 @@ screen-bce|VT 100/ANSI X3.64 virtual terminal with bce, op=\E[39;49m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++\054\054hhII00, screen-s|VT 100/ANSI X3.64 virtual terminal with hardstatus line, - am, bce, km, mir, msgr, xenl, + am, bce, hs, km, mir, msgr, xenl, cols#80, it#8, lines#24, colors#8, pairs#64, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[J, cr=\r, csr=\E[%i%p1%d;%p2%dr, @@ -71,3 +71,10 @@ screen-s|VT 100/ANSI X3.64 virtual terminal with hardstatus line, civis=\E[?25l, cnorm=\E[34h\E[?25h, cvvis=\E[34l, op=\E[39;49m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~..--++\054\054hhII00, +screen-256color|VT 100/ANSI X3.64 virtual terminal, + ccc, + colors#256, pairs#32767, + initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\, + setab=\E[48;5;%p1%dm, setaf=\E[38;5;%p1%dm, + setb=\E[48;5;%p1%dm, setf=\E[38;5;%p1%dm, + use=screen, diff --git a/terminfo/test.txt b/src/terminfo/test.txt index 2da65e5..2da65e5 100644 --- a/terminfo/test.txt +++ b/src/terminfo/test.txt diff --git a/terminfo/tetris.c b/src/terminfo/tetris.c index e230373..e230373 100644 --- a/terminfo/tetris.c +++ b/src/terminfo/tetris.c @@ -24,14 +24,19 @@ sed -e '1,26d' \ chmod -w $1 exit 0 -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -40,9 +45,9 @@ exit 0 * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -76,7 +81,7 @@ exit 0 #endif #include "config.h" -#ifdef SVR4 +#ifdef HAVE_STROPTS_H #include <sys/stropts.h> /* for I_POP */ #endif @@ -562,7 +567,9 @@ XIF{VDISCARD} np->tio.c_cc[VDISCARD] = VDISABLE; XIF{VLNEXT} np->tio.c_cc[VLNEXT] = VDISABLE; XIF{VSTATUS} np->tio.c_cc[VSTATUS] = VDISABLE; XIF{VSUSP} np->tio.c_cc[VSUSP] = VDISABLE; -XIF{VERASE} np->tio.c_cc[VERASE] = VDISABLE; + /* Set VERASE to DEL, rather than VDISABLE, to avoid libvte + "autodetect" issues. */ +XIF{VERASE} np->tio.c_cc[VERASE] = 0x7f; XIF{VKILL} np->tio.c_cc[VKILL] = VDISABLE; # ifdef HPUX_LTCHARS_HACK np->m_ltchars.t_suspc = VDISABLE; @@ -622,6 +629,10 @@ XIF{VSTOP} D_NewMode.tio.c_cc[VSTOP] = VDISABLE; D_NewMode.tio.c_iflag &= ~IXON; } # ifdef POSIX +# ifdef TCOON + if (!on) + tcflow(D_userfd, TCOON); +# endif if (tcsetattr(D_userfd, TCSANOW, &D_NewMode.tio)) # else if (ioctl(D_userfd, TCSETAW, (char *)&D_NewMode.tio) != 0) diff --git a/utf8encodings/01 b/src/utf8encodings/01 Binary files differindex a6dde0f..a6dde0f 100644 --- a/utf8encodings/01 +++ b/src/utf8encodings/01 diff --git a/utf8encodings/02 b/src/utf8encodings/02 Binary files differindex 78a5cc0..78a5cc0 100644 --- a/utf8encodings/02 +++ b/src/utf8encodings/02 diff --git a/utf8encodings/03 b/src/utf8encodings/03 Binary files differindex 4c04358..4c04358 100644 --- a/utf8encodings/03 +++ b/src/utf8encodings/03 diff --git a/utf8encodings/04 b/src/utf8encodings/04 Binary files differindex 233f2ae..233f2ae 100644 --- a/utf8encodings/04 +++ b/src/utf8encodings/04 diff --git a/utf8encodings/18 b/src/utf8encodings/18 Binary files differindex 9c7e9c0..9c7e9c0 100644 --- a/utf8encodings/18 +++ b/src/utf8encodings/18 diff --git a/utf8encodings/19 b/src/utf8encodings/19 Binary files differindex 65167a6..65167a6 100644 --- a/utf8encodings/19 +++ b/src/utf8encodings/19 diff --git a/utf8encodings/a1 b/src/utf8encodings/a1 Binary files differindex f39ce11..f39ce11 100644 --- a/utf8encodings/a1 +++ b/src/utf8encodings/a1 diff --git a/utf8encodings/bf b/src/utf8encodings/bf Binary files differindex 397c128..397c128 100644 --- a/utf8encodings/bf +++ b/src/utf8encodings/bf diff --git a/utf8encodings/c2 b/src/utf8encodings/c2 Binary files differindex 58e8ffd..58e8ffd 100644 --- a/utf8encodings/c2 +++ b/src/utf8encodings/c2 diff --git a/utf8encodings/c3 b/src/utf8encodings/c3 Binary files differindex 9407ed8..9407ed8 100644 --- a/utf8encodings/c3 +++ b/src/utf8encodings/c3 diff --git a/utf8encodings/c4 b/src/utf8encodings/c4 Binary files differindex 1dcd5fa..1dcd5fa 100644 --- a/utf8encodings/c4 +++ b/src/utf8encodings/c4 diff --git a/utf8encodings/c6 b/src/utf8encodings/c6 Binary files differindex 12159ca..12159ca 100644 --- a/utf8encodings/c6 +++ b/src/utf8encodings/c6 diff --git a/utf8encodings/c7 b/src/utf8encodings/c7 Binary files differindex e8f2b37..e8f2b37 100644 --- a/utf8encodings/c7 +++ b/src/utf8encodings/c7 diff --git a/utf8encodings/c8 b/src/utf8encodings/c8 Binary files differindex 36a74b6..36a74b6 100644 --- a/utf8encodings/c8 +++ b/src/utf8encodings/c8 diff --git a/utf8encodings/cc b/src/utf8encodings/cc Binary files differindex fc16e8f..fc16e8f 100644 --- a/utf8encodings/cc +++ b/src/utf8encodings/cc diff --git a/utf8encodings/cd b/src/utf8encodings/cd Binary files differindex b9d3e80..b9d3e80 100644 --- a/utf8encodings/cd +++ b/src/utf8encodings/cd diff --git a/utf8encodings/d6 b/src/utf8encodings/d6 Binary files differindex 4025ca0..4025ca0 100644 --- a/utf8encodings/d6 +++ b/src/utf8encodings/d6 @@ -1,11 +1,16 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,9 +19,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -102,7 +107,7 @@ static int utmpfd = -1; #endif -# if defined(GETUTENT) && (!defined(SVR4) || defined(__hpux)) +# if defined(GETUTENT) && (!defined(SVR4) || defined(__hpux)) && ! defined(__CYGWIN__) # if defined(hpux) /* cruel hpux release 8.0 */ # define pututline _pututline # endif /* hpux */ @@ -263,7 +268,7 @@ InitUtmp() if ((utmpfd = open(UtmpName, O_RDWR)) == -1) { if (errno != EACCES) - Msg(errno, UtmpName); + Msg(errno, "%s", UtmpName); debug("InitUtmp failed.\n"); utmpok = 0; return; @@ -581,7 +586,11 @@ struct win *wi; } #endif setutent(); +#ifndef __CYGWIN__ return pututline(u) != 0; +#else + return 1; +#endif } static void @@ -589,7 +598,7 @@ makedead(u) struct utmp *u; { u->ut_type = DEAD_PROCESS; -#if !defined(linux) || defined(EMPTY) +#if (!defined(linux) || defined(EMPTY)) && !defined(__CYGWIN__) u->ut_exit.e_termination = 0; u->ut_exit.e_exit = 0; #endif @@ -604,6 +613,7 @@ struct utmp *u; char *line, *user; int pid; { + time_t now; u->ut_type = USER_PROCESS; strncpy(u->ut_user, user, sizeof(u->ut_user)); /* Now the tricky part... guess ut_id */ @@ -618,7 +628,10 @@ int pid; #endif /* sgi */ strncpy(u->ut_line, line, sizeof(u->ut_line)); u->ut_pid = pid; - (void)time((time_t *)&u->ut_time); + /* must use temp variable because of NetBSD/sparc64, where + * ut_xtime is long(64) but time_t is int(32) */ + (void)time(&now); + u->ut_time = now; } static slot_t @@ -726,9 +739,11 @@ struct utmp *u; char *line, *user; int pid; { + time_t now; strncpy(u->ut_line, line, sizeof(u->ut_line)); strncpy(u->ut_name, user, sizeof(u->ut_name)); - (void)time((time_t *)&u->ut_time); + (void)time(&now); + u->ut_time = now; } static slot_t diff --git a/src/viewport.c b/src/viewport.c new file mode 100644 index 0000000..f1607d5 --- /dev/null +++ b/src/viewport.c @@ -0,0 +1,140 @@ +/* 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 + * http://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 "viewport.h" + +extern struct display *display; + +int +RethinkDisplayViewports() +{ + struct canvas *cv; + struct viewport *vp, *vpn; + + /* free old viewports */ + for (cv = display->d_cvlist; cv; cv = cv->c_next) + { + for (vp = cv->c_vplist; vp; vp = vpn) + { + vp->v_canvas = 0; + vpn = vp->v_next; + bzero((char *)vp, sizeof(*vp)); + free(vp); + } + cv->c_vplist = 0; + } + display->d_vpxmin = -1; + display->d_vpxmax = -1; + + for (cv = display->d_cvlist; cv; cv = cv->c_next) + { + if ((vp = (struct viewport *)malloc(sizeof *vp)) == 0) + return -1; +#ifdef HOLE + vp->v_canvas = cv; + vp->v_xs = cv->c_xs; + vp->v_ys = (cv->c_ys + cv->c_ye) / 2; + vp->v_xe = cv->c_xe; + vp->v_ye = cv->c_ye; + vp->v_xoff = cv->c_xoff; + vp->v_yoff = cv->c_yoff; + vp->v_next = cv->c_vplist; + cv->c_vplist = vp; + + if ((vp = (struct viewport *)malloc(sizeof *vp)) == 0) + return -1; + vp->v_canvas = cv; + vp->v_xs = (cv->c_xs + cv->c_xe) / 2; + vp->v_ys = (3 * cv->c_ys + cv->c_ye) / 4; + vp->v_xe = cv->c_xe; + vp->v_ye = (cv->c_ys + cv->c_ye) / 2 - 1; + vp->v_xoff = cv->c_xoff; + vp->v_yoff = cv->c_yoff; + vp->v_next = cv->c_vplist; + cv->c_vplist = vp; + + if ((vp = (struct viewport *)malloc(sizeof *vp)) == 0) + return -1; + vp->v_canvas = cv; + vp->v_xs = cv->c_xs; + vp->v_ys = (3 * cv->c_ys + cv->c_ye) / 4; + vp->v_xe = (3 * cv->c_xs + cv->c_xe) / 4 - 1; + vp->v_ye = (cv->c_ys + cv->c_ye) / 2 - 1; + vp->v_xoff = cv->c_xoff; + vp->v_yoff = cv->c_yoff; + vp->v_next = cv->c_vplist; + cv->c_vplist = vp; + + if ((vp = (struct viewport *)malloc(sizeof *vp)) == 0) + return -1; + vp->v_canvas = cv; + vp->v_xs = cv->c_xs; + vp->v_ys = cv->c_ys; + vp->v_xe = cv->c_xe; + vp->v_ye = (3 * cv->c_ys + cv->c_ye) / 4 - 1; + vp->v_xoff = cv->c_xoff; + vp->v_yoff = cv->c_yoff; + vp->v_next = cv->c_vplist; + cv->c_vplist = vp; +#else + vp->v_canvas = cv; + vp->v_xs = cv->c_xs; + vp->v_ys = cv->c_ys; + vp->v_xe = cv->c_xe; + vp->v_ye = cv->c_ye; + vp->v_xoff = cv->c_xoff; + vp->v_yoff = cv->c_yoff; + vp->v_next = cv->c_vplist; + cv->c_vplist = vp; +#endif + + if (cv->c_xs < display->d_vpxmin || display->d_vpxmin == -1) + display->d_vpxmin = cv->c_xs; + if (cv->c_xe > display->d_vpxmax || display->d_vpxmax == -1) + display->d_vpxmax = cv->c_xe; + } + return 0; +} + +void +RethinkViewportOffsets(cv) +struct canvas *cv; +{ + struct viewport *vp; + + for (vp = cv->c_vplist; vp; vp = vp->v_next) + { + vp->v_xoff = cv->c_xoff; + vp->v_yoff = cv->c_yoff; + } +} + + diff --git a/src/viewport.h b/src/viewport.h new file mode 100644 index 0000000..a19b6b8 --- /dev/null +++ b/src/viewport.h @@ -0,0 +1,51 @@ +/* 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 + * http://www.gnu.org/licenses/, or contact Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA + * + **************************************************************** + * $Id$ GNU + */ + +#ifndef SCREEN_VIEWPORT_H +#define SCREEN_VIEWPORT_H + +#include "canvas.h" + +struct viewport +{ + struct viewport *v_next; /* next vp on canvas */ + struct canvas *v_canvas; /* back pointer to canvas */ + int v_xoff; /* layer x offset on display */ + int v_yoff; /* layer y offset on display */ + int v_xs; /* vp upper left */ + int v_xe; /* vp upper right */ + int v_ys; /* vp lower left */ + int v_ye; /* vp lower right */ +}; + +extern int RethinkDisplayViewports __P((void)); +extern void RethinkViewportOffsets __P((struct canvas *)); + +#endif /* SCREEN_VIEWPORT_H */ + @@ -1,11 +1,19 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,9 +22,9 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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 * **************************************************************** */ @@ -36,7 +44,7 @@ #include "logfile.h" /* logfopen() */ extern struct display *displays, *display; -extern struct win *windows, *fore, *wtab[], *console_window; +extern struct win *windows, *fore, *console_window; extern char *ShellArgs[]; extern char *ShellProg; extern char screenterm[]; @@ -50,7 +58,7 @@ extern char **NewEnv; extern int visual_bell, maxwin; extern struct event logflushev; extern int log_flush, logtstamp_after; -extern int ZombieKey_destroy, ZombieKey_resurrect; +extern int ZombieKey_destroy, ZombieKey_resurrect, ZombieKey_onerror; extern struct layer *flayer; extern int maxusercount; extern int pty_preopen; @@ -88,6 +96,7 @@ static void pseu_readev_fn __P((struct event *, char *)); static void pseu_writeev_fn __P((struct event *, char *)); #endif static void win_silenceev_fn __P((struct event *, char *)); +static void win_destroyev_fn __P((struct event *, char *)); static int OpenDevice __P((char **, int, int *, char **)); static int ForkWindow __P((struct win *, char **, char *)); @@ -98,6 +107,7 @@ static int zmodem_parse __P((struct win *, char *, int)); #endif +struct win **wtab; /* window table */ int VerboseCreate = 0; /* XXX move this to user.h */ @@ -202,7 +212,8 @@ struct LayFuncs WinLf = WinClearLine, WinRewrite, WinResize, - WinRestore + WinRestore, + 0 }; static int @@ -244,6 +255,12 @@ int *lenp; debug1("WinProcess: %d bytes\n", *lenp); fore = (struct win *)flayer->l_data; + if (fore->w_type == W_TYPE_GROUP) + { + *bufpp += *lenp; + *lenp = 0; + return; + } if (fore->w_ptyfd < 0) /* zombie? */ { ZombieProcess(bufpp, lenp); @@ -269,8 +286,7 @@ int *lenp; debug2("window %d, user %s: ", fore->w_number, D_user->u_name); debug2("writelock %d (wlockuser %s)\n", fore->w_wlock, fore->w_wlockuser ? fore->w_wlockuser->u_name : "NULL"); - /* XXX FIXME only display !*/ - WBell(fore, visual_bell); + Msg(0, "write: permission denied (user %s)", D_user->u_name); *bufpp += *lenp; *lenp = 0; return; @@ -466,7 +482,7 @@ WinRestore() { struct canvas *cv; fore = (struct win *)flayer->l_data; - debug1("WinRestore: win %x\n", fore); + debug1("WinRestore: win %p\n", fore); for (cv = flayer->l_cvlist; cv; cv = cv->c_next) { display = cv->c_display; @@ -542,6 +558,13 @@ struct NewWindow *newwin; extern struct acluser *users; #endif + if (!wtab) + { + if (!maxwin) + maxwin = MAXWIN; + wtab = calloc(maxwin, sizeof(struct win *)); + } + debug1("NewWindow: StartAt %d\n", newwin->StartAt); debug1("NewWindow: aka %s\n", newwin->aka?newwin->aka:"NULL"); debug1("NewWindow: dir %s\n", newwin->dir?newwin->dir:"NULL"); @@ -584,14 +607,15 @@ struct NewWindow *newwin; if ((f = OpenDevice(nwin.args, nwin.lflag, &type, &TtyName)) < 0) return -1; + if (type == W_TYPE_GROUP) + f = -1; - if ((p = (struct win *)malloc(sizeof(struct win))) == 0) + if ((p = (struct win *)calloc(1, sizeof(struct win))) == 0) { close(f); - Msg(0, strnomem); + Msg(0, "%s", strnomem); return -1; } - bzero((char *)p, (int)sizeof(struct win)); #ifdef UTMPOK if (type != W_TYPE_PTY) @@ -610,17 +634,22 @@ struct NewWindow *newwin; p->w_term = SaveStr(nwin.term); p->w_number = n; + p->w_group = 0; + if (fore && fore->w_type == W_TYPE_GROUP) + p->w_group = fore; + else if (fore && fore->w_group) + p->w_group = fore->w_group; #ifdef MULTIUSER /* * This is dangerous: without a display we use creators umask - * This is intended to be usefull for detached startup. + * This is intended to be useful for detached startup. * But is still better than default bits with a NULL user. */ if (NewWindowAcl(p, display ? D_user : users)) { free((char *)p); close(f); - Msg(0, strnomem); + Msg(0, "%s", strnomem); return -1; } #endif @@ -712,7 +741,7 @@ struct NewWindow *newwin; SetCharsets(p, nwin.charset); #endif - if (VerboseCreate) + if (VerboseCreate && type != W_TYPE_GROUP) { struct display *d = display; /* WriteString zaps display */ @@ -728,6 +757,7 @@ struct NewWindow *newwin; display = d; } + p->w_deadpid = 0; p->w_pid = 0; #ifdef PSEUDOS p->w_pwin = 0; @@ -762,6 +792,17 @@ struct NewWindow *newwin; *pp = p; p->w_next = windows; windows = p; + + if (type == W_TYPE_GROUP) + { + SetForeWindow(p); + Activate(p->w_norefresh); + WindowChanged((struct win*)0, 'w'); + WindowChanged((struct win*)0, 'W'); + WindowChanged((struct win*)0, 0); + return n; + } + p->w_lflag = nwin.lflag; #ifdef UTMPOK p->w_slot = (slot_t)-1; @@ -811,6 +852,9 @@ struct NewWindow *newwin; SetTimeout(&p->w_silenceev, p->w_silencewait * 1000); evenq(&p->w_silenceev); } + p->w_destroyev.type = EV_TIMEOUT; + p->w_destroyev.data = 0; + p->w_destroyev.handler = win_destroyev_fn; SetForeWindow(p); Activate(p->w_norefresh); @@ -837,6 +881,8 @@ struct win *p; if ((f = OpenDevice(p->w_cmdargs, lflag, &p->w_type, &TtyName)) < 0) return -1; + evdeq(&p->w_destroyev); /* no re-destroy of resurrected zombie */ + strncpy(p->w_tty, *TtyName ? TtyName : p->w_title, MAXSTR - 1); p->w_ptyfd = f; p->w_readev.fd = f; @@ -860,6 +906,7 @@ struct win *p; display = d; } + p->w_deadpid = 0; p->w_pid = 0; #ifdef BUILTIN_TELNET if (p->w_type == W_TYPE_TELNET) @@ -938,6 +985,14 @@ struct win *wp; logfclose(wp->w_log); ChangeWindowSize(wp, 0, 0, 0); + if (wp->w_type == W_TYPE_GROUP) + { + struct win *win; + for (win = windows; win; win = win->w_next) + if (win->w_group == wp) + win->w_group = wp->w_group; + } + if (wp->w_hstatus) free(wp->w_hstatus); for (i = 0; wp->w_cmdargs[i]; i++) @@ -981,6 +1036,7 @@ struct win *wp; wp->w_layer.l_cvlist = 0; if (flayer == &wp->w_layer) flayer = 0; + LayerCleanupMemory(&wp->w_layer); #ifdef MULTIUSER FreeWindowAcl(wp); @@ -988,6 +1044,7 @@ struct win *wp; evdeq(&wp->w_readev); /* just in case */ evdeq(&wp->w_writeev); /* just in case */ evdeq(&wp->w_silenceev); + evdeq(&wp->w_destroyev); #ifdef COPY_PASTE FreePaster(&wp->w_paster); #endif @@ -1007,6 +1064,12 @@ char **namep; if (!arg) return -1; + if (strcmp(arg, "//group") == 0) + { + *typep = W_TYPE_GROUP; + *namep = "telnet"; + return 0; + } #ifdef BUILTIN_TELNET if (strcmp(arg, "//telnet") == 0) { @@ -1017,7 +1080,12 @@ char **namep; } else #endif - if ((stat(arg, &st)) == 0 && S_ISCHR(st.st_mode)) + if (strncmp(arg, "//", 2) == 0) + { + Msg(0, "Invalid argument '%s'", arg); + return -1; + } + else if ((stat(arg, &st)) == 0 && S_ISCHR(st.st_mode)) { if (access(arg, R_OK | W_OK) == -1) { @@ -1117,7 +1185,7 @@ char **args, *ttyn; { int pid; char tebuf[25]; - char ebuf[10]; + char ebuf[20]; char shellbuf[7 + MAXPATHLEN]; char *proc; #ifndef TIOCSWINSZ @@ -1387,6 +1455,7 @@ char **args, *ttyn; return pid; } +#ifndef HAVE_EXECVPE void execvpe(prog, args, env) char *prog, **args, **env; @@ -1432,6 +1501,7 @@ char *prog, **args, **env; if (eaccess) errno = EACCES; } +#endif #ifdef PSEUDOS @@ -1460,12 +1530,11 @@ char **av; Msg(0, "You feel dead inside."); return -1; } - if (!(pwin = (struct pseudowin *)malloc(sizeof(struct pseudowin)))) + if (!(pwin = (struct pseudowin *)calloc(1, sizeof(struct pseudowin)))) { - Msg(0, strnomem); + Msg(0, "%s", strnomem); return -1; } - bzero((char *)pwin, (int)sizeof(*pwin)); /* allow ^a:!!./ttytest as a short form for ^a:exec !.. ./ttytest */ for (s = *av; *s == ' '; s++) @@ -1807,13 +1876,21 @@ char *data; return; #endif debug2("Window %d: read error (errno %d) - killing window\n", p->w_number, errno); - WindowDied(p); +#ifdef BSDWAIT + WindowDied(p, (union wait)0, 0); +#else + WindowDied(p, 0, 0); +#endif return; } if (len == 0) { debug1("Window %d: EOF - killing window\n", p->w_number); - WindowDied(p); +#ifdef BSDWAIT + WindowDied(p, (union wait)0, 0); +#else + WindowDied(p, 0, 0); +#endif return; } debug1(" -> %d bytes\n", len); @@ -1850,7 +1927,11 @@ char *data; p->w_pwin->p_inlen += len; } #endif + + LayPause(&p->w_layer, 1); WriteString(p, bp, len); + LayPause(&p->w_layer, 0); + return; } @@ -1990,9 +2071,20 @@ char *data; continue; #endif Msg(0, "Window %d: silence for %d seconds", p->w_number, p->w_silencewait); + p->w_silence = SILENCE_FOUND; + WindowChanged(p, 'f'); } } +static void +win_destroyev_fn(ev, data) +struct event *ev; +char *data; +{ + struct win *p = (struct win *)ev->data; + WindowDied(p, p->w_exitstatus, 1); +} + #ifdef ZMODEM static int @@ -2043,7 +2135,7 @@ int len; D_readev.condpos = D_readev.condneg = 0; while (len-- > 0) AddChar(*bp++); - Flush(); + Flush(0); Activate(D_fore ? D_fore->w_norefresh : 0); return 1; } @@ -2139,7 +2231,7 @@ int len; return; } flayer = &p->w_layer; - Input(":", 100, INP_COOKED, zmodem_fin, NULL); + Input(":", 100, INP_COOKED, zmodem_fin, NULL, 0); s = send ? zmodem_sendcmd : zmodem_recvcmd; n = strlen(s); LayProcess(&s, &n); @@ -2177,3 +2269,54 @@ struct display *d; } #endif + +int +WindowChangeNumber(struct win *win, int n) +{ + struct win *p; + int old = win->w_number; + + if (n < 0 || n >= maxwin) + { + Msg(0, "Given window position is invalid."); + return 0; + } + + p = wtab[n]; + wtab[n] = win; + win->w_number = n; + wtab[old] = p; + if (p) + p->w_number = old; +#ifdef MULTIUSER + /* exchange the acls for these windows. */ + AclWinSwap(old, n); +#endif +#ifdef UTMPOK + /* exchange the utmp-slots for these windows */ + if ((win->w_slot != (slot_t) -1) && (win->w_slot != (slot_t) 0)) + { + RemoveUtmp(win); + SetUtmp(win); + } + if (p && (p->w_slot != (slot_t) -1) && (p->w_slot != (slot_t) 0)) + { + /* XXX: first display wins? */ +#if 0 + /* Does this make more sense? */ + display = p->w_lastdisp ? p->w_lastdisp : p->w_layer.l_cvlist ? p->w_layer.l_cvlist->c_display : 0; +#else + display = win->w_layer.l_cvlist ? win->w_layer.l_cvlist->c_display : 0; +#endif + RemoveUtmp(p); + SetUtmp(p); + } +#endif + + WindowChanged(win, 'n'); + WindowChanged((struct win *)0, 'w'); + WindowChanged((struct win *)0, 'W'); + WindowChanged((struct win *)0, 0); + return 1; +} + @@ -1,11 +1,19 @@ -/* Copyright (c) 1993-2002 +/* 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 2, or (at your option) + * 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, @@ -14,14 +22,16 @@ * 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, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * 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: window.h,v 1.11 1994/05/31 12:33:27 mlschroe Exp $ FAU + * $Id$ GNU */ +#ifndef SCREEN_WINDOW_H +#define SCREEN_WINDOW_H /* keep this in sync with the initialisations in window.c */ struct NewWindow @@ -123,7 +133,7 @@ struct paster struct paster; #endif -struct win +struct win { struct win *w_next; /* next window */ int w_type; /* type of window */ @@ -150,6 +160,7 @@ struct win char *w_akachange; /* autoaka hack */ char w_akabuf[MAXSTR]; /* aka buffer */ int w_autoaka; /* autoaka hack */ + struct win *w_group; /* window group we belong to */ int w_intermediate; /* char used while parsing ESC-seq */ int w_args[MAXARGS]; /* emulator args */ int w_NumArgs; @@ -176,15 +187,17 @@ struct win int w_CharsetR; /* charset number GR */ int w_charsets[4]; /* Font = charsets[Charset] */ #endif - int w_ss; - int w_saved; - int w_Saved_x, w_Saved_y; - struct mchar w_SavedRend; + int w_ss; + struct cursor { + int on; + int x, y; + struct mchar Rend; #ifdef FONT - int w_SavedCharset; - int w_SavedCharsetR; - int w_SavedCharsets[4]; + int Charset; + int CharsetR; + int Charsets[4]; #endif + } w_saved; int w_top, w_bot; /* scrollregion */ int w_wrap; /* autowrap */ int w_origin; /* origin mode */ @@ -216,7 +229,7 @@ struct win int w_monitor; /* monitor status */ int w_silencewait; /* wait for silencewait secs */ int w_silence; /* silence status (Lloyd Zusman) */ - char w_vbwait; + char w_vbwait; char w_norefresh; /* dont redisplay when switching to that win */ #ifdef RXVT_OSC char w_xtermosc[4][MAXSTR]; /* special xterm/rxvt escapes */ @@ -235,7 +248,8 @@ struct win #else int w_histheight; /* always 0 */ #endif - int w_pid; /* process at the other end of ptyfd */ + int w_pid; /* process at the other end of ptyfd */ + int w_deadpid; /* saved w_pid of a process that closed the ptyfd to us */ char *w_cmdargs[MAXARGS]; /* command line argument vector */ char *w_dir; /* directory for chdir */ @@ -264,14 +278,26 @@ struct win int w_telsubidx; struct event w_telconnev; #endif - struct mline *w_alt_mlines; - int w_alt_width; - int w_alt_height; - int w_alt_histheight; - int w_alt_x, w_alt_y; + struct { + int on; /* Is the alternate buffer currently being used? */ + struct mline *mlines; + int width; + int height; #ifdef COPY_PASTE - struct mline *w_alt_hlines; - int w_alt_histidx; + int histheight; + struct mline *hlines; + int histidx; +#else + int histheight; /* 0 */ +#endif + struct cursor cursor; + } w_alt; + + struct event w_destroyev; /* window destroy event */ +#ifdef BSDWAIT + union wait w_exitstatus; /* window exit status */ +#else + int w_exitstatus; #endif }; @@ -286,6 +312,7 @@ struct win #define W_TYPE_PTY 0 #define W_TYPE_PLAIN 1 #define W_TYPE_TELNET 2 +#define W_TYPE_GROUP 3 /* @@ -315,3 +342,8 @@ struct win : &fore->w_mlines[y - fore->w_histheight]) #define Layer2Window(l) ((struct win *)(l)->l_bottom->l_data) + +int WindowChangeNumber __P((struct win *, int)); + +#endif /* SCREEN_WINDOW_H */ + diff --git a/term.h.dist b/term.h.dist deleted file mode 100644 index bbe9894..0000000 --- a/term.h.dist +++ /dev/null @@ -1,252 +0,0 @@ -/* - * This file is automagically created from term.c -- DO NOT EDIT - */ - -#define T_FLG 0 -#define T_NUM 1 -#define T_STR 2 - -struct term -{ - char *tcname; - int type; -}; - -union tcu -{ - int flg; - int num; - char *str; -}; - -#define d_LI d_tcs[0].num -#define D_LI (D_tcs[0].num) -#define d_CO d_tcs[1].num -#define D_CO (D_tcs[1].num) -#define d_HC d_tcs[2].flg -#define D_HC (D_tcs[2].flg) -#define d_OS d_tcs[3].flg -#define D_OS (D_tcs[3].flg) -#define d_NS d_tcs[4].flg -#define D_NS (D_tcs[4].flg) -#define d_CM d_tcs[5].str -#define D_CM (D_tcs[5].str) -#define d_HO d_tcs[6].str -#define D_HO (D_tcs[6].str) -#define d_CR d_tcs[7].str -#define D_CR (D_tcs[7].str) -#define d_UP d_tcs[8].str -#define D_UP (D_tcs[8].str) -#define d_CUP d_tcs[9].str -#define D_CUP (D_tcs[9].str) -#define d_DO d_tcs[10].str -#define D_DO (D_tcs[10].str) -#define d_CDO d_tcs[11].str -#define D_CDO (D_tcs[11].str) -#define d_BS d_tcs[12].flg -#define D_BS (D_tcs[12].flg) -#define d_BC d_tcs[13].str -#define D_BC (D_tcs[13].str) -#define d_LE d_tcs[14].str -#define D_LE (D_tcs[14].str) -#define d_CLE d_tcs[15].str -#define D_CLE (D_tcs[15].str) -#define d_ND d_tcs[16].str -#define D_ND (D_tcs[16].str) -#define d_CRI d_tcs[17].str -#define D_CRI (D_tcs[17].str) -#define d_CS d_tcs[18].str -#define D_CS (D_tcs[18].str) -#define d_NL d_tcs[19].str -#define D_NL (D_tcs[19].str) -#define d_SF d_tcs[20].str -#define D_SF (D_tcs[20].str) -#define d_SR d_tcs[21].str -#define D_SR (D_tcs[21].str) -#define d_AL d_tcs[22].str -#define D_AL (D_tcs[22].str) -#define d_CAL d_tcs[23].str -#define D_CAL (D_tcs[23].str) -#define d_DL d_tcs[24].str -#define D_DL (D_tcs[24].str) -#define d_CDL d_tcs[25].str -#define D_CDL (D_tcs[25].str) -#define d_IN d_tcs[26].flg -#define D_IN (D_tcs[26].flg) -#define d_IM d_tcs[27].str -#define D_IM (D_tcs[27].str) -#define d_EI d_tcs[28].str -#define D_EI (D_tcs[28].str) -#define d_IC d_tcs[29].str -#define D_IC (D_tcs[29].str) -#define d_CIC d_tcs[30].str -#define D_CIC (D_tcs[30].str) -#define d_DC d_tcs[31].str -#define D_DC (D_tcs[31].str) -#define d_CDC d_tcs[32].str -#define D_CDC (D_tcs[32].str) -#define d_UT d_tcs[33].flg -#define D_UT (D_tcs[33].flg) -#define d_CL d_tcs[34].str -#define D_CL (D_tcs[34].str) -#define d_CD d_tcs[35].str -#define D_CD (D_tcs[35].str) -#define d_CCD d_tcs[36].str -#define D_CCD (D_tcs[36].str) -#define d_CE d_tcs[37].str -#define D_CE (D_tcs[37].str) -#define d_CB d_tcs[38].str -#define D_CB (D_tcs[38].str) -#define d_IS d_tcs[39].str -#define D_IS (D_tcs[39].str) -#define d_TI d_tcs[40].str -#define D_TI (D_tcs[40].str) -#define d_TE d_tcs[41].str -#define D_TE (D_tcs[41].str) -#define d_BL d_tcs[42].str -#define D_BL (D_tcs[42].str) -#define d_VB d_tcs[43].str -#define D_VB (D_tcs[43].str) -#define d_CWS d_tcs[44].str -#define D_CWS (D_tcs[44].str) -#define d_CZ0 d_tcs[45].str -#define D_CZ0 (D_tcs[45].str) -#define d_CZ1 d_tcs[46].str -#define D_CZ1 (D_tcs[46].str) -#define T_ATTR 47 -#define d_MH d_tcs[47].str -#define D_MH (D_tcs[47].str) -#define d_US d_tcs[48].str -#define D_US (D_tcs[48].str) -#define d_MD d_tcs[49].str -#define D_MD (D_tcs[49].str) -#define d_MR d_tcs[50].str -#define D_MR (D_tcs[50].str) -#define d_SO d_tcs[51].str -#define D_SO (D_tcs[51].str) -#define d_MB d_tcs[52].str -#define D_MB (D_tcs[52].str) -#define d_UE d_tcs[53].str -#define D_UE (D_tcs[53].str) -#define d_SE d_tcs[54].str -#define D_SE (D_tcs[54].str) -#define d_ME d_tcs[55].str -#define D_ME (D_tcs[55].str) -#define d_MS d_tcs[56].flg -#define D_MS (D_tcs[56].flg) -#define d_SG d_tcs[57].num -#define D_SG (D_tcs[57].num) -#define d_UG d_tcs[58].num -#define D_UG (D_tcs[58].num) -#define d_SA d_tcs[59].str -#define D_SA (D_tcs[59].str) -#define d_CAF d_tcs[60].str -#define D_CAF (D_tcs[60].str) -#define d_CAB d_tcs[61].str -#define D_CAB (D_tcs[61].str) -#define d_CSF d_tcs[62].str -#define D_CSF (D_tcs[62].str) -#define d_CSB d_tcs[63].str -#define D_CSB (D_tcs[63].str) -#define d_OP d_tcs[64].str -#define D_OP (D_tcs[64].str) -#define d_CCO d_tcs[65].num -#define D_CCO (D_tcs[65].num) -#define d_BE d_tcs[66].flg -#define D_BE (D_tcs[66].flg) -#define d_CAX d_tcs[67].flg -#define D_CAX (D_tcs[67].flg) -#define d_CC8 d_tcs[68].flg -#define D_CC8 (D_tcs[68].flg) -#define d_KS d_tcs[69].str -#define D_KS (D_tcs[69].str) -#define d_KE d_tcs[70].str -#define D_KE (D_tcs[70].str) -#define d_CCS d_tcs[71].str -#define D_CCS (D_tcs[71].str) -#define d_CCE d_tcs[72].str -#define D_CCE (D_tcs[72].str) -#define d_PO d_tcs[73].str -#define D_PO (D_tcs[73].str) -#define d_PF d_tcs[74].str -#define D_PF (D_tcs[74].str) -#define d_HS d_tcs[75].flg -#define D_HS (D_tcs[75].flg) -#define d_WS d_tcs[76].num -#define D_WS (D_tcs[76].num) -#define d_TS d_tcs[77].str -#define D_TS (D_tcs[77].str) -#define d_FS d_tcs[78].str -#define D_FS (D_tcs[78].str) -#define d_DS d_tcs[79].str -#define D_DS (D_tcs[79].str) -#define d_VI d_tcs[80].str -#define D_VI (D_tcs[80].str) -#define d_VS d_tcs[81].str -#define D_VS (D_tcs[81].str) -#define d_VE d_tcs[82].str -#define D_VE (D_tcs[82].str) -#define d_AM d_tcs[83].flg -#define D_AM (D_tcs[83].flg) -#define d_XV d_tcs[84].flg -#define D_XV (D_tcs[84].flg) -#define d_XN d_tcs[85].flg -#define D_XN (D_tcs[85].flg) -#define d_COP d_tcs[86].flg -#define D_COP (D_tcs[86].flg) -#define d_CLP d_tcs[87].flg -#define D_CLP (D_tcs[87].flg) -#define d_CNF d_tcs[88].flg -#define D_CNF (D_tcs[88].flg) -#define d_NX d_tcs[89].flg -#define D_NX (D_tcs[89].flg) -#define d_CAN d_tcs[90].flg -#define D_CAN (D_tcs[90].flg) -#define d_COL d_tcs[91].num -#define D_COL (D_tcs[91].num) -#define d_CKJ d_tcs[92].str -#define D_CKJ (D_tcs[92].str) -#define d_CVR d_tcs[93].str -#define D_CVR (D_tcs[93].str) -#define d_CVN d_tcs[94].str -#define D_CVN (D_tcs[94].str) -#define d_CTF d_tcs[95].flg -#define D_CTF (D_tcs[95].flg) -#define d_CXT d_tcs[96].flg -#define D_CXT (D_tcs[96].flg) -#define d_CG0 d_tcs[97].flg -#define D_CG0 (D_tcs[97].flg) -#define d_CS0 d_tcs[98].str -#define D_CS0 (D_tcs[98].str) -#define d_CE0 d_tcs[99].str -#define D_CE0 (D_tcs[99].str) -#define d_CC0 d_tcs[100].str -#define D_CC0 (D_tcs[100].str) -#define d_AS d_tcs[101].str -#define D_AS (D_tcs[101].str) -#define d_AE d_tcs[102].str -#define D_AE (D_tcs[102].str) -#define d_AC d_tcs[103].str -#define D_AC (D_tcs[103].str) -#define d_EA d_tcs[104].str -#define D_EA (D_tcs[104].str) -#define d_CXC d_tcs[105].str -#define D_CXC (D_tcs[105].str) -#define T_CAPS 106 -#define T_BACKTAB 135 -#define T_NAVIGATE 153 -#define T_NAVIGATE_DELETE 160 -#define T_CURSOR 161 -#define T_KEYPAD 165 -#define T_OCAPS 183 -#define T_ECAPS 196 -#define T_N 196 - -#ifdef MAPKEYS -# define KMAPDEFSTART 106 -# define NKMAPDEF 77 -# define KMAPADEFSTART 161 -# define NKMAPADEF 22 -# define KMAPMDEFSTART 138 -# define NKMAPMDEF 27 -#endif diff --git a/tty.c.dist b/tty.c.dist deleted file mode 100644 index 688cf62..0000000 --- a/tty.c.dist +++ /dev/null @@ -1,1887 +0,0 @@ -/* Copyright (c) 1993-2002 - * 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 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program (see the file COPYING); if not, write to the - * Free Software Foundation, Inc., - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - * - **************************************************************** - */ - -/* - * NOTICE: tty.c is automatically generated from tty.sh - * Do not change anything here. If you then change tty.sh. - */ - -#include <sys/types.h> -#include <signal.h> -#include <fcntl.h> -#ifndef sgi -# include <sys/file.h> -#endif -#if !defined(sun) || defined(SUNOS3) -# include <sys/ioctl.h> /* collosions with termios.h */ -#else -# ifndef TIOCEXCL -# include <sys/ttold.h> /* needed for TIOCEXCL */ -# endif -#endif -#ifdef __hpux -# include <sys/modem.h> -#endif - -#ifdef ISC -# include <sys/tty.h> -# include <sys/sioctl.h> -# include <sys/pty.h> -#endif - -#include "config.h" -#ifdef SVR4 -#include <sys/stropts.h> /* for I_POP */ -#endif - -#include "screen.h" -#include "extern.h" - -#if !defined(TIOCCONS) && defined(sun) && defined(SVR4) -# include <sys/strredir.h> -#endif - -extern struct display *display, *displays; -extern int iflag; -#if (!defined(TIOCCONS) && defined(SRIOCSREDIR)) || defined(linux) -extern struct win *console_window; -static void consredir_readev_fn __P((struct event *, char *)); -#endif - -int separate_sids = 1; - -static void DoSendBreak __P((int, int, int)); -static sigret_t SigAlrmDummy __P(SIGPROTOARG); - - -/* Frank Schulz (fschulz@pyramid.com): - * I have no idea why VSTART is not defined and my fix is probably not - * the cleanest, but it works. - */ -#if !defined(VSTART) && defined(_VSTART) -#define VSTART _VSTART -#endif -#if !defined(VSTOP) && defined(_VSTOP) -#define VSTOP _VSTOP -#endif - -#ifndef O_NOCTTY -# define O_NOCTTY 0 -#endif - -#ifndef TTYVMIN -# define TTYVMIN 1 -#endif -#ifndef TTYVTIME -#define TTYVTIME 0 -#endif - - -static sigret_t -SigAlrmDummy SIGDEFARG -{ - debug("SigAlrmDummy()\n"); - SIGRETURN; -} - -/* - * Carefully open a charcter device. Not used to open display ttys. - * The second parameter is parsed for a few stty style options. - */ - -int -OpenTTY(line, opt) -char *line, *opt; -{ - int f; - struct mode Mode; - sigret_t (*sigalrm)__P(SIGPROTOARG); - - sigalrm = signal(SIGALRM, SigAlrmDummy); - alarm(2); - - /* this open only succeeds, if real uid is allowed */ - if ((f = secopen(line, O_RDWR | O_NONBLOCK | O_NOCTTY, 0)) == -1) - { - if (errno == EINTR) - Msg(0, "Cannot open line '%s' for R/W: open() blocked, aborted.", line); - else - Msg(errno, "Cannot open line '%s' for R/W", line); - alarm(0); - signal(SIGALRM, sigalrm); - return -1; - } - if (!isatty(f)) - { - Msg(0, "'%s' is not a tty", line); - alarm(0); - signal(SIGALRM, sigalrm); - close(f); - return -1; - } -#if defined(I_POP) && defined(POP_TTYMODULES) - debug("OpenTTY I_POP\n"); - while (ioctl(f, I_POP, (char *)0) >= 0) - ; -#endif - /* - * We come here exclusively. This is to stop all kermit and cu type things - * accessing the same tty line. - * Perhaps we should better create a lock in some /usr/spool/locks directory? - */ -#ifdef TIOCEXCL - errno = 0; - if (ioctl(f, TIOCEXCL, (char *) 0) < 0) - Msg(errno, "%s: ioctl TIOCEXCL failed", line); - debug3("%d %d %d\n", getuid(), geteuid(), getpid()); - debug2("%s TIOCEXCL errno %d\n", line, errno); -#endif /* TIOCEXCL */ - /* - * We create a sane tty mode. We do not copy things from the display tty - */ -#if WE_REALLY_WANT_TO_COPY_THE_TTY_MODE - if (display) - { - debug1("OpenTTY: using mode of display for %s\n", line); - Mode = D_NewMode; - } - else -#endif - InitTTY(&Mode, W_TYPE_PLAIN); - - SttyMode(&Mode, opt); -#ifdef DEBUG - DebugTTY(&Mode); -#endif - SetTTY(f, &Mode); - -#if defined(linux) && defined(TIOCMSET) - { - int mcs = 0; - ioctl(f, TIOCMGET, &mcs); - mcs |= TIOCM_RTS; - ioctl(f, TIOCMSET, &mcs); - } -#endif - - brktty(f); - alarm(0); - signal(SIGALRM, sigalrm); - debug2("'%s' CONNECT fd=%d.\n", line, f); - return f; -} - - -/* - * Tty mode handling - */ - -void -InitTTY(m, ttyflag) -struct mode *m; -int ttyflag; -{ - bzero((char *)m, sizeof(*m)); -#ifdef POSIX - /* struct termios tio - * defaults, as seen on SunOS 4.1.3 - */ - debug1("InitTTY: POSIX: termios defaults based on SunOS 4.1.3, but better (%d)\n", ttyflag); -#if defined(BRKINT) - m->tio.c_iflag |= BRKINT; -#endif /* BRKINT */ -#if defined(IGNPAR) - m->tio.c_iflag |= IGNPAR; -#endif /* IGNPAR */ -/* IF{ISTRIP} m->tio.c_iflag |= ISTRIP; may be needed, let's try. jw. */ -#if defined(IXON) - m->tio.c_iflag |= IXON; -#endif /* IXON */ -/* IF{IMAXBEL} m->tio.c_iflag |= IMAXBEL; sorry, this one is ridiculus. jw */ - - if (!ttyflag) /* may not even be good for ptys.. */ - { -#if defined(ICRNL) - m->tio.c_iflag |= ICRNL; -#endif /* ICRNL */ -#if defined(ONLCR) - m->tio.c_oflag |= ONLCR; -#endif /* ONLCR */ -#if defined(TAB3) - m->tio.c_oflag |= TAB3; -#endif /* TAB3 */ -#if defined(OXTABS) - m->tio.c_oflag |= OXTABS; -#endif /* OXTABS */ -/* IF{PARENB} m->tio.c_cflag |= PARENB; nah! jw. */ -#if defined(OPOST) - m->tio.c_oflag |= OPOST; -#endif /* OPOST */ - } - - -/* - * Or-ing the speed into c_cflags is dangerous. - * It breaks on bsdi, where c_ispeed and c_ospeed are extra longs. - * - * IF{B9600} m->tio.c_cflag |= B9600; - * IF{IBSHIFT) && defined(B9600} m->tio.c_cflag |= B9600 << IBSHIFT; - * - * We hope that we have the posix calls to do it right: - * If these are not available you might try the above. - */ -#if defined(B9600) - cfsetospeed(&m->tio, B9600); -#endif /* B9600 */ -#if defined(B9600) - cfsetispeed(&m->tio, B9600); -#endif /* B9600 */ - -#if defined(CS8) - m->tio.c_cflag |= CS8; -#endif /* CS8 */ -#if defined(CREAD) - m->tio.c_cflag |= CREAD; -#endif /* CREAD */ -#if defined(CLOCAL) - m->tio.c_cflag |= CLOCAL; -#endif /* CLOCAL */ - -#if defined(ECHOCTL) - m->tio.c_lflag |= ECHOCTL; -#endif /* ECHOCTL */ -#if defined(ECHOKE) - m->tio.c_lflag |= ECHOKE; -#endif /* ECHOKE */ - - if (!ttyflag) - { -#if defined(ISIG) - m->tio.c_lflag |= ISIG; -#endif /* ISIG */ -#if defined(ICANON) - m->tio.c_lflag |= ICANON; -#endif /* ICANON */ -#if defined(ECHO) - m->tio.c_lflag |= ECHO; -#endif /* ECHO */ - } -#if defined(ECHOE) - m->tio.c_lflag |= ECHOE; -#endif /* ECHOE */ -#if defined(ECHOK) - m->tio.c_lflag |= ECHOK; -#endif /* ECHOK */ -#if defined(IEXTEN) - m->tio.c_lflag |= IEXTEN; -#endif /* IEXTEN */ - -#if defined(VINTR) -#if (VINTR < MAXCC) - m->tio.c_cc[VINTR] = Ctrl('C'); -#endif -#endif /* VINTR */ -#if defined(VQUIT) -#if (VQUIT < MAXCC) - m->tio.c_cc[VQUIT] = Ctrl('\\'); -#endif -#endif /* VQUIT */ -#if defined(VERASE) -#if (VERASE < MAXCC) - m->tio.c_cc[VERASE] = 0x7f; /* DEL */ -#endif -#endif /* VERASE */ -#if defined(VKILL) -#if (VKILL < MAXCC) - m->tio.c_cc[VKILL] = Ctrl('H'); -#endif -#endif /* VKILL */ -#if defined(VEOF) -#if (VEOF < MAXCC) - m->tio.c_cc[VEOF] = Ctrl('D'); -#endif -#endif /* VEOF */ -#if defined(VEOL) -#if (VEOL < MAXCC) - m->tio.c_cc[VEOL] = 0000; -#endif -#endif /* VEOL */ -#if defined(VEOL2) -#if (VEOL2 < MAXCC) - m->tio.c_cc[VEOL2] = 0000; -#endif -#endif /* VEOL2 */ -#if defined(VSWTCH) -#if (VSWTCH < MAXCC) - m->tio.c_cc[VSWTCH] = 0000; -#endif -#endif /* VSWTCH */ -#if defined(VSTART) -#if (VSTART < MAXCC) - m->tio.c_cc[VSTART] = Ctrl('Q'); -#endif -#endif /* VSTART */ -#if defined(VSTOP) -#if (VSTOP < MAXCC) - m->tio.c_cc[VSTOP] = Ctrl('S'); -#endif -#endif /* VSTOP */ -#if defined(VSUSP) -#if (VSUSP < MAXCC) - m->tio.c_cc[VSUSP] = Ctrl('Z'); -#endif -#endif /* VSUSP */ -#if defined(VDSUSP) -#if (VDSUSP < MAXCC) - m->tio.c_cc[VDSUSP] = Ctrl('Y'); -#endif -#endif /* VDSUSP */ -#if defined(VREPRINT) -#if (VREPRINT < MAXCC) - m->tio.c_cc[VREPRINT] = Ctrl('R'); -#endif -#endif /* VREPRINT */ -#if defined(VDISCARD) -#if (VDISCARD < MAXCC) - m->tio.c_cc[VDISCARD] = Ctrl('O'); -#endif -#endif /* VDISCARD */ -#if defined(VWERASE) -#if (VWERASE < MAXCC) - m->tio.c_cc[VWERASE] = Ctrl('W'); -#endif -#endif /* VWERASE */ -#if defined(VLNEXT) -#if (VLNEXT < MAXCC) - m->tio.c_cc[VLNEXT] = Ctrl('V'); -#endif -#endif /* VLNEXT */ -#if defined(VSTATUS) -#if (VSTATUS < MAXCC) - m->tio.c_cc[VSTATUS] = Ctrl('T'); -#endif -#endif /* VSTATUS */ - - if (ttyflag) - { - m->tio.c_cc[VMIN] = TTYVMIN; - m->tio.c_cc[VTIME] = TTYVTIME; - } - -# ifdef HPUX_LTCHARS_HACK - m->m_ltchars.t_suspc = Ctrl('Z'); - m->m_ltchars.t_dsuspc = Ctrl('Y'); - m->m_ltchars.t_rprntc = Ctrl('R'); - m->m_ltchars.t_flushc = Ctrl('O'); - m->m_ltchars.t_werasc = Ctrl('W'); - m->m_ltchars.t_lnextc = Ctrl('V'); -# endif /* HPUX_LTCHARS_HACK */ - -#else /* POSIX */ - -# ifdef TERMIO - debug1("InitTTY: nonPOSIX, struct termio a la Motorola SYSV68 (%d)\n", ttyflag); - /* struct termio tio - * defaults, as seen on Mototola SYSV68: - * input: 7bit, CR->NL, ^S/^Q flow control - * output: POSTprocessing: NL->NL-CR, Tabs to spaces - * control: 9600baud, 8bit CSIZE, enable input - * local: enable signals, erase/kill processing, echo on. - */ -#if defined(ISTRIP) - m->tio.c_iflag |= ISTRIP; -#endif /* ISTRIP */ -#if defined(IXON) - m->tio.c_iflag |= IXON; -#endif /* IXON */ - - if (!ttyflag) /* may not even be good for ptys.. */ - { -#if defined(OPOST) - m->tio.c_oflag |= OPOST; -#endif /* OPOST */ -#if defined(ICRNL) - m->tio.c_iflag |= ICRNL; -#endif /* ICRNL */ -#if defined(ONLCR) - m->tio.c_oflag |= ONLCR; -#endif /* ONLCR */ -#if defined(TAB3) - m->tio.c_oflag |= TAB3; -#endif /* TAB3 */ - } - -#ifdef __bsdi__ - )-: cannot handle BSDI without POSIX -#else -#if defined(B9600) - m->tio.c_cflag = B9600; -#endif /* B9600 */ -#endif -#if defined(CS8) - m->tio.c_cflag |= CS8; -#endif /* CS8 */ -#if defined(CREAD) - m->tio.c_cflag |= CREAD; -#endif /* CREAD */ - - if (!ttyflag) - { -#if defined(ISIG) - m->tio.c_lflag |= ISIG; -#endif /* ISIG */ -#if defined(ICANON) - m->tio.c_lflag |= ICANON; -#endif /* ICANON */ -#if defined(ECHO) - m->tio.c_lflag |= ECHO; -#endif /* ECHO */ - } -#if defined(ECHOE) - m->tio.c_lflag |= ECHOE; -#endif /* ECHOE */ -#if defined(ECHOK) - m->tio.c_lflag |= ECHOK; -#endif /* ECHOK */ - -#if defined(VINTR) -#if (VINTR < MAXCC) - m->tio.c_cc[VINTR] = Ctrl('C'); -#endif -#endif /* VINTR */ -#if defined(VQUIT) -#if (VQUIT < MAXCC) - m->tio.c_cc[VQUIT] = Ctrl('\\'); -#endif -#endif /* VQUIT */ -#if defined(VERASE) -#if (VERASE < MAXCC) - m->tio.c_cc[VERASE] = 0177; /* DEL */ -#endif -#endif /* VERASE */ -#if defined(VKILL) -#if (VKILL < MAXCC) - m->tio.c_cc[VKILL] = Ctrl('H'); -#endif -#endif /* VKILL */ -#if defined(VEOF) -#if (VEOF < MAXCC) - m->tio.c_cc[VEOF] = Ctrl('D'); -#endif -#endif /* VEOF */ -#if defined(VEOL) -#if (VEOL < MAXCC) - m->tio.c_cc[VEOL] = 0377; -#endif -#endif /* VEOL */ -#if defined(VEOL2) -#if (VEOL2 < MAXCC) - m->tio.c_cc[VEOL2] = 0377; -#endif -#endif /* VEOL2 */ -#if defined(VSWTCH) -#if (VSWTCH < MAXCC) - m->tio.c_cc[VSWTCH] = 0000; -#endif -#endif /* VSWTCH */ - - if (ttyflag) - { - m->tio.c_cc[VMIN] = TTYVMIN; - m->tio.c_cc[VTIME] = TTYVTIME; - } - -# else /* TERMIO */ - debug1("InitTTY: BSD: defaults a la SunOS 4.1.3 (%d)\n", ttyflag); - m->m_ttyb.sg_ispeed = B9600; - m->m_ttyb.sg_ospeed = B9600; - m->m_ttyb.sg_erase = 0177; /*DEL */ - m->m_ttyb.sg_kill = Ctrl('H'); - if (!ttyflag) - m->m_ttyb.sg_flags = CRMOD | ECHO -#if defined(ANYP) - | ANYP -#endif /* ANYP */ - ; - else - m->m_ttyb.sg_flags = CBREAK -#if defined(ANYP) - | ANYP -#endif /* ANYP */ - ; - - m->m_tchars.t_intrc = Ctrl('C'); - m->m_tchars.t_quitc = Ctrl('\\'); - m->m_tchars.t_startc = Ctrl('Q'); - m->m_tchars.t_stopc = Ctrl('S'); - m->m_tchars.t_eofc = Ctrl('D'); - m->m_tchars.t_brkc = -1; - - m->m_ltchars.t_suspc = Ctrl('Z'); - m->m_ltchars.t_dsuspc = Ctrl('Y'); - m->m_ltchars.t_rprntc = Ctrl('R'); - m->m_ltchars.t_flushc = Ctrl('O'); - m->m_ltchars.t_werasc = Ctrl('W'); - m->m_ltchars.t_lnextc = Ctrl('V'); - -#if defined(NTTYDISC) - m->m_ldisc = NTTYDISC; -#endif /* NTTYDISC */ - - m->m_lmode = 0 -#if defined(LDECCTQ) - | LDECCTQ -#endif /* LDECCTQ */ -#if defined(LCTLECH) - | LCTLECH -#endif /* LCTLECH */ -#if defined(LPASS8) - | LPASS8 -#endif /* LPASS8 */ -#if defined(LCRTKIL) - | LCRTKIL -#endif /* LCRTKIL */ -#if defined(LCRTERA) - | LCRTERA -#endif /* LCRTERA */ -#if defined(LCRTBS) - | LCRTBS -#endif /* LCRTBS */ - ; -# endif /* TERMIO */ -#endif /* POSIX */ - -#if defined(ENCODINGS) && defined(TIOCKSET) - m->m_jtchars.t_ascii = 'J'; - m->m_jtchars.t_kanji = 'B'; - m->m_knjmode = KM_ASCII | KM_SYSSJIS; -#endif -} - -void -SetTTY(fd, mp) -int fd; -struct mode *mp; -{ - errno = 0; -#ifdef POSIX - tcsetattr(fd, TCSADRAIN, &mp->tio); -# ifdef HPUX_LTCHARS_HACK - ioctl(fd, TIOCSLTC, (char *)&mp->m_ltchars); -# endif -#else -# ifdef TERMIO - ioctl(fd, TCSETAW, (char *)&mp->tio); -# ifdef CYTERMIO - if (mp->tio.c_line == 3) - { - ioctl(fd, LDSETMAPKEY, (char *)&mp->m_mapkey); - ioctl(fd, LDSETMAPSCREEN, (char *)&mp->m_mapscreen); - ioctl(fd, LDSETBACKSPACE, (char *)&mp->m_backspace); - } -# endif -# else - /* ioctl(fd, TIOCSETP, (char *)&mp->m_ttyb); */ - ioctl(fd, TIOCSETC, (char *)&mp->m_tchars); - ioctl(fd, TIOCLSET, (char *)&mp->m_lmode); - ioctl(fd, TIOCSETD, (char *)&mp->m_ldisc); - ioctl(fd, TIOCSETP, (char *)&mp->m_ttyb); - ioctl(fd, TIOCSLTC, (char *)&mp->m_ltchars); /* moved here for apollo. jw */ -# endif -#endif -#if defined(ENCODINGS) && defined(TIOCKSET) - ioctl(fd, TIOCKSETC, &mp->m_jtchars); - ioctl(fd, TIOCKSET, &mp->m_knjmode); -#endif - if (errno) - Msg(errno, "SetTTY (fd %d): ioctl failed", fd); -} - -void -GetTTY(fd, mp) -int fd; -struct mode *mp; -{ - errno = 0; -#ifdef POSIX - tcgetattr(fd, &mp->tio); -# ifdef HPUX_LTCHARS_HACK - ioctl(fd, TIOCGLTC, (char *)&mp->m_ltchars); -# endif -#else -# ifdef TERMIO - ioctl(fd, TCGETA, (char *)&mp->tio); -# ifdef CYTERMIO - if (mp->tio.c_line == 3) - { - ioctl(fd, LDGETMAPKEY, (char *)&mp->m_mapkey); - ioctl(fd, LDGETMAPSCREEN, (char *)&mp->m_mapscreen); - ioctl(fd, LDGETBACKSPACE, (char *)&mp->m_backspace); - } - else - { - mp->m_mapkey = NOMAPKEY; - mp->m_mapscreen = NOMAPSCREEN; - mp->m_backspace = '\b'; - } -# endif -# else - ioctl(fd, TIOCGETP, (char *)&mp->m_ttyb); - ioctl(fd, TIOCGETC, (char *)&mp->m_tchars); - ioctl(fd, TIOCGLTC, (char *)&mp->m_ltchars); - ioctl(fd, TIOCLGET, (char *)&mp->m_lmode); - ioctl(fd, TIOCGETD, (char *)&mp->m_ldisc); -# endif -#endif -#if defined(ENCODINGS) && defined(TIOCKSET) - ioctl(fd, TIOCKGETC, &mp->m_jtchars); - ioctl(fd, TIOCKGET, &mp->m_knjmode); -#endif - if (errno) - Msg(errno, "GetTTY (fd %d): ioctl failed", fd); -} - -/* - * needs interrupt = iflag and flow = d->d_flow - */ -void -SetMode(op, np, flow, interrupt) -struct mode *op, *np; -int flow, interrupt; -{ - *np = *op; - - ASSERT(display); -#if defined(TERMIO) || defined(POSIX) -# ifdef CYTERMIO - np->m_mapkey = NOMAPKEY; - np->m_mapscreen = NOMAPSCREEN; - np->tio.c_line = 0; -# endif -#if defined(ICRNL) - np->tio.c_iflag &= ~ICRNL; -#endif /* ICRNL */ -#if defined(ISTRIP) - np->tio.c_iflag &= ~ISTRIP; -#endif /* ISTRIP */ -#if defined(ONLCR) - np->tio.c_oflag &= ~ONLCR; -#endif /* ONLCR */ - np->tio.c_lflag &= ~(ICANON | ECHO); - /* - * From Andrew Myers (andru@tonic.lcs.mit.edu) - * to avoid ^V^V-Problem on OSF1 - */ -#if defined(IEXTEN) - np->tio.c_lflag &= ~IEXTEN; -#endif /* IEXTEN */ - - /* - * Unfortunately, the master process never will get SIGINT if the real - * terminal is different from the one on which it was originaly started - * (process group membership has not been restored or the new tty could not - * be made controlling again). In my solution, it is the attacher who - * receives SIGINT (because it is always correctly associated with the real - * tty) and forwards it to the master [kill(MasterPid, SIGINT)]. - * Marc Boucher (marc@CAM.ORG) - */ - if (interrupt) - np->tio.c_lflag |= ISIG; - else - np->tio.c_lflag &= ~ISIG; - /* - * careful, careful catche monkey.. - * never set VMIN and VTIME to zero, if you want blocking io. - * - * We may want to do a VMIN > 0, VTIME > 0 read on the ptys too, to - * reduce interrupt frequency. But then we would not know how to - * handle read returning 0. jw. - */ - np->tio.c_cc[VMIN] = 1; - np->tio.c_cc[VTIME] = 0; - if (!interrupt || !flow) - np->tio.c_cc[VINTR] = VDISABLE; - np->tio.c_cc[VQUIT] = VDISABLE; - if (flow == 0) - { -#if defined(VSTART) -#if (VSTART < MAXCC) - np->tio.c_cc[VSTART] = VDISABLE; -#endif -#endif /* VSTART */ -#if defined(VSTOP) -#if (VSTOP < MAXCC) - np->tio.c_cc[VSTOP] = VDISABLE; -#endif -#endif /* VSTOP */ - np->tio.c_iflag &= ~IXON; - } -#if defined(VDISCARD) -#if (VDISCARD < MAXCC) - np->tio.c_cc[VDISCARD] = VDISABLE; -#endif -#endif /* VDISCARD */ -#if defined(VLNEXT) -#if (VLNEXT < MAXCC) - np->tio.c_cc[VLNEXT] = VDISABLE; -#endif -#endif /* VLNEXT */ -#if defined(VSTATUS) -#if (VSTATUS < MAXCC) - np->tio.c_cc[VSTATUS] = VDISABLE; -#endif -#endif /* VSTATUS */ -#if defined(VSUSP) -#if (VSUSP < MAXCC) - np->tio.c_cc[VSUSP] = VDISABLE; -#endif -#endif /* VSUSP */ -#if defined(VERASE) -#if (VERASE < MAXCC) - np->tio.c_cc[VERASE] = VDISABLE; -#endif -#endif /* VERASE */ -#if defined(VKILL) -#if (VKILL < MAXCC) - np->tio.c_cc[VKILL] = VDISABLE; -#endif -#endif /* VKILL */ -# ifdef HPUX_LTCHARS_HACK - np->m_ltchars.t_suspc = VDISABLE; - np->m_ltchars.t_dsuspc = VDISABLE; - np->m_ltchars.t_rprntc = VDISABLE; - np->m_ltchars.t_flushc = VDISABLE; - np->m_ltchars.t_werasc = VDISABLE; - np->m_ltchars.t_lnextc = VDISABLE; -# else /* HPUX_LTCHARS_HACK */ -#if defined(VDSUSP) -#if (VDSUSP < MAXCC) - np->tio.c_cc[VDSUSP] = VDISABLE; -#endif -#endif /* VDSUSP */ -#if defined(VREPRINT) -#if (VREPRINT < MAXCC) - np->tio.c_cc[VREPRINT] = VDISABLE; -#endif -#endif /* VREPRINT */ -#if defined(VWERASE) -#if (VWERASE < MAXCC) - np->tio.c_cc[VWERASE] = VDISABLE; -#endif -#endif /* VWERASE */ -# endif /* HPUX_LTCHARS_HACK */ -#else /* TERMIO || POSIX */ - if (!interrupt || !flow) - np->m_tchars.t_intrc = -1; - np->m_ttyb.sg_flags &= ~(CRMOD | ECHO); - np->m_ttyb.sg_flags |= CBREAK; -# if defined(CYRILL) && defined(CSTYLE) && defined(CS_8BITS) - np->m_ttyb.sg_flags &= ~CSTYLE; - np->m_ttyb.sg_flags |= CS_8BITS; -# endif - np->m_tchars.t_quitc = -1; - if (flow == 0) - { - np->m_tchars.t_startc = -1; - np->m_tchars.t_stopc = -1; - } - np->m_ltchars.t_suspc = -1; - np->m_ltchars.t_dsuspc = -1; - np->m_ltchars.t_flushc = -1; - np->m_ltchars.t_lnextc = -1; -#endif /* defined(TERMIO) || defined(POSIX) */ -} - -/* operates on display */ -void -SetFlow(on) -int on; -{ - ASSERT(display); - if (D_flow == on) - return; -#if defined(TERMIO) || defined(POSIX) - if (on) - { - D_NewMode.tio.c_cc[VINTR] = iflag ? D_OldMode.tio.c_cc[VINTR] : VDISABLE; -#if defined(VSTART) -#if (VSTART < MAXCC) - D_NewMode.tio.c_cc[VSTART] = D_OldMode.tio.c_cc[VSTART]; -#endif -#endif /* VSTART */ -#if defined(VSTOP) -#if (VSTOP < MAXCC) - D_NewMode.tio.c_cc[VSTOP] = D_OldMode.tio.c_cc[VSTOP]; -#endif -#endif /* VSTOP */ - D_NewMode.tio.c_iflag |= D_OldMode.tio.c_iflag & IXON; - } - else - { - D_NewMode.tio.c_cc[VINTR] = VDISABLE; -#if defined(VSTART) -#if (VSTART < MAXCC) - D_NewMode.tio.c_cc[VSTART] = VDISABLE; -#endif -#endif /* VSTART */ -#if defined(VSTOP) -#if (VSTOP < MAXCC) - D_NewMode.tio.c_cc[VSTOP] = VDISABLE; -#endif -#endif /* VSTOP */ - D_NewMode.tio.c_iflag &= ~IXON; - } -# ifdef POSIX - if (tcsetattr(D_userfd, TCSANOW, &D_NewMode.tio)) -# else - if (ioctl(D_userfd, TCSETAW, (char *)&D_NewMode.tio) != 0) -# endif - debug1("SetFlow: ioctl errno %d\n", errno); -#else /* POSIX || TERMIO */ - if (on) - { - D_NewMode.m_tchars.t_intrc = iflag ? D_OldMode.m_tchars.t_intrc : -1; - D_NewMode.m_tchars.t_startc = D_OldMode.m_tchars.t_startc; - D_NewMode.m_tchars.t_stopc = D_OldMode.m_tchars.t_stopc; - } - else - { - D_NewMode.m_tchars.t_intrc = -1; - D_NewMode.m_tchars.t_startc = -1; - D_NewMode.m_tchars.t_stopc = -1; - } - if (ioctl(D_userfd, TIOCSETC, (char *)&D_NewMode.m_tchars) != 0) - debug1("SetFlow: ioctl errno %d\n", errno); -#endif /* POSIX || TERMIO */ - D_flow = on; -} - -/* parse commands from opt and modify m */ -int -SttyMode(m, opt) -struct mode *m; -char *opt; -{ - static const char sep[] = " \t:;,"; - - if (!opt) - return 0; - - while (*opt) - { - while (index(sep, *opt)) opt++; - if (*opt >= '0' && *opt <= '9') - { - if (SetBaud(m, atoi(opt), atoi(opt))) - return -1; - } - else if (!strncmp("cs7", opt, 3)) - { -#if defined(POSIX) || defined(TERMIO) - m->tio.c_cflag &= ~CSIZE; - m->tio.c_cflag |= CS7; -#else - m->m_lmode &= ~LPASS8; -#endif - } - else if (!strncmp("cs8", opt, 3)) - { -#if defined(POSIX) || defined(TERMIO) - m->tio.c_cflag &= ~CSIZE; - m->tio.c_cflag |= CS8; -#else - m->m_lmode |= LPASS8; -#endif - } - else if (!strncmp("istrip", opt, 6)) - { -#if defined(POSIX) || defined(TERMIO) - m->tio.c_iflag |= ISTRIP; -#else - m->m_lmode &= ~LPASS8; -#endif - } - else if (!strncmp("-istrip", opt, 7)) - { -#if defined(POSIX) || defined(TERMIO) - m->tio.c_iflag &= ~ISTRIP; -#else - m->m_lmode |= LPASS8; -#endif - } - else if (!strncmp("ixon", opt, 4)) - { -#if defined(POSIX) || defined(TERMIO) - m->tio.c_iflag |= IXON; -#else - debug("SttyMode: no ixon in old bsd land.\n"); -#endif - } - else if (!strncmp("-ixon", opt, 5)) - { -#if defined(POSIX) || defined(TERMIO) - m->tio.c_iflag &= ~IXON; -#else - debug("SttyMode: no -ixon in old bsd land.\n"); -#endif - } - else if (!strncmp("ixoff", opt, 5)) - { -#if defined(POSIX) || defined(TERMIO) - m->tio.c_iflag |= IXOFF; -#else - m->m_ttyb.sg_flags |= TANDEM; -#endif - } - else if (!strncmp("-ixoff", opt, 6)) - { -#if defined(POSIX) || defined(TERMIO) - m->tio.c_iflag &= ~IXOFF; -#else - m->m_ttyb.sg_flags &= ~TANDEM; -#endif - } - else if (!strncmp("crtscts", opt, 7)) - { -#if (defined(POSIX) || defined(TERMIO)) && defined(CRTSCTS) - m->tio.c_cflag |= CRTSCTS; -#endif - } - else if (!strncmp("-crtscts", opt, 8)) - { -#if (defined(POSIX) || defined(TERMIO)) && defined(CRTSCTS) - m->tio.c_cflag &= ~CRTSCTS; -#endif - } - else - return -1; - while (*opt && !index(sep, *opt)) opt++; - } - return 0; -} - -/* - * Job control handling - * - * Somehow the ultrix session handling is broken, so use - * the bsdish variant. - */ - -/*ARGSUSED*/ -void -brktty(fd) -int fd; -{ -#if defined(POSIX) && !defined(ultrix) - if (separate_sids) - setsid(); /* will break terminal affiliation */ - /* GNU added for Hurd systems 2001-10-10 */ -# if defined(BSD) && defined(TIOCSCTTY) && !defined(__GNU__) - ioctl(fd, TIOCSCTTY, (char *)0); -# endif /* BSD && TIOCSCTTY */ -#else /* POSIX */ -# ifdef SYSV - if (separate_sids) - setpgrp(); /* will break terminal affiliation */ -# else /* SYSV */ -# ifdef BSDJOBS - int devtty; - - if ((devtty = open("/dev/tty", O_RDWR | O_NONBLOCK)) >= 0) - { - if (ioctl(devtty, TIOCNOTTY, (char *)0)) - debug2("brktty: ioctl(devtty=%d, TIOCNOTTY, 0) = %d\n", devtty, errno); - close(devtty); - } -# endif /* BSDJOBS */ -# endif /* SYSV */ -#endif /* POSIX */ -} - -int -fgtty(fd) -int fd; -{ -#ifdef BSDJOBS - int mypid; - - mypid = getpid(); - - /* The next lines should be obsolete. Can anybody check if they - * are really needed on the BSD platforms? - * - * this is to avoid the message: - * fgtty: Not a typewriter (25) - */ -# if defined(__osf__) || (BSD >= 199103) || defined(ISC) - if (separate_sids) - setsid(); /* should be already done */ -# ifdef TIOCSCTTY - ioctl(fd, TIOCSCTTY, (char *)0); -# endif -# endif - -# ifdef POSIX - if (separate_sids) - if (tcsetpgrp(fd, mypid)) - { - debug1("fgtty: tcsetpgrp: %d\n", errno); - return -1; - } -# else /* POSIX */ - if (ioctl(fd, TIOCSPGRP, (char *)&mypid) != 0) - debug1("fgtty: TIOSETPGRP: %d\n", errno); -# ifndef SYSV /* Already done in brktty():setpgrp() */ - if (separate_sids) - if (setpgrp(fd, mypid)) - debug1("fgtty: setpgrp: %d\n", errno); -# endif -# endif /* POSIX */ -#endif /* BSDJOBS */ - return 0; -} - -/* - * The alm boards on our sparc center 1000 have a lousy driver. - * We cannot generate long breaks unless we use the most ugly form - * of ioctls. jw. - */ -#ifdef POSIX -int breaktype = 2; -#else /* POSIX */ -# ifdef TCSBRK -int breaktype = 1; -# else -int breaktype = 0; -# endif -#endif /* POSIX */ - -#if defined(sun) && !defined(SVR4) -# define HAVE_SUPER_TCSENDBREAK -#endif - -/* - * type: - * 0: TIOCSBRK / TIOCCBRK - * 1: TCSBRK - * 2: tcsendbreak() - * n: approximate duration in 1/4 seconds. - */ -static void -DoSendBreak(fd, n, type) -int fd, n, type; -{ - switch (type) - { - case 2: /* tcsendbreak() =============================== */ -#ifdef POSIX -# ifdef HAVE_SUPER_TCSENDBREAK - /* There is one rare case that I have tested, where tcsendbreak works - * really great: this was an alm driver that came with SunOS 4.1.3 - * If you have this one, define the above symbol. - * here we can use the second parameter to specify the duration. - */ - debug2("tcsendbreak(fd=%d, %d)\n", fd, n); - if (tcsendbreak(fd, n) < 0) - Msg(errno, "cannot send BREAK (tcsendbreak)"); -# else - /* - * here we hope, that multiple calls to tcsendbreak() can - * be concatenated to form a long break, as we do not know - * what exact interpretation the second parameter has: - * - * - sunos 4: duration in quarter seconds - * - sunos 5: 0 a short break, nonzero a tcdrain() - * - hpux, irix: ignored - * - mot88: duration in milliseconds - * - aix: duration in milliseconds, but 0 is 25 milliseconds. - */ - debug2("%d * tcsendbreak(fd=%d, 0)\n", n, fd); - { - int i; - - if (!n) - n++; - for (i = 0; i < n; i++) - if (tcsendbreak(fd, 0) < 0) - { - Msg(errno, "cannot send BREAK (tcsendbreak SVR4)"); - return; - } - } -# endif -#else /* POSIX */ - Msg(0, "tcsendbreak() not available, change breaktype"); -#endif /* POSIX */ - break; - - case 1: /* TCSBRK ======================================= */ -#ifdef TCSBRK - if (!n) - n++; - /* - * Here too, we assume that short breaks can be concatenated to - * perform long breaks. But for SOLARIS, this is not true, of course. - */ - debug2("%d * TCSBRK fd=%d\n", n, fd); - { - int i; - - for (i = 0; i < n; i++) - if (ioctl(fd, TCSBRK, (char *)0) < 0) - { - Msg(errno, "Cannot send BREAK (TCSBRK)"); - return; - } - } -#else /* TCSBRK */ - Msg(0, "TCSBRK not available, change breaktype"); -#endif /* TCSBRK */ - break; - - case 0: /* TIOCSBRK / TIOCCBRK ========================== */ -#if defined(TIOCSBRK) && defined(TIOCCBRK) - /* - * This is very rude. Screen actively celebrates the break. - * But it may be the only save way to issue long breaks. - */ - debug("TIOCSBRK TIOCCBRK\n"); - if (ioctl(fd, TIOCSBRK, (char *)0) < 0) - { - Msg(errno, "Can't send BREAK (TIOCSBRK)"); - return; - } - sleep1000(n ? n * 250 : 250); - if (ioctl(fd, TIOCCBRK, (char *)0) < 0) - { - Msg(errno, "BREAK stuck!!! -- HELP! (TIOCCBRK)"); - return; - } -#else /* TIOCSBRK && TIOCCBRK */ - Msg(0, "TIOCSBRK/CBRK not available, change breaktype"); -#endif /* TIOCSBRK && TIOCCBRK */ - break; - - default: /* unknown ========================== */ - Msg(0, "Internal SendBreak error: method %d unknown", type); - } -} - -/* - * Send a break for n * 0.25 seconds. Tty must be PLAIN. - * The longest possible break allowed here is 15 seconds. - */ - -void -SendBreak(wp, n, closeopen) -struct win *wp; -int n, closeopen; -{ - sigret_t (*sigalrm)__P(SIGPROTOARG); - -#ifdef BUILTIN_TELNET - if (wp->w_type == W_TYPE_TELNET) - { - TelBreak(wp); - return; - } -#endif - if (wp->w_type != W_TYPE_PLAIN) - return; - - debug3("break(%d, %d) fd %d\n", n, closeopen, wp->w_ptyfd); - -#ifdef POSIX - (void) tcflush(wp->w_ptyfd, TCIOFLUSH); -#else -# ifdef TIOCFLUSH - (void) ioctl(wp->w_ptyfd, TIOCFLUSH, (char *)0); -# endif /* TIOCFLUSH */ -#endif /* POSIX */ - - if (closeopen) - { - close(wp->w_ptyfd); - sleep1000(n ? n * 250 : 250); - if ((wp->w_ptyfd = OpenTTY(wp->w_tty, wp->w_cmdargs[1])) < 1) - { - Msg(0, "Ouch, cannot reopen line %s, please try harder", wp->w_tty); - return; - } - (void) fcntl(wp->w_ptyfd, F_SETFL, FNBLOCK); - } - else - { - sigalrm = signal(SIGALRM, SigAlrmDummy); - alarm(15); - - DoSendBreak(wp->w_ptyfd, n, breaktype); - - alarm(0); - signal(SIGALRM, sigalrm); - } - debug(" broken.\n"); -} - -/* - * Console grabbing - */ - -#if (!defined(TIOCCONS) && defined(SRIOCSREDIR)) || defined(linux) - -static struct event consredir_ev; -static int consredirfd[2] = {-1, -1}; - -static void -consredir_readev_fn(ev, data) -struct event *ev; -char *data; -{ - char *p, *n, buf[256]; - int l; - - if (!console_window || (l = read(consredirfd[0], buf, sizeof(buf))) <= 0) - { - close(consredirfd[0]); - close(consredirfd[1]); - consredirfd[0] = consredirfd[1] = -1; - evdeq(ev); - return; - } - for (p = n = buf; l > 0; n++, l--) - if (*n == '\n') - { - if (n > p) - WriteString(console_window, p, n - p); - WriteString(console_window, "\r\n", 2); - p = n + 1; - } - if (n > p) - WriteString(console_window, p, n - p); -} - -#endif - -/*ARGSUSED*/ -int -TtyGrabConsole(fd, on, rc_name) -int fd, on; -char *rc_name; -{ -#if defined(TIOCCONS) && !defined(linux) - struct display *d; - int ret = 0; - int sfd = -1; - - if (on < 0) - return 0; /* pty close will ungrab */ - if (on) - { - if (displays == 0) - { - Msg(0, "I need a display"); - return -1; - } - for (d = displays; d; d = d->d_next) - if (strcmp(d->d_usertty, "/dev/console") == 0) - break; - if (d) - { - Msg(0, "too dangerous - screen is running on /dev/console"); - return -1; - } - } - - if (!on) - { - char *slave; - if ((fd = OpenPTY(&slave)) < 0) - { - Msg(errno, "%s: could not open detach pty master", rc_name); - return -1; - } - if ((sfd = open(slave, O_RDWR | O_NOCTTY)) < 0) - { - Msg(errno, "%s: could not open detach pty slave", rc_name); - close(fd); - return -1; - } - } - if (UserContext() == 1) - UserReturn(ioctl(fd, TIOCCONS, (char *)&on)); - ret = UserStatus(); - if (ret) - Msg(errno, "%s: ioctl TIOCCONS failed", rc_name); - if (!on) - { - close(sfd); - close(fd); - } - return ret; - -#else -# if defined(SRIOCSREDIR) || defined(linux) - struct display *d; -# ifdef SRIOCSREDIR - int cfd; -# else - struct mode new1, new2; - char *slave; -# endif - - if (on > 0) - { - if (displays == 0) - { - Msg(0, "I need a display"); - return -1; - } - for (d = displays; d; d = d->d_next) - if (strcmp(d->d_usertty, "/dev/console") == 0) - break; - if (d) - { - Msg(0, "too dangerous - screen is running on /dev/console"); - return -1; - } - } - if (consredirfd[0] >= 0) - { - evdeq(&consredir_ev); - close(consredirfd[0]); - close(consredirfd[1]); - consredirfd[0] = consredirfd[1] = -1; - } - if (on <= 0) - return 0; -# ifdef SRIOCSREDIR - if ((cfd = secopen("/dev/console", O_RDWR|O_NOCTTY, 0)) == -1) - { - Msg(errno, "/dev/console"); - return -1; - } - if (pipe(consredirfd)) - { - Msg(errno, "pipe"); - close(cfd); - consredirfd[0] = consredirfd[1] = -1; - return -1; - } - if (ioctl(cfd, SRIOCSREDIR, consredirfd[1])) - { - Msg(errno, "SRIOCSREDIR ioctl"); - close(cfd); - close(consredirfd[0]); - close(consredirfd[1]); - consredirfd[0] = consredirfd[1] = -1; - return -1; - } - close(cfd); -# else - /* special linux workaround for a too restrictive kernel */ - if ((consredirfd[0] = OpenPTY(&slave)) < 0) - { - Msg(errno, "%s: could not open detach pty master", rc_name); - return -1; - } - if ((consredirfd[1] = open(slave, O_RDWR | O_NOCTTY)) < 0) - { - Msg(errno, "%s: could not open detach pty slave", rc_name); - close(consredirfd[0]); - return -1; - } - InitTTY(&new1, 0); - SetMode(&new1, &new2, 0, 0); - SetTTY(consredirfd[1], &new2); - if (UserContext() == 1) - UserReturn(ioctl(consredirfd[1], TIOCCONS, (char *)&on)); - if (UserStatus()) - { - Msg(errno, "%s: ioctl TIOCCONS failed", rc_name); - close(consredirfd[0]); - close(consredirfd[1]); - return -1; - } -# endif - consredir_ev.fd = consredirfd[0]; - consredir_ev.type = EV_READ; - consredir_ev.handler = consredir_readev_fn; - evenq(&consredir_ev); - return 0; -# else - if (on > 0) - Msg(0, "%s: don't know how to grab the console", rc_name); - return -1; -# endif -#endif -} - -/* - * Read modem control lines of a physical tty and write them to buf - * in a readable format. - * Will not write more than 256 characters to buf. - * Returns buf; - */ -char * -TtyGetModemStatus(fd, buf) -int fd; -char *buf; -{ - char *p = buf; -#ifdef TIOCGSOFTCAR - unsigned int softcar; -#endif -#if defined(TIOCMGET) || defined(TIOCMODG) - unsigned int mflags; -#else -# ifdef MCGETA - /* this is yet another interface, found on hpux. grrr */ - mflag mflags; -#if defined(MDTR) -# define TIOCM_DTR MDTR -#endif /* MDTR */ -#if defined(MRTS) -# define TIOCM_RTS MRTS -#endif /* MRTS */ -#if defined(MDSR) -# define TIOCM_DSR MDSR -#endif /* MDSR */ -#if defined(MDCD) -# define TIOCM_CAR MDCD -#endif /* MDCD */ -#if defined(MRI) -# define TIOCM_RNG MRI -#endif /* MRI */ -#if defined(MCTS) -# define TIOCM_CTS MCTS -#endif /* MCTS */ -# endif -#endif -#if defined(CLOCAL) || defined(CRTSCTS) - struct mode mtio; /* screen.h */ -#endif -#if defined(CRTSCTS) || defined(TIOCM_CTS) - int rtscts; -#endif - int clocal; - -#if defined(CLOCAL) || defined(CRTSCTS) - GetTTY(fd, &mtio); -#endif - clocal = 0; -#ifdef CLOCAL - if (mtio.tio.c_cflag & CLOCAL) - { - clocal = 1; - *p++ = '{'; - } -#endif - -#ifdef TIOCM_CTS -# ifdef CRTSCTS - if (!(mtio.tio.c_cflag & CRTSCTS)) - rtscts = 0; - else -# endif /* CRTSCTS */ - rtscts = 1; -#endif /* TIOCM_CTS */ - -#ifdef TIOCGSOFTCAR - if (ioctl(fd, TIOCGSOFTCAR, (char *)&softcar) < 0) - softcar = 0; -#endif - -#if defined(TIOCMGET) || defined(TIOCMODG) || defined(MCGETA) -# ifdef TIOCMGET - if (ioctl(fd, TIOCMGET, (char *)&mflags) < 0) -# else -# ifdef TIOCMODG - if (ioctl(fd, TIOCMODG, (char *)&mflags) < 0) -# else - if (ioctl(fd, MCGETA, &mflags) < 0) -# endif -# endif - { -#ifdef TIOCGSOFTCAR - sprintf(p, "NO-TTY? %s", softcar ? "(CD)" : "CD"); -#else - sprintf(p, "NO-TTY?"); -#endif - p += strlen(p); - } - else - { - char *s; -# ifdef FANCY_MODEM -# ifdef TIOCM_LE - if (!(mflags & TIOCM_LE)) - for (s = "!LE "; *s; *p++ = *s++); -# endif -# endif /* FANCY_MODEM */ - -# ifdef TIOCM_RTS - s = "!RTS "; if (mflags & TIOCM_RTS) s++; - while (*s) *p++ = *s++; -# endif -# ifdef TIOCM_CTS - s = "!CTS "; - if (!rtscts) - { - *p++ = '('; - s = "!CTS) "; - } - if (mflags & TIOCM_CTS) s++; - while (*s) *p++ = *s++; -# endif - -# ifdef TIOCM_DTR - s = "!DTR "; if (mflags & TIOCM_DTR) s++; - while (*s) *p++ = *s++; -# endif -# ifdef TIOCM_DSR - s = "!DSR "; if (mflags & TIOCM_DSR) s++; - while (*s) *p++ = *s++; -# endif -# if defined(TIOCM_CD) || defined(TIOCM_CAR) - s = "!CD "; -# ifdef TIOCGSOFTCAR - if (softcar) - { - *p++ = '('; - s = "!CD) "; - } -# endif -# ifdef TIOCM_CD - if (mflags & TIOCM_CD) s++; -# else - if (mflags & TIOCM_CAR) s++; -# endif - while (*s) *p++ = *s++; -# endif -# if defined(TIOCM_RI) || defined(TIOCM_RNG) -# ifdef TIOCM_RI - if (mflags & TIOCM_RI) -# else - if (mflags & TIOCM_RNG) -# endif - for (s = "RI "; *s; *p++ = *s++); -# endif -# ifdef FANCY_MODEM -# ifdef TIOCM_ST - s = "!ST "; if (mflags & TIOCM_ST) s++; - while (*s) *p++ = *s++; -# endif -# ifdef TIOCM_SR - s = "!SR "; if (mflags & TIOCM_SR) s++; - while (*s) *p++ = *s++; -# endif -# endif /* FANCY_MODEM */ - if (p > buf && p[-1] == ' ') - p--; - *p = '\0'; - } -#else -# ifdef TIOCGSOFTCAR - sprintf(p, " %s", softcar ? "(CD)", "CD"); - p += strlen(p); -# endif -#endif - if (clocal) - *p++ = '}'; - *p = '\0'; - return buf; -} - -/* - * Old bsd-ish machines may not have any of the baudrate B... symbols. - * We hope to detect them here, so that the btable[] below always has - * many entries. - */ -#ifndef POSIX -# ifndef TERMIO -# if !defined(B9600) && !defined(B2400) && !defined(B1200) && !defined(B300) -#if !defined(B0) -#define B0 0 -#endif /* B0 */ -#if !defined(B50) -#define B50 1 -#endif /* B50 */ -#if !defined(B75) -#define B75 2 -#endif /* B75 */ -#if !defined(B110) -#define B110 3 -#endif /* B110 */ -#if !defined(B134) -#define B134 4 -#endif /* B134 */ -#if !defined(B150) -#define B150 5 -#endif /* B150 */ -#if !defined(B200) -#define B200 6 -#endif /* B200 */ -#if !defined(B300) -#define B300 7 -#endif /* B300 */ -#if !defined(B600) -#define B600 8 -#endif /* B600 */ -#if !defined(B1200) -#define B1200 9 -#endif /* B1200 */ -#if !defined(B1800) -#define B1800 10 -#endif /* B1800 */ -#if !defined(B2400) -#define B2400 11 -#endif /* B2400 */ -#if !defined(B4800) -#define B4800 12 -#endif /* B4800 */ -#if !defined(B9600) -#define B9600 13 -#endif /* B9600 */ -#if !defined(EXTA) -#define EXTA 14 -#endif /* EXTA */ -#if !defined(EXTB) -#define EXTB 15 -#endif /* EXTB */ -# endif -# endif -#endif - -/* - * On hpux, idx and sym will be different. - * Rumor has it that, we need idx in D_dospeed to make tputs - * padding correct. - * Frequently used entries come first. - */ -static struct baud_values btable[] = -{ -#if defined(B9600) - { 13, 9600, B9600 }, -#endif /* B9600 */ -#if defined(B19200) - { 14, 19200, B19200 }, -#endif /* B19200 */ -#if defined(EXTA) - { 14, 19200, EXTA }, -#endif /* EXTA */ -#if defined(B38400) - { 15, 38400, B38400 }, -#endif /* B38400 */ -#if defined(EXTB) - { 15, 38400, EXTB }, -#endif /* EXTB */ -#if defined(B57600) - { 16, 57600, B57600 }, -#endif /* B57600 */ -#if defined(B115200) - { 17, 115200, B115200 }, -#endif /* B115200 */ -#if defined(B230400) - { 18, 230400, B230400 }, -#endif /* B230400 */ -#if defined(B460800) - { 19, 460800, B460800 }, -#endif /* B460800 */ -#if defined(B7200) - { 13, 7200, B7200 }, -#endif /* B7200 */ -#if defined(B4800) - { 12, 4800, B4800 }, -#endif /* B4800 */ -#if defined(B3600) - { 12, 3600, B3600 }, -#endif /* B3600 */ -#if defined(B2400) - { 11, 2400, B2400 }, -#endif /* B2400 */ -#if defined(B1800) - { 10, 1800, B1800 }, -#endif /* B1800 */ -#if defined(B1200) - { 9, 1200, B1200 }, -#endif /* B1200 */ -#if defined(B900) - { 9, 900, B900 }, -#endif /* B900 */ -#if defined(B600) - { 8, 600, B600 }, -#endif /* B600 */ -#if defined(B300) - { 7, 300, B300 }, -#endif /* B300 */ -#if defined(B200) - { 6, 200, B200 }, -#endif /* B200 */ -#if defined(B150) - { 5, 150, B150 }, -#endif /* B150 */ -#if defined(B134) - { 4, 134, B134 }, -#endif /* B134 */ -#if defined(B110) - { 3, 110, B110 }, -#endif /* B110 */ -#if defined(B75) - { 2, 75, B75 }, -#endif /* B75 */ -#if defined(B50) - { 1, 50, B50 }, -#endif /* B50 */ -#if defined(B0) - { 0, 0, B0 }, -#endif /* B0 */ - { -1, -1, -1 } -}; - -/* - * baud may either be a bits-per-second value or a symbolic - * value as returned by cfget?speed() - */ -struct baud_values * -lookup_baud(baud) -int baud; -{ - struct baud_values *p; - - for (p = btable; p->idx >= 0; p++) - if (baud == p->bps || baud == p->sym) - return p; - return NULL; -} - -/* - * change the baud rate in a mode structure. - * ibaud and obaud are given in bit/second, or at your option as - * termio B... symbols as defined in e.g. suns sys/ttydev.h - * -1 means don't change. - */ -int -SetBaud(m, ibaud, obaud) -struct mode *m; -int ibaud, obaud; -{ - struct baud_values *ip, *op; - - if ((!(ip = lookup_baud(ibaud)) && ibaud != -1) || - (!(op = lookup_baud(obaud)) && obaud != -1)) - return -1; - -#ifdef POSIX - if (ip) cfsetispeed(&m->tio, ip->sym); - if (op) cfsetospeed(&m->tio, op->sym); -#else /* POSIX */ -# ifdef TERMIO - if (ip) - { -# ifdef IBSHIFT - m->tio.c_cflag &= ~(CBAUD << IBSHIFT); - m->tio.c_cflag |= (ip->sym & CBAUD) << IBSHIFT; -# else /* IBSHIFT */ - if (ibaud != obaud) - return -1; -# endif /* IBSHIFT */ - } - if (op) - { - m->tio.c_cflag &= ~CBAUD; - m->tio.c_cflag |= op->sym & CBAUD; - } -# else /* TERMIO */ - if (ip) m->m_ttyb.sg_ispeed = ip->idx; - if (op) m->m_ttyb.sg_ospeed = op->idx; -# endif /* TERMIO */ -#endif /* POSIX */ - return 0; -} - -/* - * Write out the mode struct in a readable form - */ - -#ifdef DEBUG -void -DebugTTY(m) -struct mode *m; -{ - int i; - -#ifdef POSIX - debug("struct termios tio:\n"); - debug1("c_iflag = %#x\n", (unsigned int)m->tio.c_iflag); - debug1("c_oflag = %#x\n", (unsigned int)m->tio.c_oflag); - debug1("c_cflag = %#x\n", (unsigned int)m->tio.c_cflag); - debug1("c_lflag = %#x\n", (unsigned int)m->tio.c_lflag); - debug1("cfgetospeed() = %d\n", (int)cfgetospeed(&m->tio)); - debug1("cfgetispeed() = %d\n", (int)cfgetispeed(&m->tio)); - for (i = 0; i < sizeof(m->tio.c_cc)/sizeof(*m->tio.c_cc); i++) - { - debug2("c_cc[%d] = %#x\n", i, m->tio.c_cc[i]); - } -# ifdef HPUX_LTCHARS_HACK - debug1("suspc = %#02x\n", m->m_ltchars.t_suspc); - debug1("dsuspc = %#02x\n", m->m_ltchars.t_dsuspc); - debug1("rprntc = %#02x\n", m->m_ltchars.t_rprntc); - debug1("flushc = %#02x\n", m->m_ltchars.t_flushc); - debug1("werasc = %#02x\n", m->m_ltchars.t_werasc); - debug1("lnextc = %#02x\n", m->m_ltchars.t_lnextc); -# endif /* HPUX_LTCHARS_HACK */ -#else /* POSIX */ -# ifdef TERMIO - debug("struct termio tio:\n"); - debug1("c_iflag = %04o\n", m->tio.c_iflag); - debug1("c_oflag = %04o\n", m->tio.c_oflag); - debug1("c_cflag = %04o\n", m->tio.c_cflag); - debug1("c_lflag = %04o\n", m->tio.c_lflag); - for (i = 0; i < sizeof(m->tio.c_cc)/sizeof(*m->tio.c_cc); i++) - { - debug2("c_cc[%d] = %04o\n", i, m->tio.c_cc[i]); - } -# else /* TERMIO */ - debug1("sg_ispeed = %d\n", m->m_ttyb.sg_ispeed); - debug1("sg_ospeed = %d\n", m->m_ttyb.sg_ospeed); - debug1("sg_erase = %#02x\n", m->m_ttyb.sg_erase); - debug1("sg_kill = %#02x\n", m->m_ttyb.sg_kill); - debug1("sg_flags = %#04x\n", (unsigned short)m->m_ttyb.sg_flags); - debug1("intrc = %#02x\n", m->m_tchars.t_intrc); - debug1("quitc = %#02x\n", m->m_tchars.t_quitc); - debug1("startc = %#02x\n", m->m_tchars.t_startc); - debug1("stopc = %#02x\n", m->m_tchars.t_stopc); - debug1("eofc = %#02x\n", m->m_tchars.t_eofc); - debug1("brkc = %#02x\n", m->m_tchars.t_brkc); - debug1("suspc = %#02x\n", m->m_ltchars.t_suspc); - debug1("dsuspc = %#02x\n", m->m_ltchars.t_dsuspc); - debug1("rprntc = %#02x\n", m->m_ltchars.t_rprntc); - debug1("flushc = %#02x\n", m->m_ltchars.t_flushc); - debug1("werasc = %#02x\n", m->m_ltchars.t_werasc); - debug1("lnextc = %#02x\n", m->m_ltchars.t_lnextc); - debug1("ldisc = %d\n", m->m_ldisc); - debug1("lmode = %#x\n", m->m_lmode); -# endif /* TERMIO */ -#endif /* POSIX */ -} -#endif /* DEBUG */ |