Import of less 381
authorEirik Nygaard <eirikn@dragonflybsd.org>
Tue, 20 Apr 2004 17:34:50 +0000 (17:34 +0000)
committerEirik Nygaard <eirikn@dragonflybsd.org>
Tue, 20 Apr 2004 17:34:50 +0000 (17:34 +0000)
75 files changed:
contrib/less-381/COPYING [new file with mode: 0644]
contrib/less-381/DRAGONFLY-upgrade [new file with mode: 0644]
contrib/less-381/LICENSE [new file with mode: 0644]
contrib/less-381/Makefile.aut [new file with mode: 0644]
contrib/less-381/Makefile.dsb [new file with mode: 0644]
contrib/less-381/Makefile.dsg [new file with mode: 0644]
contrib/less-381/Makefile.dsu [new file with mode: 0644]
contrib/less-381/Makefile.in [new file with mode: 0644]
contrib/less-381/Makefile.o2e [new file with mode: 0644]
contrib/less-381/Makefile.o9c [new file with mode: 0644]
contrib/less-381/Makefile.o9u [new file with mode: 0644]
contrib/less-381/Makefile.wnb [new file with mode: 0644]
contrib/less-381/Makefile.wnm [new file with mode: 0644]
contrib/less-381/NEWS [new file with mode: 0644]
contrib/less-381/README [new file with mode: 0644]
contrib/less-381/brac.c [new file with mode: 0644]
contrib/less-381/ch.c [new file with mode: 0644]
contrib/less-381/charset.c [new file with mode: 0644]
contrib/less-381/cmd.h [new file with mode: 0644]
contrib/less-381/cmdbuf.c [new file with mode: 0644]
contrib/less-381/command.c [new file with mode: 0644]
contrib/less-381/configure [new file with mode: 0755]
contrib/less-381/configure.ac [new file with mode: 0644]
contrib/less-381/decode.c [new file with mode: 0644]
contrib/less-381/defines.ds [new file with mode: 0644]
contrib/less-381/defines.h.in [new file with mode: 0644]
contrib/less-381/defines.o2 [new file with mode: 0644]
contrib/less-381/defines.o9 [new file with mode: 0644]
contrib/less-381/defines.wn [new file with mode: 0644]
contrib/less-381/edit.c [new file with mode: 0644]
contrib/less-381/filename.c [new file with mode: 0644]
contrib/less-381/forwback.c [new file with mode: 0644]
contrib/less-381/funcs.h [new file with mode: 0644]
contrib/less-381/help.c [new file with mode: 0644]
contrib/less-381/ifile.c [new file with mode: 0644]
contrib/less-381/input.c [new file with mode: 0644]
contrib/less-381/install.sh [new file with mode: 0755]
contrib/less-381/jump.c [new file with mode: 0644]
contrib/less-381/less.h [new file with mode: 0644]
contrib/less-381/less.hlp [new file with mode: 0644]
contrib/less-381/less.man [new file with mode: 0644]
contrib/less-381/less.nro [new file with mode: 0644]
contrib/less-381/lessecho.c [new file with mode: 0644]
contrib/less-381/lesskey.c [new file with mode: 0644]
contrib/less-381/lesskey.h [new file with mode: 0644]
contrib/less-381/lesskey.man [new file with mode: 0644]
contrib/less-381/lesskey.nro [new file with mode: 0644]
contrib/less-381/lglob.h [new file with mode: 0644]
contrib/less-381/line.c [new file with mode: 0644]
contrib/less-381/linenum.c [new file with mode: 0644]
contrib/less-381/lsystem.c [new file with mode: 0644]
contrib/less-381/main.c [new file with mode: 0644]
contrib/less-381/mark.c [new file with mode: 0644]
contrib/less-381/mkfuncs.awk [new file with mode: 0644]
contrib/less-381/mkhelp.c [new file with mode: 0644]
contrib/less-381/mkinstalldirs [new file with mode: 0755]
contrib/less-381/optfunc.c [new file with mode: 0644]
contrib/less-381/option.c [new file with mode: 0644]
contrib/less-381/option.h [new file with mode: 0644]
contrib/less-381/opttbl.c [new file with mode: 0644]
contrib/less-381/os.c [new file with mode: 0644]
contrib/less-381/output.c [new file with mode: 0644]
contrib/less-381/pckeys.h [new file with mode: 0644]
contrib/less-381/position.c [new file with mode: 0644]
contrib/less-381/position.h [new file with mode: 0644]
contrib/less-381/prompt.c [new file with mode: 0644]
contrib/less-381/regexp.c [new file with mode: 0644]
contrib/less-381/regexp.h [new file with mode: 0644]
contrib/less-381/screen.c [new file with mode: 0644]
contrib/less-381/scrsize.c [new file with mode: 0644]
contrib/less-381/search.c [new file with mode: 0644]
contrib/less-381/signal.c [new file with mode: 0644]
contrib/less-381/tags.c [new file with mode: 0644]
contrib/less-381/ttyin.c [new file with mode: 0644]
contrib/less-381/version.c [new file with mode: 0644]

diff --git a/contrib/less-381/COPYING b/contrib/less-381/COPYING
new file mode 100644 (file)
index 0000000..d104746
--- /dev/null
@@ -0,0 +1,340 @@
+                   GNU GENERAL PUBLIC LICENSE
+                      Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                           Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+\f
+                   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.)
+\f
+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.
+\f
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+\f
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                           NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                    END OF TERMS AND CONDITIONS
+\f
+           How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year  name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.
diff --git a/contrib/less-381/DRAGONFLY-upgrade b/contrib/less-381/DRAGONFLY-upgrade
new file mode 100644 (file)
index 0000000..3c43d2c
--- /dev/null
@@ -0,0 +1,14 @@
+# $DragonFly: src/contrib/less-381/Attic/DRAGONFLY-upgrade,v 1.1.1.1 2004/04/20 17:34:50 eirikn Exp $
+
+Import of one-true-awk.
+
+Original source is availale from:
+http://www.greenwoodsoftware.com/less/
+MD5 (less-381.tar.gz) = 40c2dd4ac137b61b6a55a6478817daf4
+
+The following files were removed for this import:
+       INSTALL
+
+The vendor import was done by:
+
+       cvs import -m "Import of less 381" src/contrib/less-381 LESS less_381
diff --git a/contrib/less-381/LICENSE b/contrib/less-381/LICENSE
new file mode 100644 (file)
index 0000000..dd154f6
--- /dev/null
@@ -0,0 +1,27 @@
+                          Less License
+                          ------------
+
+Less
+Copyright (C) 1984-2002  Mark Nudelman
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice in the documentation and/or other materials provided with 
+   the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT 
+OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 
+OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 
+IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
diff --git a/contrib/less-381/Makefile.aut b/contrib/less-381/Makefile.aut
new file mode 100644 (file)
index 0000000..f105d69
--- /dev/null
@@ -0,0 +1,116 @@
+# Makefile for authoring less.
+
+EMAIL = markn@greenwoodsoftware.com
+HOMEPAGE = http://www.greenwoodsoftware.com/less
+SHELL = /bin/sh
+RCS = rcs
+NROFF = nroff -man
+
+srcdir = .
+
+SRC = \
+       main.c screen.c brac.c ch.c charset.c cmdbuf.c \
+       command.c decode.c edit.c filename.c forwback.c \
+       help.c ifile.c input.c jump.c line.c linenum.c \
+       lsystem.c mark.c optfunc.c option.c opttbl.c os.c \
+       output.c position.c prompt.c search.c signal.c \
+       tags.c ttyin.c version.c  
+DISTFILES_W = \
+       defines.ds  Makefile.dsb Makefile.dsg Makefile.dsu \
+       defines.o2  Makefile.o2e \
+       defines.o9  Makefile.o9c Makefile.o9u \
+       defines.wn  Makefile.wnm Makefile.wnb
+DISTFILES = \
+       ${SRC} regexp.c regexp.h \
+       COPYING INSTALL LICENSE Makefile.in Makefile.aut NEWS README \
+       configure configure.ac lesskey.c lessecho.c scrsize.c \
+       cmd.h funcs.h lglob.h less.h lesskey.h option.h pckeys.h position.h \
+       install.sh defines.h.in mkinstalldirs \
+       less.nro lesskey.nro less.man lesskey.man less.hlp \
+       mkfuncs.awk mkhelp.c \
+       ${DISTFILES_W}
+
+all: help.c funcs.h ${srcdir}/configure 
+
+help.c: less.hlp mkhelp
+       -mv -f ${srcdir}/help.c ${srcdir}/help.c.old
+       rm -rf help.c
+       ./mkhelp < less.hlp > help.c
+       if cmp -s help.c help.c.old; then mv help.c.old help.c; fi
+
+mkhelp: mkhelp.c
+       ${CC} -o mkhelp mkhelp.c
+
+${srcdir}/configure: ${srcdir}/configure.ac \
+               ${srcdir}/Makefile.in
+       cd ${srcdir}; autoheader; autoconf
+
+funcs.h: ${SRC:%=${srcdir}/%}
+       -mv -f ${srcdir}/funcs.h ${srcdir}/funcs.h.old
+       awk -f ${srcdir}/mkfuncs.awk ${SRC:%=${srcdir}/%} >${srcdir}/funcs.h
+       if cmp -s funcs.h funcs.h.old; then mv funcs.h.old funcs.h; fi
+
+lint:
+       lint -I. ${CPPFLAGS} ${SRC}
+
+clean: 
+       rm -f Makefile config.status config.log config.cache defines.h stamp-h \
+               README NEWS less.nro lesskey.nro  less.man lesskey.man
+
+distclean: clean
+realclean: clean
+
+REPLACE_VERSION = \
+       @REL=`sed -e '/char version/!d' -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q ${srcdir}/version.c`; \
+       DT=`date '+%d %h %Y'`; \
+       echo "Stuffing version number $$REL into $@"; \
+       sed \
+               -e "s;@@VERSION@@;$$REL;" \
+               -e "s;@@DATE@@;$$DT;" \
+               -e "s;@@EMAIL@@;${EMAIL};" \
+               -e "s;@@HOMEPAGE@@;${HOMEPAGE};" >$@
+
+${srcdir}/README: ${srcdir}/README.VER ${srcdir}/version.c
+       ${REPLACE_VERSION} ${srcdir}/README.VER
+${srcdir}/NEWS: ${srcdir}/NEWS.VER ${srcdir}/version.c
+       ${REPLACE_VERSION} ${srcdir}/NEWS.VER
+${srcdir}/less.nro: ${srcdir}/less.nro.VER ${srcdir}/version.c
+       ${REPLACE_VERSION} ${srcdir}/less.nro.VER
+${srcdir}/lesskey.nro: ${srcdir}/lesskey.nro.VER ${srcdir}/version.c
+       ${REPLACE_VERSION} ${srcdir}/lesskey.nro.VER
+${srcdir}/less.hlp: ${srcdir}/less.hlp.VER ${srcdir}/version.c
+       ${REPLACE_VERSION} ${srcdir}/less.hlp.VER
+
+${srcdir}/less.man: ${srcdir}/less.nro
+       ${NROFF} ${srcdir}/less.nro >${srcdir}/less.man
+${srcdir}/lesskey.man: ${srcdir}/lesskey.nro
+       ${NROFF} ${srcdir}/lesskey.nro >${srcdir}/lesskey.man
+
+
+distfiles: ${DISTFILES}
+
+dist: ${DISTFILES}
+       if [ ! -d ${srcdir}/release ]; then mkdir ${srcdir}/release; fi
+       @cd ${srcdir}; \
+       REL=`sed -e '/char version/!d' -e 's/[^0-9.]*\([0-9.]*\).*/less-\1/' -e q version.c`; \
+       rm -rf release/$$REL; mkdir release/$$REL; \
+       echo "Preparing $$REL"; \
+       rm -rf $$REL; mkdir $$REL; \
+       for file in ${DISTFILES}; do \
+         cp -p $$file $$REL; \
+         chmod -w $$REL/$$file; \
+       done; \
+       cd $$REL; chmod +w ${DISTFILES_W}; cd ..; \
+       echo "Creating release/$$REL/$$REL.tar.gz"; \
+       tar -cf - $$REL | gzip -c >release/$$REL/$$REL.tar.gz; \
+       echo "Creating release/$$REL/$$REL.zip"; \
+       zip -rq release/$$REL/$$REL.zip $$REL; \
+       rm -rf $$REL
+
+tagall:
+       @REL=`sed -e '/char version/!d' -e 's/[^0-9.]*\([0-9.]*\).*/v\1/' -e q ${srcdir}/version.c`; \
+       echo "tagging $$REL"; \
+       for f in ${srcdir}/RCS/*,v; do \
+         REV=`co -p $$f 2>&1 | sed -e '1d' -e '3,$$d' -e 's/revision //'`; \
+         ${RCS} -N$$REL:$$REV $$f; \
+       done
diff --git a/contrib/less-381/Makefile.dsb b/contrib/less-381/Makefile.dsb
new file mode 100644 (file)
index 0000000..f9fb0f5
--- /dev/null
@@ -0,0 +1,50 @@
+# Makefile for less.
+# MS-DOS version (Borland C/C++ 4.02)
+
+#### Start of system configuration section. ####
+
+CC = bcc
+LIBDIR = \bc\lib
+
+CFLAGS = -A- -mm -O2 -w- -1- -2- -a -d -Z
+LDFLAGS = -mm
+LIBS =
+EXT = .EXE
+
+#### End of system configuration section. ####
+
+# This rule allows us to supply the necessary -D options
+# in addition to whatever the user asks for.
+.c.obj:
+       $(CC) -c -I. $(CPPFLAGS) $(CFLAGS) $<
+
+OBJ =  main.obj screen.obj brac.obj ch.obj charset.obj cmdbuf.obj command.obj \
+       decode.obj edit.obj filename.obj forwback.obj help.obj ifile.obj \
+       input.obj jump.obj line.obj linenum.obj lsystem.obj \
+       mark.obj optfunc.obj option.obj opttbl.obj os.obj output.obj \
+       position.obj prompt.obj search.obj signal.obj tags.obj \
+       ttyin.obj version.obj
+
+all: less$(EXT) lesskey$(EXT)
+
+# This is really horrible, but the command line is too long for 
+# MS-DOS if we try to link $(OBJ).
+less$(EXT): $(OBJ)
+       ren lesskey.obj lesskey.obo
+       $(CC) $(LDFLAGS) -e$@ *.obj $(LIBS)
+       ren lesskey.obo lesskey.obj
+
+lesskey$(EXT): lesskey.obj version.obj
+       $(CC) $(LDFLAGS) -e$@ lesskey.obj version.obj $(LIBS)
+
+defines.h: defines.ds
+       -del defines.h
+       -copy defines.ds defines.h
+
+$(OBJ): less.h defines.h
+
+clean:
+       -del *.obj 
+       -del less.exe
+       -del lesskey.exe
+
diff --git a/contrib/less-381/Makefile.dsg b/contrib/less-381/Makefile.dsg
new file mode 100644 (file)
index 0000000..984589b
--- /dev/null
@@ -0,0 +1,91 @@
+# Makefile for less under DJGPP v2.0 or later.
+
+#### Start of system configuration section. ####
+
+srcdir = .
+VPATH = .
+
+CC = gcc
+INSTALL = ginstall -c
+INSTALL_PROGRAM = ginstall
+INSTALL_DATA = ginstall -m 644
+AWK = gawk
+
+CFLAGS = -O2 -g
+CFLAGS_COMPILE_ONLY = -c
+#LDFLAGS = -s
+LDFLAGS = -g
+O=o
+
+LIBS =
+prefix = /dev/env/DJDIR
+exec_prefix = ${prefix}
+
+bindir = ${exec_prefix}/bin
+sysconfdir = ${prefix}/etc
+mandir = ${prefix}/man
+manext = 1
+
+#### End of system configuration section. ####
+
+# This rule allows us to supply the necessary -D options
+# in addition to whatever the user asks for.
+.c.o:
+       ${CC} -I. ${CFLAGS_COMPILE_ONLY} -DBINDIR=\"${bindir}\" -DSYSDIR=\"${sysconfdir}\" ${CPPFLAGS} ${CFLAGS} $<
+
+OBJ =  main.${O} screen.${O} brac.${O} ch.${O} charset.${O} cmdbuf.${O} \
+       command.${O} decode.${O} edit.${O} filename.${O} forwback.${O} \
+       help.${O} ifile.${O} input.${O} jump.${O} line.${O} linenum.${O} \
+       lsystem.${O} mark.${O} optfunc.${O} option.${O} opttbl.${O} os.${O} \
+       output.${O} position.${O} prompt.${O} search.${O} signal.${O} \
+       tags.${O} ttyin.${O} version.${O}
+
+all: less lesskey lessecho
+
+less: ${OBJ}
+       ${CC} ${LDFLAGS} -o $@ ${OBJ} ${LIBS}
+
+lesskey: lesskey.${O} version.${O}
+       ${CC} ${LDFLAGS} -o $@ lesskey.${O} version.${O}
+
+lessecho: lessecho.${O} version.${O}
+       ${CC} ${LDFLAGS} -o $@ lessecho.${O} version.${O}
+
+defines.h: defines.ds
+       command.com /c copy $< $@
+
+${OBJ}: ${srcdir}/less.h defines.h ${srcdir}/funcs.h
+
+install: all ${srcdir}/less.man ${srcdir}/lesskey.man
+       ${INSTALL_PROGRAM} less.exe ${bindir}/less.exe
+       ${INSTALL_PROGRAM} lesskey.exe ${bindir}/lesskey.exe
+       ${INSTALL_PROGRAM} lessecho.exe ${bindir}/lessecho.exe
+       ${INSTALL_DATA} ${srcdir}/less.man ${mandir}/man${manext}/less.${manext}
+       ${INSTALL_DATA} ${srcdir}/lesskey.man ${mandir}/man${manext}/lesskey.${manext}
+
+info:
+install-info:
+dvi:
+check:
+installcheck:
+
+TAGS:
+       etags *.c *.h
+
+newfuncs:
+       command.com /c if exist funcs.h del funcs.h
+       ${AWK} -f mkfuncs.awk ${OBJ:.${O}=.c} > funcs.h
+
+clean:
+       command.com /c for %f in (*.${O} less lesskey lessecho *.exe) do if exist %f del %f
+
+mostlyclean: clean
+
+distclean: clean
+       command.com /c if not exist Makefile.dsg ren Makefile Makefile.dsg
+       command.com /c if not exist defines.ds ren defines.h defines.ds
+       command.com /c for %f in (Makefile defines.h) do if exist %f del %f
+
+realclean: distclean
+       command.com /c if exist TAGS del TAGS
+
diff --git a/contrib/less-381/Makefile.dsu b/contrib/less-381/Makefile.dsu
new file mode 100644 (file)
index 0000000..5bc5282
--- /dev/null
@@ -0,0 +1,58 @@
+# Makefile for less.
+# MS-DOS version
+
+#### Start of system configuration section. ####
+
+CC = cl
+# Change the following directories to match your installation.
+LIBDIR = c:\msvc\lib
+INCDIR = c:\msvc\include
+
+# CFLAGS are compile-time options and LDFLAGS are link-time options. They are
+# customized for MSVC 1.0 (MSC 8.0). If you have a different version of the
+# compiler, you may need to change some of the options to their equivalents.
+# -Ot     optimize for speed
+# -AL     large memory model
+# -Za     ANSI C conformance
+# -nologo suppress MSVC banners
+# -onerror:noexe   no .EXE file if link errors occur
+CFLAGS = -Ot -AL -Za -nologo
+LDFLAGS = -onerror:noexe -nologo
+LIBS = $(LIBDIR)\llibce.lib $(LIBDIR)\graphics.lib
+
+#### End of system configuration section. ####
+
+# This rule allows us to supply the necessary -D options
+# in addition to whatever the user asks for.
+.c.obj:
+       $(CC) -c -I. -I$(INCDIR) $(CPPFLAGS) $(CFLAGS) $<
+
+OBJ =  main.obj screen.obj brac.obj ch.obj charset.obj cmdbuf.obj command.obj \
+       decode.obj edit.obj filename.obj forwback.obj help.obj ifile.obj \
+       input.obj jump.obj line.obj linenum.obj lsystem.obj \
+       mark.obj optfunc.obj option.obj opttbl.obj os.obj output.obj \
+       position.obj prompt.obj search.obj signal.obj tags.obj \
+       ttyin.obj version.obj
+
+all: less lesskey
+
+# This is really horrible, but the command line is too long for 
+# MS-DOS if we try to link $(OBJ).
+less: $(OBJ)
+       -if exist lesskey.obj del lesskey.obj
+       $(CC) $(LDFLAGS) -o $@ *.obj $(LIBS)
+
+lesskey: lesskey.obj version.obj
+       $(CC) $(LDFLAGS) -o $@ lesskey.obj version.obj $(LIBS)
+
+defines.h: defines.ds
+       -del defines.h
+       -copy defines.ds defines.h
+
+$(OBJ): less.h defines.h
+
+clean:
+       -del *.obj 
+       -del less.exe
+       -del lesskey.exe
+
diff --git a/contrib/less-381/Makefile.in b/contrib/less-381/Makefile.in
new file mode 100644 (file)
index 0000000..8e976bb
--- /dev/null
@@ -0,0 +1,112 @@
+# Makefile for less.
+
+#### Start of system configuration section. ####
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+CC = @CC@
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+
+CFLAGS = @CFLAGS@
+CFLAGS_COMPILE_ONLY = -c
+LDFLAGS = @LDFLAGS@
+O=o
+
+LIBS = @LIBS@
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+# Where the installed binary goes.
+bindir = @bindir@
+binprefix = 
+
+sysconfdir = @sysconfdir@
+
+mandir = @mandir@
+manext = 1
+manprefix = 
+
+#### End of system configuration section. ####
+
+SHELL = /bin/sh
+
+# This rule allows us to supply the necessary -D options
+# in addition to whatever the user asks for.
+.c.o:
+       ${CC} -I. ${CFLAGS_COMPILE_ONLY} -DBINDIR=\"${bindir}\" -DSYSDIR=\"${sysconfdir}\" ${CPPFLAGS} ${CFLAGS} $<
+
+OBJ =  main.${O} screen.${O} brac.${O} ch.${O} charset.${O} cmdbuf.${O} \
+       command.${O} decode.${O} edit.${O} filename.${O} forwback.${O} \
+       help.${O} ifile.${O} input.${O} jump.${O} line.${O} linenum.${O} \
+       lsystem.${O} mark.${O} optfunc.${O} option.${O} opttbl.${O} os.${O} \
+       output.${O} position.${O} prompt.${O} search.${O} signal.${O} \
+       tags.${O} ttyin.${O} version.${O}  @REGEX_O@
+
+all: less lesskey lessecho
+
+less: ${OBJ}
+       ${CC} ${LDFLAGS} -o $@ ${OBJ} ${LIBS}
+
+lesskey: lesskey.${O} version.${O}
+       ${CC} ${LDFLAGS} -o $@ lesskey.${O} version.${O}
+
+lessecho: lessecho.${O} version.${O}
+       ${CC} ${LDFLAGS} -o $@ lessecho.${O} version.${O}
+
+${OBJ}: ${srcdir}/less.h ${srcdir}/funcs.h defines.h 
+
+install: all ${srcdir}/less.nro ${srcdir}/lesskey.nro installdirs
+       ${INSTALL_PROGRAM} less ${bindir}/${binprefix}less
+       ${INSTALL_PROGRAM} lesskey ${bindir}/${binprefix}lesskey
+       ${INSTALL_PROGRAM} lessecho ${bindir}/${binprefix}lessecho
+       ${INSTALL_DATA} ${srcdir}/less.nro ${mandir}/man${manext}/${manprefix}less.${manext}
+       ${INSTALL_DATA} ${srcdir}/lesskey.nro ${mandir}/man${manext}/${manprefix}lesskey.${manext}
+
+install-strip:
+       ${MAKE} INSTALL_PROGRAM='${INSTALL_PROGRAM} -s' install
+
+installdirs: mkinstalldirs
+       ${srcdir}/mkinstalldirs ${bindir} ${mandir}/man${manext}
+
+uninstall:
+       rm -f ${bindir}/${binprefix}less ${bindir}/${binprefix}lesskey ${bindir}/${binprefix}lessecho
+       rm -f ${mandir}/man${manext}/${manprefix}less.${manext} ${mandir}/man${manext}/${manprefix}lesskey.${manext}
+
+info:
+install-info:
+dvi:
+check:
+installcheck:
+
+TAGS:
+       cd ${srcdir} && etags *.c *.h
+
+# config.status might not change defines.h
+# Don't rerun config.status if we just configured (so there's no stamp-h).
+defines.h: stamp-h
+stamp-h: defines.h.in config.status
+       test ! -f stamp-h || CONFIG_FILES= CONFIG_HEADERS=defines.h ./config.status
+       touch stamp-h
+Makefile: ${srcdir}/Makefile.in config.status
+       CONFIG_FILES=Makefile CONFIG_HEADERS= ./config.status
+config.status: ${srcdir}/configure
+       ./config.status --recheck
+
+${srcdir}/configure: ${srcdir}/configure.ac
+       cd ${srcdir}; autoheader; autoconf
+
+clean:
+       rm -f *.${O} core less lesskey lessecho
+
+mostlyclean: clean
+
+distclean: clean
+       rm -f Makefile config.status config.log config.cache defines.h stamp-h
+
+realclean: distclean
+       rm -f TAGS
+
diff --git a/contrib/less-381/Makefile.o2e b/contrib/less-381/Makefile.o2e
new file mode 100644 (file)
index 0000000..b0b9db2
--- /dev/null
@@ -0,0 +1,42 @@
+# Makefile for less.
+# OS/2 version, for emx+gcc compiler
+
+#### Start of system configuration section. ####
+
+CC = gcc -Zomf
+CFLAGS = -I. -O2 -Wall
+LDFLAGS = -s -Zcrtdll
+LIBS = -ltermcap
+O = obj
+
+#### End of system configuration section. ####
+
+.SUFFIXES: .c .${O}
+
+# This rule allows us to supply the necessary -D options
+# in addition to whatever the user asks for.
+.c.${O}:
+       ${CC} -c ${CPPFLAGS} ${CFLAGS} $<
+
+OBJ =  main.${O} screen.${O} brac.${O} ch.${O} charset.${O} cmdbuf.${O} \
+       command.${O} decode.${O} edit.${O} filename.${O} forwback.${O} \
+       help.${O} ifile.${O} input.${O} jump.${O} line.${O} linenum.${O} \
+       lsystem.${O} mark.${O} optfunc.${O} option.${O} opttbl.${O} os.${O} \
+       output.${O} position.${O} prompt.${O} search.${O} signal.${O} \
+       tags.${O} ttyin.${O} version.${O}  regexp.${O}
+
+all:    less.exe lesskey.exe scrsize.exe
+
+less.exe: ${OBJ}
+       ${CC} ${OBJ} -o $@ ${LDFLAGS} ${LIBS}
+
+lesskey.exe: lesskey.${O} version.${O}
+       ${CC} lesskey.${O} version.${O} -o $@ ${LDFLAGS}
+
+scrsize.exe: scrsize.c
+       ${CC} ${CFLAGS} -D__ST_MT_ERRNO__ -s -Zmtd -lX11 $<
+
+${OBJ}: defines.h less.h
+
+defines.h: defines.o2
+       copy defines.o2 defines.h
diff --git a/contrib/less-381/Makefile.o9c b/contrib/less-381/Makefile.o9c
new file mode 100644 (file)
index 0000000..0a1b503
--- /dev/null
@@ -0,0 +1,46 @@
+# Makefile for less.
+# OS-9 version for Microware C 3.2.
+
+#### Start of system configuration section. ####
+
+CC = cc
+CPPFLAGS = -D_OSK_MWC32 -DDEBUG=0 -DSTRCSPN
+CFLAGS = -k=0 -v=.
+CFLAGS_COMPILE_ONLY = -r 
+LDFLAGS = -igm=8
+LIBS = -l=/dd/lib/termlib.l
+O = r
+
+
+#### End of system configuration section. ####
+
+.SUFFIXES: .c .${O}
+
+# This rule allows us to supply the necessary -D options
+# in addition to whatever the user asks for.
+
+.c.${O}:
+       ${CC} ${CFLAGS_COMPILE_ONLY} ${CPPFLAGS} ${CFLAGS} $<
+
+OBJ =  main.${O} screen.${O} brac.${O} ch.${O} charset.${O} cmdbuf.${O} \
+       command.${O} decode.${O} edit.${O} filename.${O} forwback.${O} \
+       help.${O} ifile.${O} input.${O} jump.${O} line.${O} linenum.${O} \
+       lsystem.${O} mark.${O} optfunc.${O} option.${O} opttbl.${O} os.${O} \
+       output.${O} position.${O} prompt.${O} search.${O} signal.${O} \
+       tags.${O} ttyin.${O} version.${O}  regexp.${O}
+
+all: less lessecho lesskey
+
+less: ${OBJ}
+       ${CC} ${OBJ} -f=$@ ${LDFLAGS} ${LIBS}
+
+lesskey: lesskey.${O} version.${O}
+       ${CC} lesskey.${O} version.${O} -f=$@ ${LDFLAGS}
+
+lessecho: lessecho.${O} version.${O}
+       ${CC} lessecho.${O} version.${O} -f=$@ ${LDFLAGS}
+
+${OBJ}: defines.h less.h
+
+defines.h: defines.o9
+       copy defines.o9 defines.h -rf
diff --git a/contrib/less-381/Makefile.o9u b/contrib/less-381/Makefile.o9u
new file mode 100644 (file)
index 0000000..2dec7cc
--- /dev/null
@@ -0,0 +1,42 @@
+# Makefile for less.
+# OS-9 version for Ultra C.
+
+#### Start of system configuration section. ####
+
+CC = cc
+CPPFLAGS =
+CFLAGS = -v=.
+CFLAGS_COMPILE_ONLY = -eas
+LDFLAGS = -olM=24k
+LIBS = -ltermlib.l -lsys_clib.l -lunix.l
+O = r
+
+
+#### End of system configuration section. ####
+
+.SUFFIXES: .c .${O}
+
+# This rule allows us to supply the necessary -D options
+# in addition to whatever the user asks for.
+.c.${O}:
+       ${CC} ${CFLAGS_COMPILE_ONLY} ${CPPFLAGS} ${CFLAGS} $<
+
+OBJ =  main.${O} screen.${O} brac.${O} ch.${O} charset.${O} cmdbuf.${O} \
+       command.${O} decode.${O} edit.${O} filename.${O} forwback.${O} \
+       help.${O} ifile.${O} input.${O} jump.${O} line.${O} linenum.${O} \
+       lsystem.${O} mark.${O} optfunc.${O} option.${O} opttbl.${O} os.${O} \
+       output.${O} position.${O} prompt.${O} search.${O} signal.${O} \
+       tags.${O} ttyin.${O} version.${O}  regexp.${O}
+
+all: less lesskey
+
+less: ${OBJ}
+       ${CC} ${OBJ} -f=$@ ${LDFLAGS} ${LIBS}
+
+lesskey: lesskey.${O} version.${O}
+       ${CC} lesskey.${O} version.${O} -f=$@ ${LDFLAGS}
+
+${OBJ}: defines.h less.h
+
+defines.h: defines.o9
+       copy defines.o9 defines.h -rf
diff --git a/contrib/less-381/Makefile.wnb b/contrib/less-381/Makefile.wnb
new file mode 100644 (file)
index 0000000..4da10fc
--- /dev/null
@@ -0,0 +1,49 @@
+# Makefile for less.
+# Windows version
+
+#### Start of system configuration section. ####
+
+CC = bcc32
+LIBDIR = d:\bc45\lib
+
+CFLAGS = -O2 -w-pro -TWC -P-c -v- -d -f- -ff- -vi
+LDFLAGS = /Tpe /v- /ap /c /x
+LD = tlink32
+LIBS = ${LIBDIR}\import32.lib ${LIBDIR}\cw32.lib
+
+#### End of system configuration section. ####
+
+# This rule allows us to supply the necessary -D options
+# in addition to whatever the user asks for.
+.c.obj:
+       ${CC} -c -I. ${CPPFLAGS} ${CFLAGS} $<
+
+OBJ =  main.obj screen.obj brac.obj ch.obj charset.obj cmdbuf.obj command.obj \
+       decode.obj edit.obj filename.obj forwback.obj help.obj ifile.obj \
+       input.obj jump.obj line.obj linenum.obj lsystem.obj \
+       mark.obj optfunc.obj option.obj opttbl.obj os.obj output.obj \
+       position.obj prompt.obj search.obj signal.obj tags.obj \
+       ttyin.obj version.obj regexp.obj
+
+all: less lesskey
+
+# This is really horrible, but the command line is too long for 
+# MS-DOS if we try to link ${OBJ}.
+less: ${OBJ}
+       -del lesskey.obj
+       ${LD} ${LDFLAGS} ${LIBDIR}\c0x32.obj *.obj, $@,,${LIBS}
+
+lesskey: lesskey.obj version.obj
+       ${LD} ${LDFLAGS} ${LIBDIR}\c0x32.obj lesskey.obj version.obj, $@,,${LIBS}
+
+defines.h: defines.wn
+       -del defines.h
+       -copy defines.wn defines.h
+
+${OBJ}: less.h defines.h funcs.h cmd.h
+
+clean:
+       -del *.obj 
+       -del less.exe
+       -del lesskey.exe
+
diff --git a/contrib/less-381/Makefile.wnm b/contrib/less-381/Makefile.wnm
new file mode 100644 (file)
index 0000000..972090a
--- /dev/null
@@ -0,0 +1,55 @@
+# Makefile for less.
+# Windows 32 Visual C++ version
+
+#### Start of system configuration section. ####
+
+CC = cl
+
+# Normal flags
+CFLAGS = /nologo /ML /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
+LDFLAGS = /subsystem:console /incremental:no /machine:I386
+
+# Debugging flags
+#CFLAGS = /nologo /MDd /W3 /GX /Od /Gm /Zi /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
+#LDFLAGS = /subsystem:console /incremental:yes /debug /machine:I386
+
+LD = link
+LIBS = user32.lib
+
+#### End of system configuration section. ####
+
+# This rule allows us to supply the necessary -D options
+# in addition to whatever the user asks for.
+.c.obj:
+       $(CC) $(CFLAGS) $<
+
+OBJ =   main.obj screen.obj brac.obj ch.obj charset.obj cmdbuf.obj command.obj \
+       decode.obj edit.obj filename.obj forwback.obj help.obj ifile.obj \
+       input.obj jump.obj line.obj linenum.obj lsystem.obj \
+       mark.obj optfunc.obj option.obj opttbl.obj os.obj output.obj \
+       position.obj prompt.obj search.obj signal.obj tags.obj \
+       ttyin.obj version.obj regexp.obj
+
+all: less.exe lesskey.exe
+
+# This is really horrible, but the command line is too long for 
+# MS-DOS if we try to link ${OBJ}.
+less.exe: $(OBJ)
+       -del lesskey.obj
+       $(LD) $(LDFLAGS) *.obj $(LIBS) /out:$@
+
+lesskey.exe: lesskey.obj version.obj
+       $(LD) $(LDFLAGS) lesskey.obj version.obj $(LIBS) /out:$@
+
+defines.h: defines.wn
+       -del defines.h
+       -copy defines.wn defines.h
+
+$(OBJ): less.h defines.h funcs.h cmd.h
+
+clean:
+       -del *.obj 
+       -del less.exe
+       -del lesskey.exe
+
+
diff --git a/contrib/less-381/NEWS b/contrib/less-381/NEWS
new file mode 100644 (file)
index 0000000..b5f1514
--- /dev/null
@@ -0,0 +1,579 @@
+
+                     NEWS about less
+
+======================================================================
+
+  For the latest news about less, see the "less" Web page:
+      http://www.greenwoodsoftware.com/less
+  You can also download the latest version of less from there.
+
+  To report bugs, suggestions or comments, send email to 
+  bug-less@gnu.org or markn@greenwoodsoftware.com.
+
+======================================================================
+
+
+       Major changes between "less" versions 378 and 381
+
+* New -L option to disable LESSOPEN processing.
+
+* Further support for large (64 bit) file addressing.
+  Large file support is now set up by the configure script.
+
+* Use autoconf 2.54.
+  Replace configure.in, acconfig.h, defines.h.top with configure.ac.
+
+* Overstriking underscore with underscore is now bold or underlined 
+  depending on context.
+
+* Use only 7 spaces for line numbers in -N mode, if possible.
+
+* Fix some bugs in handling overstriking in UTF-8 files.
+
+* Fix some nroff issues in the man page.
+
+======================================================================
+
+       Major changes between "less" versions 376 and 378
+
+* Bug fixes:
+  Default buffer space is now 64K as documented.
+  Search highlighting works properly when used with -R.
+  Windows version works properly when input file contains carriage returns.
+  Clean up some compiler warnings.
+
+======================================================================
+
+       Major changes between "less" versions 358 and 376
+
+* -x option can now specify multiple variable-width tab stops.
+
+* -X option no longer disables keypad initialization.
+  New option --no-keypad disables keypad initialization.
+
+* New commands t and T step through multiple tag matches.
+  Added support for "global(1)" tags
+  (see http://www.gnu.org/software/global/global.html).
+
+* New prompt style set by option -Pw defines the message printed 
+  while waiting for data in the F command.
+
+* System-wide lesskey file now defaults to sysless in etc directory 
+  instead of .sysless in bin directory.
+  Use "configure --sysconfdir=..." to change it.
+  (For backwards compatibility, .sysless in bin is still recognized.)
+
+* Pressing RightArrow or LeftArrow while entering a number now shifts
+  the display N columns rather than editing the number itself.
+
+* Status column (enabled with -J) now shows search results.
+
+* Windows version sets window title.
+
+* Default LESSCHARSET for MS-DOS versions is now "dos".
+
+* Searching works better with ANSI (SGR) escape sequences.
+  ANSI color escape sequences are now supported in the MS-DOS (DJGPP) version.
+
+* Improved performance in reading very large pipes.
+
+* Eliminated some dependencies on file offets being 32 bits.
+
+* Fixed problems when viewing files with very long lines.
+
+* Fixed overstriking in UTF-8 mode, and overstriking tabs.
+
+* Improved horizontal shifting of text using -R option with ANSI color.
+
+* Improved handling of filenames containing shell metacharacters.
+
+* Some fixes for EBCDIC systems.
+
+* Some fixes for OS/2 systems.
+
+======================================================================
+
+       Major changes between "less" versions 354 and 358
+
+* Add -J (--status-column) option to display a status column.
+
+* Add -# (--shift) option to set default horizontal shift distance.
+  Default horizontal shift distance is now one-half screen width.
+
+* Horizontal shifting does not shift line numbers if -N is in effect.
+
+* Horizontal shifting acts as though -S were set, to avoid confusion.
+
+======================================================================
+
+
+       Major changes between "less" versions 352 and 354
+
+* Allow space after numeric-valued command line options.
+
+* Fix problem with configuring terminal libraries on some systems.
+
+* Add support for PCRE regular expression library.
+
+* Add --with-regex option to configure to allow manually selecting
+  a regular expression library.
+
+* Fix bug compiling with SECURE = 1.
+
+======================================================================
+
+
+       Major changes between "less" versions 346 and 352
+
+* Enable UTF-8 if "UTF-8" appears in locale-related environment variables.
+
+* Add --with-editor option to configure script.
+
+* The -M prompt and = message now show the top and bottom line number.
+
+* Fix bug in running the editor on a file whose name contains quotes, etc.
+
+* Fix bug in horizontal scrolling of long lines.
+
+* Fix bug in doing :d on a file which contains marks.
+
+* Fix bug causing cleared lines to sometimes be filled with standout, 
+  bold, underline, etc. on certain terminals.
+
+* Fixes for MS-DOS (DJGPP) version.
+
+======================================================================
+
+
+       Major changes between "less" versions 340 and 346
+
+* The UTF-8 character set is now supported.
+
+* The default character set is now latin1 rather than ascii.
+
+* New option -R (--RAW-CONTROL-CHARS) is like -r but handles 
+  long (wrapped) lines correctly, as long as the input contains only 
+  normal text and ANSI color escape sequences.
+
+* New option -F (--quit-if-one-screen) quits if the text fits on
+  the first screen.
+
+* The -w option now highlights the target line of a g or p command.
+
+* A system-wide lesskey file is supported (LESSKEY_SYSTEM).
+
+* New escape for prompt strings: %c is replaced by column number.
+
+* New escape for prompt strings: %P is replaced by percentage into
+  file, based on line number rather than byte offset.
+
+* HOME and END keys now jump to beginning of file or end of file.
+
+======================================================================
+
+
+       Major changes between "less" versions 337 and 340
+
+* Command line options for less may now be given in either the old 
+  single-letter form, or a new long name form (--option-name).
+  See the less man page or "less --help" for the list of long option names.
+
+* Command line options for lesskey may now be given in a new long name
+  form.  See the lesskey man page for the list of long option names.
+
+* New command -- toggles an option using the long option name.
+
+* New command __ queries an option using the long option name.
+
+* The old -- command is renamed as -!.
+
+* If a ^P is entered between the dash and the option letter of the -
+  command, the message describing the new setting is suppressed.
+
+* Lesskey files may now contain \k escape sequences to represent the
+  "special" keys (arrows, PAGE-UP/PAGE-DOWN, HOME, END, INSERT, DELETE).
+
+* New command :d removes the current file from the list of files.
+
+* New option -~ (like -w before version 335)
+  suppresses tildes after end-of-file.
+
+* Less is now released under the GNU General Public License.
+
+======================================================================
+
+
+       Major changes between "less" versions 335 and 337
+
+* Fixed bugs in "make install".
+
+======================================================================
+
+
+       Major changes between "less" versions 332 and 335
+
+* The old -w flag (suppress tildes after end-of-file) has been removed.
+
+* New -w flag highlights the first new line after a forward-screen.
+
+* New -W flag highlights the first new line after any forward movement.
+
+* Window resize works even if LINES and/or COLUMNS environment 
+  variables are incorrect.
+
+* New percent escapes for prompt strings:
+  %d is replaced by the page number, and
+  %D is replaced by the number of pages in the file.
+
+* Added charsets "iso8859" and "ebcdic".
+
+* In Windows version, uses HOMEDRIVE and HOMEPATH if HOME is not defined.
+
+* Fixed some bugs causing incorrect display on DOS/Windows.
+
+======================================================================
+
+
+       Major changes between "less" versions 330 and 332
+
+* Filenames from the command line are entered into the command history,
+  so UPARROW/DOWNARROW can be used to retrieve them from the :e command.
+
+* Now works correctly on Windows when using a scrolling terminal
+  window (buffer larger than display window).
+
+* On Windows, now restores the console screen on exit.  
+  Use -X to get the old behavior.
+
+* Fixed bug on Windows when CAPS-LOCK or NUM-LOCK is pressed.
+
+* Fixed bug on Windows when piping output of an interactive program.
+
+* Fixed bug in tags file processing when tags file has DOS-style
+  line terminators (CR/LF).
+
+* Fixed compilation problem on OS/2.
+
+======================================================================
+
+
+       Major changes between "less" versions 321 and 330
+
+* Now supports filenames containing spaces (in double quotes).
+  New option -" can be used to change the quoting characters.
+
+* In filename completion, a slash is appended to a directory name.
+  If the environment variable LESSSEPARATOR is set, the value of
+  that variable, rather than a slash, is appended.
+
+* LeftArrow and RightArrow are same as ESC-[ and ESC-].
+
+* Added commands ESC-( and ESC-), same as ESC-[ and ESC-].
+
+* A "quit" command defined in a lesskey file may now have an "extra" 
+  string, which is used to return an exit code from less when it quits.
+
+* New environment variables LESSMETACHARS and LESSMETAESCAPE provide
+  more control over how less interfaces to the shell.
+
+* Ported to Microsoft Visual C compiler for Windows.
+
+* Ported to DJGPP compiler for MS-DOS.
+
+* Bug fixes.
+
+======================================================================
+
+
+       Major changes between "less" versions 291 and 321
+
+* Command line at bottom of screen now scrolls, so it can be longer 
+  than the screen width.
+
+* New commands ESC-] and ESC-[ scroll the display horizontally.
+
+* New command ESC-SPACE scrolls forward a full screen, even if it
+  hits end-of-file.
+
+* Alternate modifiers for search commands: ^N is same as !,
+  ^F is same as @, and ^E is same as *.
+
+* New modifier for search commands: ^K means highlight the matches
+  currently on-screen, but don't move to the first match.
+
+* New modifier for search commands: ^R means don't use regular
+  expressions in the search.
+
+* Environment variable LESSKEY gives name of default lesskey file.
+
+* Environment variable LESSSECURE will force less to run in
+  "secure" mode.
+
+* Command line argument "--" signals that the rest of the arguments
+  are files (not option flags).
+
+* Help file (less.hlp) is no longer installed.  Help text is now 
+  embedded in the less executable itself.
+
+* Added -Ph to change the prompt for the help text.
+  Added -Ps to change the default short prompt (same as plain -P).
+
+* Ported to the Borland C compiler for MS-DOS.
+
+* Ported to Windows 95 & Windows NT.
+
+* Ported to OS-9.
+
+* Ported to GNU Hurd.
+
+======================================================================
+
+
+       Major changes between "less" versions 290 and 291
+
+* Less environment variables can be specified in lesskey files.
+
+* Fixed MS-DOS build.
+
+======================================================================
+
+
+       Major changes between "less" versions 278 and 290
+
+* Accepts GNU-style options "--help" and "--version".
+
+* OS/2 version looks for less.ini in $HOME before $INIT and $PATH.
+
+* Bug fixes
+
+======================================================================
+
+
+       Major changes between "less" versions 252 and 278
+
+* A LESSOPEN preprocessor may now pipe the converted file data to less,
+  rather than writing it to a temporary file.
+
+* Search pattern highlighting has been fixed.  It now highlights 
+  reliably, even if a string is split across two screen lines,
+  contains TABs, etc.
+
+* The -F flag (which suppress search highlighting) has been changed 
+  to -G.  A new flag, -g, changes search highlighting to highlight 
+  only the string found by the last search command, instead of all 
+  strings which match the last search command.
+
+* New flag -I acts like -i, but ignores case even if the search 
+  pattern contains uppercase letters.
+
+* Less now checks for the environment variable VISUAL before EDITOR.
+
+* Ported to OS/2.
+
+======================================================================
+
+
+       Major changes between "less" versions 237 and 252
+
+* Changes in line-editing keys:
+  The literal key is now ^V or ^A rather than \ (backslash).
+  Filename completion commands (TAB and ^L) are disabled 
+  when typing a search pattern.
+
+* Line-editing command keys can be redefined using lesskey.
+
+* Lesskey with no input file defaults to $HOME/.lesskey
+  rather than standard input.
+
+* New option -V displays version number of less.
+
+* New option -V displays version number of lesskey.
+
+* Help file less.hlp is now installed by default in /usr/local/share 
+  rather than /usr/local/lib.
+
+
+======================================================================
+
+
+       Major changes between "less" versions 170 and 237
+
+* By popular demand, text which matches the current search pattern
+  is highlighted.  New -F flag disables this feature.
+
+* Henry Spencer's regexp.c is now included, for systems which do not
+  have a regular expression library.
+  regexp.c is Copyright (c) 1986 by University of Toronto.
+
+* New line-editing keys, including command history (arrow keys) and 
+  filename completion (TAB).
+
+* Input preprocessor allows modification of input files (e.g. uncompress)
+  via LESSOPEN/LESSCLOSE environment variables.
+
+* New -X flag disables sending termcap "ti" and "te" (initialize and
+  deinitialize) strings to the terminal. 
+
+* Changing -i from within less now correctly affects a subsequent
+  repeated search.  
+
+* Searching for underlined or overstruck text now works when the -u
+  flag is in effect, rather than the -i flag.
+
+* Use setlocale (LANG and LC_CTYPE environment variables) to determine
+  the character set if LESSCHARSET/LESSCHARDEF are not set.
+
+* The default format for displaying binary characters is now standout
+  (reverse video) rather than blinking.  This can still be changed by
+  setting the LESSBINFMT environment variable.
+
+* Use autoconf installation technology.
+
+* Ported to MS-DOS.
+
+        ********************************
+          Things that may surprise you
+        ********************************
+
+* When you enter text at the bottom of the screen (search string, 
+  filename, etc.), some keys act different than previously.  
+  Specifically, \ (backslash), ESC, TAB, BACKTAB, and control-L 
+  now have line editing functions.
+
+* Some previous unofficial versions of less were able to display
+  compressed files.  The new LESSOPEN/LESSCLOSE feature now provides
+  this functionality in a different way.
+
+* Some previous unofficial versions of less provided a -Z flag to 
+  set the number of lines of text to retain between full screen scrolls.
+  The -z-n flag (that is, -z with a negative number) provides this 
+  functionality.
+
+
+======================================================================
+
+
+       Major changes between "less" versions 123 and 170
+
+* New option -j allows target lines to be positioned anywhere on screen.
+
+* New option -S truncates displayed line at the screen width,
+  rather than wrapping onto the next line.
+
+* New option -y limits amount of forward scroll.
+
+* New option -T specifies a "tags" file.
+
+* Non-printable, non-control characters are displayed in octal.
+  Such characters, as well as control characters, are displayed 
+  in blinking mode.
+
+* New command -+ sets an option to its default.
+* New command -- sets an option to the opposite of its default.
+
+* Lesskey file may have a string appended to a key's action,
+  which acts as though typed in after the command.
+
+* New commands ESC-^F and ESC-^B match arbitrary types of brackets.
+
+* New command F monitors a growing file (like "tail -f").
+
+* New command | pipes a section of the input file into a shell command.
+
+* New command :x directly jumps to a file in the command line list.
+
+* Search commands have been enhanced and reorganized:
+       n       Repeat search, same direction.
+       N       Repeat search, opposite direction.
+       ESC-/   Search forward thru file boundaries
+       ESC-?   Search backward thru file boundaries
+       ESC-n   Repeat search thru file boundaries, same direction.
+       ESC-N   Repeat search thru file boundaries, opposite direction.
+  Special character * causes search to search thru file boundaries.
+  Special character @ causes search to begin at start/end of file list.
+
+* Examining a new file adds it to the command line list.
+  A list of files, or an expression which matches more than one file,
+  may be examined; all of them are added to the command line list.
+
+* Environment variables LESSCHARSET and LESSCHARDEF can define
+  a non-ASCII character set.
+
+* Partial support for MSDOS, including options -R for repainting screen
+  on quit, -v/-V to select video mode, and -W to change window size.
+
+
+======================================================================
+
+
+       Major changes between "less" versions 97 and 123
+
+* New option (-N) causes line numbers to be displayed in the
+  text of the file (like vi "set nu").
+
+* New option (-?) prints help message immediately.
+
+* New option (-r) displays "raw" control characters, without
+  mapping them to ^X notation.
+
+* New option (-f) forces less to open non-regular files
+  (directories, etc).
+
+* New option (-k) can be used to specify lesskey files by name.
+
+* New option (-y) can be used to set a forward scroll limit
+  (like -h sets a backward scroll limit).
+
+* File marks (set by the m command) are now preserved when a new
+  file is edited.  The ' command can thus be used to switch files.
+
+* New command ESC-/ searches all files (on the command line) 
+  for a pattern.
+
+* New command ESC-n repeats previous search, spanning files.
+
+* The N command has been changed to repeat the previous search
+  in the reverse direction.  The old N command is still available 
+  via :n.
+
+* New command ESC-N repeats previous search in the reverse
+  direction and spanning files.
+
+* 8 bit characters are now supported.  A new option (-g) can be 
+  used to strip off the eighth bit (the previous behavior).
+
+* Options which take a following string (like -t) may now
+  optionally have a space between the option letter and the string.
+
+* Six new commands { } ( ) [ and ] can be used to match
+  brackets of specific types, similar to vi % command.
+
+* New commands z and w move forward/backward one window and
+  simultaneously set the window size.
+
+* Prompt string expansion now has %L for line number of the last
+  line in the file, and %E for the name of the editor.
+  Also, % escapes which refer to a line (b=bottom, t=top, etc.)
+  can use j for the jump target line.
+
+* New environment variable LESSEDIT can be used to tailor the
+  command string passed to the editor by the v command.
+
+* Examining a file which was previously examined will return
+  to the same position in the file.
+
+* A "%" is expanded to the current filename and a "#" to the 
+  previous filename, in both shell commands and the E command.
+  (Previously % worked only in shell commands and # worked 
+  only in the E command.)
+
+* New command ":ta" is equivalent to "-t".
+
+* New command "s" is equivalent to "-l".
+
+* The - command may be followed by "+X" to revert to the default
+  for option X, or "-X" to get the opposite of the default.
+
+* Lesskey files may now include characters after the action as
+  extra input to be parsed after the action; for example:
+  "toggle-option X" to toggle a specific option X.
diff --git a/contrib/less-381/README b/contrib/less-381/README
new file mode 100644 (file)
index 0000000..a2b9ca1
--- /dev/null
@@ -0,0 +1,235 @@
+
+                            Less, version 381
+
+    This is the distribution of less, version 381, released 17 Jan 2003.
+    This program is part of the GNU project (http://www.gnu.org).
+
+    This program is free software.  You may redistribute it and/or
+    modify it under the terms of either:
+
+    1. The GNU General Public License, as published by the Free
+       Software Foundation; either version 2, or (at your option) any
+       later version.  A copy of this license is in the file COPYING.
+    or
+    2. The Less License, in the file LICENSE.
+
+    Please report any problems to bug-less@gnu.org or markn@greenwoodsoftware.com.
+    See http://www.greenwoodsoftware.com/less for the latest info.
+    You may also contact the author at:
+          Mark Nudelman
+          Greenwood Software
+          PO Box 2402
+          El Granada, CA  94018
+          USA
+
+=========================================================================
+
+This is the distribution of "less", a paginator similar to "more" or "pg".
+
+The formatted manual page is in less.man.
+The manual page nroff source is in less.nro.
+Major changes made since the last posted version are in NEWS.
+
+=======================================================================
+INSTALLATION (Unix systems only):
+
+1. Move the distributed source to its own directory and unpack it,
+   if you have not already done so.  
+
+2. Type "sh configure".
+   This will generate a Makefile and a defines.h.
+   Warning: if you have a GNU sed, make sure it is version 2.05 or later.
+
+   The file INSTALL describes the usage of the configure program in
+   general.  In addition, these options to configure are supported:
+
+   --with-editor=program
+     Specifies the default editor program used by the "v" command.
+     The default is "vi".
+   --with-regex=lib
+     Specifies the regular expression library used by less for pattern
+     matching.  The default is "auto", which means the configure program 
+     finds a regular expression library automatically.  Other values are:
+        posix          Use the POSIX-compatible regcomp.
+        pcre           Use the PCRE library.
+        regcmp         Use the regcmp library.
+        re_comp        Use the re_comp library.
+        regcomp        Use the V8-compatible regcomp.
+        regcomp-local  Use Henry Spencer's V8-compatible regcomp
+                       (source is supplied with less).
+
+3. It is a good idea to look over the generated Makefile and defines.h
+   and make sure they look ok.  If you know of any peculiarities of
+   your system that configure might not have detected, you may fix the
+   Makefile now.  Take particular notice of the list of "terminal" 
+   libraries in the LIBS definition in the Makefile; these may need 
+   to be edited.  The terminal libraries will be some subset of
+       -lncurses  -lcurses  -ltermcap  -ltermlib
+
+   If you wish, you may edit defines.h to remove some optional features.
+   If you wish to build a "secure" version of less (which disables all
+   features which might allow a user to do unintended things to the system
+   on which less is running), edit defines.h and define SECURE to 1.
+   If you choose not to include some features in your version, you may
+   wish to edit the manual page "less.nro" and the help page "less.hlp" 
+   to remove the descriptions of the features which you are removing.
+   If you edit less.hlp, you should run "make -f Makefile.aut help.c".
+
+4. Type "make" and watch the fun.
+
+5. If the make succeeds, it will generate the programs "less",
+   "lesskey" and "lessecho" in your current directory.  Test the 
+   generated programs.
+
+6. When satisfied that it works, if you wish to install it
+   in a public place, type "make install".
+
+   The default install destinations are:
+        Executables (less, lesskey, lessecho) in /usr/local/bin
+        Documentation (less.nro, lesskey.nro) in /usr/local/man/man1
+   If you want to install any of these files elsewhere, define
+   bindir and/or mandir to the appropriate directories.
+
+If you have any problems building or running "less", suggestions, 
+complaints, etc., you may mail to the author at markn@greenwoodsoftware.com.
+
+Note to hackers: comments noting possible improvements are enclosed
+in double curly brackets {{ like this }}.
+
+
+
+=======================================================================
+INSTALLATION (MS-DOS systems only,
+              with Microsoft C, Borland C, or DJGPP)
+
+1. Move the distributed source to its own directory.
+   Depending on your compiler, you may need to convert the source 
+   to have CR-LF rather than LF as line terminators.
+
+2. If you are using Microsoft C, rename MAKEFILE.DSU to MAKEFILE.
+   If you are using Borland C, rename MAKEFILE.DSB to MAKEFILE.
+   If you are using DJGPP, rename MAKEFILE.DSG to MAKEFILE.
+
+3. Look at MAKEFILE to make sure that the definitions for CC and LIBDIR
+   are correct.  CC should be the name of your C compiler and
+   LIBDIR should be the directory where the C libraries reside (for
+   Microsoft C only).  If these definitions need to be changed, you can
+   either modify the definitions directly in MAKEFILE, or set your
+   environment variables CC and/or LIBDIR to override the definitions
+   in MAKEFILE.
+
+4. If you wish, you may edit DEFINES.DS to remove some optional features.
+   If you choose not to include some features in your version, you may
+   wish to edit the manual page LESS.MAN and the help page HELP.C
+   to remove the descriptions of the features which you are removing.
+
+5. Run your "make" program and watch the fun.
+   If your "make" requires a flag to import environment variables,
+   you should use that flag.
+   If your compiler runs out of memory, try running "make -n >cmds.bat" 
+   and then run cmds.bat.
+
+6. If the make succeeds, it will generate the programs "LESS.EXE" and
+   "LESSKEY.EXE" in your current directory.  Test the generated programs.
+
+7. When satisfied that it works, you may wish to install LESS.EXE and
+   LESSKEY.EXE in a directory which is included in your PATH.
+
+
+
+=======================================================================
+INSTALLATION (Windows-95, Windows-98 and Windows-NT systems only,
+              with Borland C or Microsoft Visual C++)
+
+1. Move the distributed source to its own directory.
+
+2. If you are using Borland C, rename Makefile.wnb to Makefile.
+   If you are using Microsoft Visual C++, rename Makefile.wnm to Makefile.
+
+3. Check the Makefile to make sure the definitions look ok.
+
+4. If you wish, you may edit defines.wn to remove some optional features.
+   If you choose not to include some features in your version, you may
+   wish to edit the manual page less.man and the help page help.c
+   to remove the descriptions of the features which you are removing.
+
+5. Type "make" and watch the fun.
+
+6. If the make succeeds, it will generate the programs "less.exe" and
+   "lesskey.exe" in your current directory.  Test the generated programs.
+
+7. When satisfied that it works, if you wish to install it
+   in a public place, type "make install".
+   See step 6 of the Unix installation instructions for details
+   on how to change the default installation directories.
+
+
+
+=======================================================================
+INSTALLATION (OS/2 systems only,
+              with EMX C)
+
+1. Move the distributed source to its own directory.
+
+2. Rename Makefile.o2e to Makefile.
+
+3. Check the Makefile to make sure the definitions look ok.
+
+4. If you wish, you may edit defines.o2 to remove some optional features.
+   If you choose not to include some features in your version, you may
+   wish to edit the manual page less.man and the help page help.c
+   to remove the descriptions of the features which you are removing.
+
+5. Type "make" and watch the fun.
+
+6. If the make succeeds, it will generate the programs "less.exe" and
+   "lesskey.exe" in your current directory.  Test the generated programs.
+
+7. Make sure you have the emx runtime installed. You need the emx DLLs
+   emx.dll and emxlibcs.dll and also the termcap database, termcap.dat.
+   Make sure you have termcap.dat either in the default location or
+   somewhere in a directory listed in the PATH or INIT environment 
+   variables.
+
+8. When satisfied that it works, you may wish to install less.exe,
+   lesskey.exe and scrsize.exe in a directory which is included in 
+   your PATH.  scrsize.exe is required only if you use a terminal
+   emulator such as xterm or rxvt.
+
+
+
+=======================================================================
+INSTALLATION (OS-9 systems only,
+              with Microware C or Ultra C)
+
+1. Move the distributed source to its own directory.
+
+2. If you are using Microware C, rename Makefile.o9c to Makefile.
+   If you are using Ultra C, rename Makefile.o9u to Makefile.
+
+3. Check the Makefile to make sure the definitions look ok.
+
+4. If you wish, you may edit defines.o9 to remove some optional features.
+   If you choose not to include some features in your version, you may
+   wish to edit the manual page less.man and the help page help.c
+   to remove the descriptions of the features which you are removing.
+
+5. Type "dmake" and watch the fun.
+   The standard OS-9 "make" will probably not work.  If you don't
+   have dmake, you can get a copy from os9archive.rtsi.com.
+
+6. If the make succeeds, it will generate the programs "less" and
+   "lesskey" in your current directory.  Test the generated programs.
+
+7. When satisfied that it works, if you wish to install it
+   in a public place, type "dmake install".
+   See step 6 of the Unix installation instructions for details
+   on how to change the default installation directories.
+
+=======================================================================
+ACKNOWLEDGMENTS:
+  Some versions of the less distribution are packaged using 
+  Info-ZIP's compression utility.
+  Info-ZIP's software is free and can be obtained as source 
+  code or executables from various anonymous-ftp sites,
+  including ftp.uu.net:/pub/archiving/zip.
diff --git a/contrib/less-381/brac.c b/contrib/less-381/brac.c
new file mode 100644 (file)
index 0000000..43c9dac
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 1984-2002  Mark Nudelman
+ *
+ * You may distribute under the terms of either the GNU General Public
+ * License or the Less License, as specified in the README file.
+ *
+ * For more information about less, or for information on how to 
+ * contact the author, see the README file.
+ */
+
+
+/*
+ * Routines to perform bracket matching functions.
+ */
+
+#include "less.h"
+#include "position.h"
+
+/*
+ * Try to match the n-th open bracket 
+ *  which appears in the top displayed line (forwdir),
+ * or the n-th close bracket 
+ *  which appears in the bottom displayed line (!forwdir).
+ * The characters which serve as "open bracket" and 
+ * "close bracket" are given.
+ */
+       public void
+match_brac(obrac, cbrac, forwdir, n)
+       register int obrac;
+       register int cbrac;
+       int forwdir;
+       int n;
+{
+       register int c;
+       register int nest;
+       POSITION pos;
+       int (*chget)();
+
+       extern int ch_forw_get(), ch_back_get();
+
+       /*
+        * Seek to the line containing the open bracket.
+        * This is either the top or bottom line on the screen,
+        * depending on the type of bracket.
+        */
+       pos = position((forwdir) ? TOP : BOTTOM);
+       if (pos == NULL_POSITION || ch_seek(pos))
+       {
+               if (forwdir)
+                       error("Nothing in top line", NULL_PARG);
+               else
+                       error("Nothing in bottom line", NULL_PARG);
+               return;
+       }
+
+       /*
+        * Look thru the line to find the open bracket to match.
+        */
+       do
+       {
+               if ((c = ch_forw_get()) == '\n' || c == EOI)
+               {
+                       if (forwdir)
+                               error("No bracket in top line", NULL_PARG);
+                       else
+                               error("No bracket in bottom line", NULL_PARG);
+                       return;
+               }
+       } while (c != obrac || --n > 0);
+
+       /*
+        * Position the file just "after" the open bracket
+        * (in the direction in which we will be searching).
+        * If searching forward, we are already after the bracket.
+        * If searching backward, skip back over the open bracket.
+        */
+       if (!forwdir)
+               (void) ch_back_get();
+
+       /*
+        * Search the file for the matching bracket.
+        */
+       chget = (forwdir) ? ch_forw_get : ch_back_get;
+       nest = 0;
+       while ((c = (*chget)()) != EOI)
+       {
+               if (c == obrac)
+                       nest++;
+               else if (c == cbrac && --nest < 0)
+               {
+                       /*
+                        * Found the matching bracket.
+                        * If searching backward, put it on the top line.
+                        * If searching forward, put it on the bottom line.
+                        */
+                       jump_line_loc(ch_tell(), forwdir ? -1 : 1);
+                       return;
+               }
+       }
+       error("No matching bracket", NULL_PARG);
+}
diff --git a/contrib/less-381/ch.c b/contrib/less-381/ch.c
new file mode 100644 (file)
index 0000000..0446a2c
--- /dev/null
@@ -0,0 +1,841 @@
+/*
+ * Copyright (C) 1984-2002  Mark Nudelman
+ *
+ * You may distribute under the terms of either the GNU General Public
+ * License or the Less License, as specified in the README file.
+ *
+ * For more information about less, or for information on how to 
+ * contact the author, see the README file.
+ */
+
+
+/*
+ * Low level character input from the input file.
+ * We use these special purpose routines which optimize moving
+ * both forward and backward from the current read pointer.
+ */
+
+#include "less.h"
+#if MSDOS_COMPILER==WIN32C
+#include <errno.h>
+#include <windows.h>
+#endif
+
+typedef POSITION BLOCKNUM;
+
+public int ignore_eoi;
+
+/*
+ * Pool of buffers holding the most recently used blocks of the input file.
+ * The buffer pool is kept as a doubly-linked circular list,
+ * in order from most- to least-recently used.
+ * The circular list is anchored by the file state "thisfile".
+ */
+#define        LBUFSIZE        8192
+struct buf {
+       struct buf *next, *prev;
+       struct buf *hnext, *hprev;
+       BLOCKNUM block;
+       unsigned int datasize;
+       unsigned char data[LBUFSIZE];
+};
+
+struct buflist {
+       /* -- Following members must match struct buf */
+       struct buf *buf_next, *buf_prev;
+       struct buf *buf_hnext, *buf_hprev;
+};
+
+/*
+ * The file state is maintained in a filestate structure.
+ * A pointer to the filestate is kept in the ifile structure.
+ */
+#define        BUFHASH_SIZE    64
+struct filestate {
+       struct buf *buf_next, *buf_prev;
+       struct buflist hashtbl[BUFHASH_SIZE];
+       int file;
+       int flags;
+       POSITION fpos;
+       int nbufs;
+       BLOCKNUM block;
+       unsigned int offset;
+       POSITION fsize;
+};
+
+#define        ch_bufhead      thisfile->buf_next
+#define        ch_buftail      thisfile->buf_prev
+#define        ch_nbufs        thisfile->nbufs
+#define        ch_block        thisfile->block
+#define        ch_offset       thisfile->offset
+#define        ch_fpos         thisfile->fpos
+#define        ch_fsize        thisfile->fsize
+#define        ch_flags        thisfile->flags
+#define        ch_file         thisfile->file
+
+#define        END_OF_CHAIN    ((struct buf *)&thisfile->buf_next)
+#define        END_OF_HCHAIN(h) ((struct buf *)&thisfile->hashtbl[h])
+#define BUFHASH(blk)   ((blk) & (BUFHASH_SIZE-1))
+
+#define        FOR_BUFS_IN_CHAIN(h,bp) \
+       for (bp = thisfile->hashtbl[h].buf_hnext;  \
+            bp != END_OF_HCHAIN(h);  bp = bp->hnext)
+
+#define        HASH_RM(bp) \
+       (bp)->hnext->hprev = (bp)->hprev; \
+       (bp)->hprev->hnext = (bp)->hnext;
+
+#define        HASH_INS(bp,h) \
+       (bp)->hnext = thisfile->hashtbl[h].buf_hnext; \
+       (bp)->hprev = END_OF_HCHAIN(h); \
+       thisfile->hashtbl[h].buf_hnext->hprev = (bp); \
+       thisfile->hashtbl[h].buf_hnext = (bp);
+
+static struct filestate *thisfile;
+static int ch_ungotchar = -1;
+static int maxbufs = -1;
+
+extern int autobuf;
+extern int sigs;
+extern int secure;
+extern constant char helpdata[];
+extern constant int size_helpdata;
+extern IFILE curr_ifile;
+#if LOGFILE
+extern int logfile;
+extern char *namelogfile;
+#endif
+
+static int ch_addbuf();
+
+
+/*
+ * Get the character pointed to by the read pointer.
+ * ch_get() is a macro which is more efficient to call
+ * than fch_get (the function), in the usual case 
+ * that the block desired is at the head of the chain.
+ */
+#define        ch_get()   ((ch_block == ch_bufhead->block && \
+                    ch_offset < ch_bufhead->datasize) ? \
+                       ch_bufhead->data[ch_offset] : fch_get())
+       int
+fch_get()
+{
+       register struct buf *bp;
+       register int n;
+       register int slept;
+       register int h;
+       POSITION pos;
+       POSITION len;
+
+       slept = FALSE;
+
+       /*
+        * Look for a buffer holding the desired block.
+        */
+       h = BUFHASH(ch_block);
+       FOR_BUFS_IN_CHAIN(h, bp)
+       {
+               if (bp->block == ch_block)
+               {
+                       if (ch_offset >= bp->datasize)
+                               /*
+                                * Need more data in this buffer.
+                                */
+                               goto read_more;
+                       goto found;
+               }
+       }
+       /*
+        * Block is not in a buffer.  
+        * Take the least recently used buffer 
+        * and read the desired block into it.
+        * If the LRU buffer has data in it, 
+        * then maybe allocate a new buffer.
+        */
+       if (ch_buftail == END_OF_CHAIN || ch_buftail->block != -1)
+       {
+               /*
+                * There is no empty buffer to use.
+                * Allocate a new buffer if:
+                * 1. We can't seek on this file and -b is not in effect; or
+                * 2. We haven't allocated the max buffers for this file yet.
+                */
+               if ((autobuf && !(ch_flags & CH_CANSEEK)) ||
+                   (maxbufs < 0 || ch_nbufs < maxbufs))
+                       if (ch_addbuf())
+                               /*
+                                * Allocation failed: turn off autobuf.
+                                */
+                               autobuf = OPT_OFF;
+       }
+       bp = ch_buftail;
+       HASH_RM(bp); /* Remove from old hash chain. */
+       bp->block = ch_block;
+       bp->datasize = 0;
+       HASH_INS(bp, h); /* Insert into new hash chain. */
+
+    read_more:
+       pos = (ch_block * LBUFSIZE) + bp->datasize;
+       if ((len = ch_length()) != NULL_POSITION && pos >= len)
+               /*
+                * At end of file.
+                */
+               return (EOI);
+
+       if (pos != ch_fpos)
+       {
+               /*
+                * Not at the correct position: must seek.
+                * If input is a pipe, we're in trouble (can't seek on a pipe).
+                * Some data has been lost: just return "?".
+                */
+               if (!(ch_flags & CH_CANSEEK))
+                       return ('?');
+               if (lseek(ch_file, (off_t)pos, 0) == BAD_LSEEK)
+               {
+                       error("seek error", NULL_PARG);
+                       clear_eol();
+                       return (EOI);
+               }
+               ch_fpos = pos;
+       }
+
+       /*
+        * Read the block.
+        * If we read less than a full block, that's ok.
+        * We use partial block and pick up the rest next time.
+        */
+       if (ch_ungotchar != -1)
+       {
+               bp->data[bp->datasize] = ch_ungotchar;
+               n = 1;
+               ch_ungotchar = -1;
+       } else if (ch_flags & CH_HELPFILE)
+       {
+               bp->data[bp->datasize] = helpdata[ch_fpos];
+               n = 1;
+       } else
+       {
+               n = iread(ch_file, &bp->data[bp->datasize], 
+                       (unsigned int)(LBUFSIZE - bp->datasize));
+       }
+
+       if (n == READ_INTR)
+               return (EOI);
+       if (n < 0)
+       {
+#if MSDOS_COMPILER==WIN32C
+               if (errno != EPIPE)
+#endif
+               {
+                       error("read error", NULL_PARG);
+                       clear_eol();
+               }
+               n = 0;
+       }
+
+#if LOGFILE
+       /*
+        * If we have a log file, write the new data to it.
+        */
+       if (!secure && logfile >= 0 && n > 0)
+               write(logfile, (char *) &bp->data[bp->datasize], n);
+#endif
+
+       ch_fpos += n;
+       bp->datasize += n;
+
+       /*
+        * If we have read to end of file, set ch_fsize to indicate
+        * the position of the end of file.
+        */
+       if (n == 0)
+       {
+               ch_fsize = pos;
+               if (ignore_eoi)
+               {
+                       /*
+                        * We are ignoring EOF.
+                        * Wait a while, then try again.
+                        */
+                       if (!slept)
+                       {
+                               PARG parg;
+                               parg.p_string = wait_message();
+                               ierror("%s", &parg);
+                       }
+#if !MSDOS_COMPILER
+                       sleep(1);
+#else
+#if MSDOS_COMPILER==WIN32C
+                       Sleep(1000);
+#endif
+#endif
+                       slept = TRUE;
+               }
+               if (sigs)
+                       return (EOI);
+       }
+
+    found:
+       if (ch_bufhead != bp)
+       {
+               /*
+                * Move the buffer to the head of the buffer chain.
+                * This orders the buffer chain, most- to least-recently used.
+                */
+               bp->next->prev = bp->prev;
+               bp->prev->next = bp->next;
+               bp->next = ch_bufhead;
+               bp->prev = END_OF_CHAIN;
+               ch_bufhead->prev = bp;
+               ch_bufhead = bp;
+
+               /*
+                * Move to head of hash chain too.
+                */
+               HASH_RM(bp);
+               HASH_INS(bp, h);
+       }
+
+       if (ch_offset >= bp->datasize)
+               /*
+                * After all that, we still don't have enough data.
+                * Go back and try again.
+                */
+               goto read_more;
+
+       return (bp->data[ch_offset]);
+}
+
+/*
+ * ch_ungetchar is a rather kludgy and limited way to push 
+ * a single char onto an input file descriptor.
+ */
+       public void
+ch_ungetchar(c)
+       int c;
+{
+       if (c != -1 && ch_ungotchar != -1)
+               error("ch_ungetchar overrun", NULL_PARG);
+       ch_ungotchar = c;
+}
+
+#if LOGFILE
+/*
+ * Close the logfile.
+ * If we haven't read all of standard input into it, do that now.
+ */
+       public void
+end_logfile()
+{
+       static int tried = FALSE;
+
+       if (logfile < 0)
+               return;
+       if (!tried && ch_fsize == NULL_POSITION)
+       {
+               tried = TRUE;
+               ierror("Finishing logfile", NULL_PARG);
+               while (ch_forw_get() != EOI)
+                       if (ABORT_SIGS())
+                               break;
+       }
+       close(logfile);
+       logfile = -1;
+       namelogfile = NULL;
+}
+
+/*
+ * Start a log file AFTER less has already been running.
+ * Invoked from the - command; see toggle_option().
+ * Write all the existing buffered data to the log file.
+ */
+       public void
+sync_logfile()
+{
+       register struct buf *bp;
+       int warned = FALSE;
+       BLOCKNUM block;
+       BLOCKNUM nblocks;
+
+       nblocks = (ch_fpos + LBUFSIZE - 1) / LBUFSIZE;
+       for (block = 0;  block < nblocks;  block++)
+       {
+               for (bp = ch_bufhead;  ;  bp = bp->next)
+               {
+                       if (bp == END_OF_CHAIN)
+                       {
+                               if (!warned)
+                               {
+                                       error("Warning: log file is incomplete",
+                                               NULL_PARG);
+                                       warned = TRUE;
+                               }
+                               break;
+                       }
+                       if (bp->block == block)
+                       {
+                               write(logfile, (char *) bp->data, bp->datasize);
+                               break;
+                       }
+               }
+       }
+}
+
+#endif
+
+/*
+ * Determine if a specific block is currently in one of the buffers.
+ */
+       static int
+buffered(block)
+       BLOCKNUM block;
+{
+       register struct buf *bp;
+       register int h;
+
+       h = BUFHASH(block);
+       FOR_BUFS_IN_CHAIN(h, bp)
+       {
+               if (bp->block == block)
+                       return (TRUE);
+       }
+       return (FALSE);
+}
+
+/*
+ * Seek to a specified position in the file.
+ * Return 0 if successful, non-zero if can't seek there.
+ */
+       public int
+ch_seek(pos)
+       register POSITION pos;
+{
+       BLOCKNUM new_block;
+       POSITION len;
+
+       len = ch_length();
+       if (pos < ch_zero() || (len != NULL_POSITION && pos > len))
+               return (1);
+
+       new_block = pos / LBUFSIZE;
+       if (!(ch_flags & CH_CANSEEK) && pos != ch_fpos && !buffered(new_block))
+       {
+               if (ch_fpos > pos)
+                       return (1);
+               while (ch_fpos < pos)
+               {
+                       if (ch_forw_get() == EOI)
+                               return (1);
+                       if (ABORT_SIGS())
+                               return (1);
+               }
+               return (0);
+       }
+       /*
+        * Set read pointer.
+        */
+       ch_block = new_block;
+       ch_offset = pos % LBUFSIZE;
+       return (0);
+}
+
+/*
+ * Seek to the end of the file.
+ */
+       public int
+ch_end_seek()
+{
+       POSITION len;
+
+       if (ch_flags & CH_CANSEEK)
+               ch_fsize = filesize(ch_file);
+
+       len = ch_length();
+       if (len != NULL_POSITION)
+               return (ch_seek(len));
+
+       /*
+        * Do it the slow way: read till end of data.
+        */
+       while (ch_forw_get() != EOI)
+               if (ABORT_SIGS())
+                       return (1);
+       return (0);
+}
+
+/*
+ * Seek to the beginning of the file, or as close to it as we can get.
+ * We may not be able to seek there if input is a pipe and the
+ * beginning of the pipe is no longer buffered.
+ */
+       public int
+ch_beg_seek()
+{
+       register struct buf *bp, *firstbp;
+
+       /*
+        * Try a plain ch_seek first.
+        */
+       if (ch_seek(ch_zero()) == 0)
+               return (0);
+
+       /*
+        * Can't get to position 0.
+        * Look thru the buffers for the one closest to position 0.
+        */
+       firstbp = bp = ch_bufhead;
+       if (bp == END_OF_CHAIN)
+               return (1);
+       while ((bp = bp->next) != END_OF_CHAIN)
+               if (bp->block < firstbp->block)
+                       firstbp = bp;
+       ch_block = firstbp->block;
+       ch_offset = 0;
+       return (0);
+}
+
+/*
+ * Return the length of the file, if known.
+ */
+       public POSITION
+ch_length()
+{
+       if (ignore_eoi)
+               return (NULL_POSITION);
+       if (ch_flags & CH_HELPFILE)
+               return (size_helpdata);
+       return (ch_fsize);
+}
+
+/*
+ * Return the current position in the file.
+ */
+       public POSITION
+ch_tell()
+{
+       return (ch_block * LBUFSIZE) + ch_offset;
+}
+
+/*
+ * Get the current char and post-increment the read pointer.
+ */
+       public int
+ch_forw_get()
+{
+       register int c;
+
+       c = ch_get();
+       if (c == EOI)
+               return (EOI);
+       if (ch_offset < LBUFSIZE-1)
+               ch_offset++;
+       else
+       {
+               ch_block ++;
+               ch_offset = 0;
+       }
+       return (c);
+}
+
+/*
+ * Pre-decrement the read pointer and get the new current char.
+ */
+       public int
+ch_back_get()
+{
+       if (ch_offset > 0)
+               ch_offset --;
+       else
+       {
+               if (ch_block <= 0)
+                       return (EOI);
+               if (!(ch_flags & CH_CANSEEK) && !buffered(ch_block-1))
+                       return (EOI);
+               ch_block--;
+               ch_offset = LBUFSIZE-1;
+       }
+       return (ch_get());
+}
+
+/*
+ * Set max amount of buffer space.
+ * bufspace is in units of 1024 bytes.  -1 mean no limit.
+ */
+       public void
+ch_setbufspace(bufspace)
+       int bufspace;
+{
+       if (bufspace < 0)
+               maxbufs = -1;
+       else
+       {
+               maxbufs = ((bufspace * 1024) + LBUFSIZE-1) / LBUFSIZE;
+               if (maxbufs < 1)
+                       maxbufs = 1;
+       }
+}
+
+/*
+ * Flush (discard) any saved file state, including buffer contents.
+ */
+       public void
+ch_flush()
+{
+       register struct buf *bp;
+
+       if (!(ch_flags & CH_CANSEEK))
+       {
+               /*
+                * If input is a pipe, we don't flush buffer contents,
+                * since the contents can't be recovered.
+                */
+               ch_fsize = NULL_POSITION;
+               return;
+       }
+
+       /*
+        * Initialize all the buffers.
+        */
+       for (bp = ch_bufhead;  bp != END_OF_CHAIN;  bp = bp->next)
+               bp->block = -1;
+
+       /*
+        * Figure out the size of the file, if we can.
+        */
+       ch_fsize = filesize(ch_file);
+
+       /*
+        * Seek to a known position: the beginning of the file.
+        */
+       ch_fpos = 0;
+       ch_block = 0; /* ch_fpos / LBUFSIZE; */
+       ch_offset = 0; /* ch_fpos % LBUFSIZE; */
+
+#if 1
+       /*
+        * This is a kludge to workaround a Linux kernel bug: files in
+        * /proc have a size of 0 according to fstat() but have readable 
+        * data.  They are sometimes, but not always, seekable.
+        * Force them to be non-seekable here.
+        */
+       if (ch_fsize == 0)
+       {
+               ch_fsize = NULL_POSITION;
+               ch_flags &= ~CH_CANSEEK;
+       }
+#endif
+
+       if (lseek(ch_file, (off_t)0, 0) == BAD_LSEEK)
+       {
+               /*
+                * Warning only; even if the seek fails for some reason,
+                * there's a good chance we're at the beginning anyway.
+                * {{ I think this is bogus reasoning. }}
+                */
+               error("seek error to 0", NULL_PARG);
+       }
+}
+
+/*
+ * Allocate a new buffer.
+ * The buffer is added to the tail of the buffer chain.
+ */
+       static int
+ch_addbuf()
+{
+       register struct buf *bp;
+
+       /*
+        * Allocate and initialize a new buffer and link it 
+        * onto the tail of the buffer list.
+        */
+       bp = (struct buf *) calloc(1, sizeof(struct buf));
+       if (bp == NULL)
+               return (1);
+       ch_nbufs++;
+       bp->block = -1;
+       bp->next = END_OF_CHAIN;
+       bp->prev = ch_buftail;
+       ch_buftail->next = bp;
+       ch_buftail = bp;
+       HASH_INS(bp, 0);
+       return (0);
+}
+
+/*
+ *
+ */
+       static void
+init_hashtbl()
+{
+       register int h;
+
+       for (h = 0;  h < BUFHASH_SIZE;  h++)
+       {
+               thisfile->hashtbl[h].buf_hnext = END_OF_HCHAIN(h);
+               thisfile->hashtbl[h].buf_hprev = END_OF_HCHAIN(h);
+       }
+}
+
+/*
+ * Delete all buffers for this file.
+ */
+       static void
+ch_delbufs()
+{
+       register struct buf *bp;
+
+       while (ch_bufhead != END_OF_CHAIN)
+       {
+               bp = ch_bufhead;
+               bp->next->prev = bp->prev;;
+               bp->prev->next = bp->next;
+               free(bp);
+       }
+       ch_nbufs = 0;
+       init_hashtbl();
+}
+
+/*
+ * Is it possible to seek on a file descriptor?
+ */
+       public int
+seekable(f)
+       int f;
+{
+#if MSDOS_COMPILER
+       extern int fd0;
+       if (f == fd0 && !isatty(fd0))
+       {
+               /*
+                * In MS-DOS, pipes are seekable.  Check for
+                * standard input, and pretend it is not seekable.
+                */
+               return (0);
+       }
+#endif
+       return (lseek(f, (off_t)1, 0) != BAD_LSEEK);
+}
+
+/*
+ * Initialize file state for a new file.
+ */
+       public void
+ch_init(f, flags)
+       int f;
+       int flags;
+{
+       /*
+        * See if we already have a filestate for this file.
+        */
+       thisfile = (struct filestate *) get_filestate(curr_ifile);
+       if (thisfile == NULL)
+       {
+               /*
+                * Allocate and initialize a new filestate.
+                */
+               thisfile = (struct filestate *) 
+                               calloc(1, sizeof(struct filestate));
+               thisfile->buf_next = thisfile->buf_prev = END_OF_CHAIN;
+               thisfile->nbufs = 0;
+               thisfile->flags = 0;
+               thisfile->fpos = 0;
+               thisfile->block = 0;
+               thisfile->offset = 0;
+               thisfile->file = -1;
+               thisfile->fsize = NULL_POSITION;
+               ch_flags = flags;
+               init_hashtbl();
+               /*
+                * Try to seek; set CH_CANSEEK if it works.
+                */
+               if ((flags & CH_CANSEEK) && !seekable(f))
+                       ch_flags &= ~CH_CANSEEK;
+               set_filestate(curr_ifile, (void *) thisfile);
+       }
+       if (thisfile->file == -1)
+               thisfile->file = f;
+       ch_flush();
+}
+
+/*
+ * Close a filestate.
+ */
+       public void
+ch_close()
+{
+       int keepstate = FALSE;
+
+       if (ch_flags & (CH_CANSEEK|CH_POPENED|CH_HELPFILE))
+       {
+               /*
+                * We can seek or re-open, so we don't need to keep buffers.
+                */
+               ch_delbufs();
+       } else
+               keepstate = TRUE;
+       if (!(ch_flags & CH_KEEPOPEN))
+       {
+               /*
+                * We don't need to keep the file descriptor open
+                * (because we can re-open it.)
+                * But don't really close it if it was opened via popen(),
+                * because pclose() wants to close it.
+                */
+               if (!(ch_flags & (CH_POPENED|CH_HELPFILE)))
+                       close(ch_file);
+               ch_file = -1;
+       } else
+               keepstate = TRUE;
+       if (!keepstate)
+       {
+               /*
+                * We don't even need to keep the filestate structure.
+                */
+               free(thisfile);
+               thisfile = NULL;
+               set_filestate(curr_ifile, (void *) NULL);
+       }
+}
+
+/*
+ * Return ch_flags for the current file.
+ */
+       public int
+ch_getflags()
+{
+       return (ch_flags);
+}
+
+#if 0
+       public void
+ch_dump(struct filestate *fs)
+{
+       struct buf *bp;
+       unsigned char *s;
+
+       if (fs == NULL)
+       {
+               printf(" --no filestate\n");
+               return;
+       }
+       printf(" file %d, flags %x, fpos %x, fsize %x, blk/off %x/%x\n",
+               fs->file, fs->flags, fs->fpos, 
+               fs->fsize, fs->block, fs->offset);
+       printf(" %d bufs:\n", fs->nbufs);
+       for (bp = fs->buf_next; bp != (struct buf *)fs;  bp = bp->next)
+       {
+               printf("%x: blk %x, size %x \"",
+                       bp, bp->block, bp->datasize);
+               for (s = bp->data;  s < bp->data + 30;  s++)
+                       if (*s >= ' ' && *s < 0x7F)
+                               printf("%c", *s);
+                       else
+                               printf(".");
+               printf("\"\n");
+       }
+}
+#endif
diff --git a/contrib/less-381/charset.c b/contrib/less-381/charset.c
new file mode 100644 (file)
index 0000000..163994f
--- /dev/null
@@ -0,0 +1,336 @@
+/*
+ * Copyright (C) 1984-2002  Mark Nudelman
+ *
+ * You may distribute under the terms of either the GNU General Public
+ * License or the Less License, as specified in the README file.
+ *
+ * For more information about less, or for information on how to 
+ * contact the author, see the README file.
+ */
+
+
+/*
+ * Functions to define the character set
+ * and do things specific to the character set.
+ */
+
+#include "less.h"
+#if HAVE_LOCALE
+#include <locale.h>
+#include <ctype.h>
+#endif
+
+public int utf_mode = 0;
+
+/*
+ * Predefined character sets,
+ * selected by the LESSCHARSET environment variable.
+ */
+struct charset {
+       char *name;
+       int *p_flag;
+       char *desc;
+} charsets[] = {
+       { "ascii",      NULL,       "8bcccbcc18b95.b" },
+       { "dos",        NULL,       "8bcccbcc12bc5b223.b" },
+       { "ebcdic",     NULL,       "5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b." },
+       { "IBM-1047",   NULL,       "4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc191.b" },
+       { "iso8859",    NULL,       "8bcccbcc18b95.33b." },
+       { "koi8-r",     NULL,       "8bcccbcc18b95.b128." },
+       { "next",       NULL,       "8bcccbcc18b95.bb125.bb" },
+       { "utf-8",      &utf_mode,  "8bcccbcc18b." },
+       { NULL, NULL, NULL }
+};
+
+struct cs_alias {
+       char *name;
+       char *oname;
+} cs_aliases[] = {
+       { "latin1",     "iso8859" },
+       { "latin9",     "iso8859" },
+       { NULL, NULL }
+};
+
+#define        IS_BINARY_CHAR  01
+#define        IS_CONTROL_CHAR 02
+
+static char chardef[256];
+static char *binfmt = NULL;
+public int binattr = AT_STANDOUT;
+
+
+/*
+ * Define a charset, given a description string.
+ * The string consists of 256 letters,
+ * one for each character in the charset.
+ * If the string is shorter than 256 letters, missing letters
+ * are taken to be identical to the last one.
+ * A decimal number followed by a letter is taken to be a 
+ * repetition of the letter.
+ *
+ * Each letter is one of:
+ *     . normal character
+ *     b binary character
+ *     c control character
+ */
+       static void
+ichardef(s)
+       char *s;
+{
+       register char *cp;
+       register int n;
+       register char v;
+
+       n = 0;
+       v = 0;
+       cp = chardef;
+       while (*s != '\0')
+       {
+               switch (*s++)
+               {
+               case '.':
+                       v = 0;
+                       break;
+               case 'c':
+                       v = IS_CONTROL_CHAR;
+                       break;
+               case 'b':
+                       v = IS_BINARY_CHAR|IS_CONTROL_CHAR;
+                       break;
+
+               case '0': case '1': case '2': case '3': case '4':
+               case '5': case '6': case '7': case '8': case '9':
+                       n = (10 * n) + (s[-1] - '0');
+                       continue;
+
+               default:
+                       error("invalid chardef", NULL_PARG);
+                       quit(QUIT_ERROR);
+                       /*NOTREACHED*/
+               }
+
+               do
+               {
+                       if (cp >= chardef + sizeof(chardef))
+                       {
+                               error("chardef longer than 256", NULL_PARG);
+                               quit(QUIT_ERROR);
+                               /*NOTREACHED*/
+                       }
+                       *cp++ = v;
+               } while (--n > 0);
+               n = 0;
+       }
+
+       while (cp < chardef + sizeof(chardef))
+               *cp++ = v;
+}
+
+/*
+ * Define a charset, given a charset name.
+ * The valid charset names are listed in the "charsets" array.
+ */
+       static int
+icharset(name)
+       register char *name;
+{
+       register struct charset *p;
+       register struct cs_alias *a;
+
+       if (name == NULL || *name == '\0')
+               return (0);
+
+       /* First see if the name is an alias. */
+       for (a = cs_aliases;  a->name != NULL;  a++)
+       {
+               if (strcmp(name, a->name) == 0)
+               {
+                       name = a->oname;
+                       break;
+               }
+       }
+
+       for (p = charsets;  p->name != NULL;  p++)
+       {
+               if (strcmp(name, p->name) == 0)
+               {
+                       ichardef(p->desc);
+                       if (p->p_flag != NULL)
+                               *(p->p_flag) = 1;
+                       return (1);
+               }
+       }
+
+       error("invalid charset name", NULL_PARG);
+       quit(QUIT_ERROR);
+       /*NOTREACHED*/
+       return (0);
+}
+
+#if HAVE_LOCALE
+/*
+ * Define a charset, given a locale name.
+ */
+       static void
+ilocale()
+{
+       register int c;
+
+       setlocale(LC_ALL, "");
+       for (c = 0;  c < (int) sizeof(chardef);  c++)
+       {
+               if (isprint(c))
+                       chardef[c] = 0;
+               else if (iscntrl(c))
+                       chardef[c] = IS_CONTROL_CHAR;
+               else
+                       chardef[c] = IS_BINARY_CHAR|IS_CONTROL_CHAR;
+       }
+}
+#endif
+
+/*
+ * Define the printing format for control chars.
+ */
+       public void
+setbinfmt(s)
+       char *s;
+{
+       if (s == NULL || *s == '\0')
+               s = "*s<%X>";
+       /*
+        * Select the attributes if it starts with "*".
+        */
+       if (*s == '*')
+       {
+               switch (s[1])
+               {
+               case 'd':  binattr = AT_BOLD;      break;
+               case 'k':  binattr = AT_BLINK;     break;
+               case 's':  binattr = AT_STANDOUT;  break;
+               case 'u':  binattr = AT_UNDERLINE; break;
+               default:   binattr = AT_NORMAL;    break;
+               }
+               s += 2;
+       }
+       binfmt = s;
+}
+
+/*
+ * Initialize charset data structures.
+ */
+       public void
+init_charset()
+{
+       register char *s;
+
+       s = lgetenv("LESSBINFMT");
+       setbinfmt(s);
+       
+       /*
+        * See if environment variable LESSCHARSET is defined.
+        */
+       s = lgetenv("LESSCHARSET");
+       if (icharset(s))
+               return;
+       /*
+        * LESSCHARSET is not defined: try LESSCHARDEF.
+        */
+       s = lgetenv("LESSCHARDEF");
+       if (s != NULL && *s != '\0')
+       {
+               ichardef(s);
+               return;
+       }
+
+#if HAVE_STRSTR
+       /*
+        * Check whether LC_ALL, LC_CTYPE or LANG look like UTF-8 is used.
+        */
+       if ((s = lgetenv("LC_ALL")) != NULL ||
+           (s = lgetenv("LC_CTYPE")) != NULL ||
+           (s = lgetenv("LANG")) != NULL)
+       {
+               if (strstr(s, "UTF-8") != NULL || strstr(s, "utf-8") != NULL)
+                       if (icharset("utf-8"))
+                               return;
+       }
+#endif
+
+#if HAVE_LOCALE
+       /*
+        * Use setlocale.
+        */
+       ilocale();
+#else
+#if MSDOS_COMPILER
+       /*
+        * Default to "dos".
+        */
+       (void) icharset("dos");
+#else
+       /*
+        * Default to "latin1".
+        */
+       (void) icharset("latin1");
+#endif
+#endif
+}
+
+/*
+ * Is a given character a "binary" character?
+ */
+       public int
+binary_char(c)
+       unsigned char c;
+{
+       c &= 0377;
+       return (chardef[c] & IS_BINARY_CHAR);
+}
+
+/*
+ * Is a given character a "control" character?
+ */
+       public int
+control_char(c)
+       int c;
+{
+       c &= 0377;
+       return (chardef[c] & IS_CONTROL_CHAR);
+}
+
+/*
+ * Return the printable form of a character.
+ * For example, in the "ascii" charset '\3' is printed as "^C".
+ */
+       public char *
+prchar(c)
+       int c;
+{
+       static char buf[8];
+
+       c &= 0377;
+       if (!control_char(c))
+               sprintf(buf, "%c", c);
+       else if (c == ESC)
+               sprintf(buf, "ESC");
+#if IS_EBCDIC_HOST
+       else if (!binary_char(c) && c < 64)
+               sprintf(buf, "^%c",
+               /*
+                * This array roughly inverts CONTROL() #defined in less.h,
+                * and should be kept in sync with CONTROL() and IBM-1047.
+                */
+               "@ABC.I.?...KLMNO"
+               "PQRS.JH.XY.."
+               "\\]^_"
+               "......W[.....EFG"
+               "..V....D....TU.Z"[c]);
+#else
+       else if (c < 128 && !control_char(c ^ 0100))
+               sprintf(buf, "^%c", c ^ 0100);
+#endif
+       else
+               sprintf(buf, binfmt, c);
+       return (buf);
+}
diff --git a/contrib/less-381/cmd.h b/contrib/less-381/cmd.h
new file mode 100644 (file)
index 0000000..8f300db
--- /dev/null
@@ -0,0 +1,131 @@
+/*
+ * Copyright (C) 1984-2002  Mark Nudelman
+ *
+ * You may distribute under the terms of either the GNU General Public
+ * License or the Less License, as specified in the README file.
+ *
+ * For more information about less, or for information on how to 
+ * contact the author, see the README file.
+ */
+
+
+#define        MAX_USERCMD             500
+#define        MAX_CMDLEN              16
+
+#define        A_B_LINE                2
+#define        A_B_SCREEN              3
+#define        A_B_SCROLL              4
+#define        A_B_SEARCH              5
+#define        A_DIGIT                 6
+#define        A_DISP_OPTION           7
+#define        A_DEBUG                 8
+#define        A_EXAMINE               9
+#define        A_FIRSTCMD              10
+#define        A_FREPAINT              11
+#define        A_F_LINE                12
+#define        A_F_SCREEN              13
+#define        A_F_SCROLL              14
+#define        A_F_SEARCH              15
+#define        A_GOEND                 16
+#define        A_GOLINE                17
+#define        A_GOMARK                18
+#define        A_HELP                  19
+#define        A_NEXT_FILE             20
+#define        A_PERCENT               21
+#define        A_PREFIX                22
+#define        A_PREV_FILE             23
+#define        A_QUIT                  24
+#define        A_REPAINT               25
+#define        A_SETMARK               26
+#define        A_SHELL                 27
+#define        A_STAT                  28
+#define        A_FF_LINE               29
+#define        A_BF_LINE               30
+#define        A_VERSION               31
+#define        A_VISUAL                32
+#define        A_F_WINDOW              33
+#define        A_B_WINDOW              34
+#define        A_F_BRACKET             35
+#define        A_B_BRACKET             36
+#define        A_PIPE                  37
+#define        A_INDEX_FILE            38
+#define        A_UNDO_SEARCH           39
+#define        A_FF_SCREEN             40
+#define        A_LSHIFT                41
+#define        A_RSHIFT                42
+#define        A_AGAIN_SEARCH          43
+#define        A_T_AGAIN_SEARCH        44
+#define        A_REVERSE_SEARCH        45
+#define        A_T_REVERSE_SEARCH      46
+#define        A_OPT_TOGGLE            47
+#define        A_OPT_SET               48
+#define        A_OPT_UNSET             49
+#define        A_F_FOREVER             50
+#define        A_GOPOS                 51
+#define        A_REMOVE_FILE           52
+#define        A_NEXT_TAG              53
+#define        A_PREV_TAG              54
+
+#define        A_INVALID               100
+#define        A_NOACTION              101
+#define        A_UINVALID              102
+#define        A_END_LIST              103
+#define        A_SPECIAL_KEY           104
+
+#define A_SKIP                 127
+
+#define        A_EXTRA                 0200
+
+
+/* Line editting characters */
+
+#define        EC_BACKSPACE    1
+#define        EC_LINEKILL     2
+#define        EC_RIGHT        3
+#define        EC_LEFT         4
+#define        EC_W_LEFT       5
+#define        EC_W_RIGHT      6
+#define        EC_INSERT       7
+#define        EC_DELETE       8
+#define        EC_HOME         9
+#define        EC_END          10
+#define        EC_W_BACKSPACE  11
+#define        EC_W_DELETE     12
+#define        EC_UP           13
+#define        EC_DOWN         14
+#define        EC_EXPAND       15
+#define        EC_F_COMPLETE   17
+#define        EC_B_COMPLETE   18
+#define        EC_LITERAL      19
+
+#define        EC_NOACTION     101
+#define        EC_UINVALID     102
+
+/* Flags for editchar() */
+#define        EC_PEEK         01
+#define        EC_NOHISTORY    02
+#define        EC_NOCOMPLETE   04
+#define        EC_NORIGHTLEFT  010
+
+/* Environment variable stuff */
+#define        EV_OK           01
+
+/* Special keys (keys which output different strings on different terminals) */
+#define SK_SPECIAL_KEY         CONTROL('K')
+#define SK_RIGHT_ARROW         1
+#define SK_LEFT_ARROW          2
+#define SK_UP_ARROW            3
+#define SK_DOWN_ARROW          4
+#define SK_PAGE_UP             5
+#define SK_PAGE_DOWN           6
+#define SK_HOME                        7
+#define SK_END                 8
+#define SK_DELETE              9
+#define SK_INSERT              10
+#define SK_CTL_LEFT_ARROW      11
+#define SK_CTL_RIGHT_ARROW     12
+#define SK_CTL_DELETE          13
+#define SK_F1                  14
+#define SK_BACKTAB             15
+#define SK_CTL_BACKSPACE       16
+#define SK_CONTROL_K           40
diff --git a/contrib/less-381/cmdbuf.c b/contrib/less-381/cmdbuf.c
new file mode 100644 (file)
index 0000000..dbf5f2a
--- /dev/null
@@ -0,0 +1,1051 @@
+/*
+ * Copyright (C) 1984-2002  Mark Nudelman
+ *
+ * You may distribute under the terms of either the GNU General Public
+ * License or the Less License, as specified in the README file.
+ *
+ * For more information about less, or for information on how to 
+ * contact the author, see the README file.
+ */
+
+
+/*
+ * Functions which manipulate the command buffer.
+ * Used only by command() and related functions.
+ */
+
+#include "less.h"
+#include "cmd.h"
+
+extern int sc_width;
+
+static char cmdbuf[CMDBUF_SIZE]; /* Buffer for holding a multi-char command */
+static int cmd_col;            /* Current column of the cursor */
+static int prompt_col;         /* Column of cursor just after prompt */
+static char *cp;               /* Pointer into cmdbuf */
+static int cmd_offset;         /* Index into cmdbuf of first displayed char */
+static int literal;            /* Next input char should not be interpreted */
+
+#if TAB_COMPLETE_FILENAME
+static int cmd_complete();
+/*
+ * These variables are statics used by cmd_complete.
+ */
+static int in_completion = 0;
+static char *tk_text;
+static char *tk_original;
+static char *tk_ipoint;
+static char *tk_trial;
+static struct textlist tk_tlist;
+#endif
+
+static int cmd_left();
+static int cmd_right();
+
+#if SPACES_IN_FILENAMES
+public char openquote = '"';
+public char closequote = '"';
+#endif
+
+#if CMD_HISTORY
+/*
+ * A mlist structure represents a command history.
+ */
+struct mlist
+{
+       struct mlist *next;
+       struct mlist *prev;
+       struct mlist *curr_mp;
+       char *string;
+};
+
+/*
+ * These are the various command histories that exist.
+ */
+struct mlist mlist_search =  
+       { &mlist_search,  &mlist_search,  &mlist_search,  NULL };
+public void * constant ml_search = (void *) &mlist_search;
+
+struct mlist mlist_examine = 
+       { &mlist_examine, &mlist_examine, &mlist_examine, NULL };
+public void * constant ml_examine = (void *) &mlist_examine;
+
+#if SHELL_ESCAPE || PIPEC
+struct mlist mlist_shell =   
+       { &mlist_shell,   &mlist_shell,   &mlist_shell,   NULL };
+public void * constant ml_shell = (void *) &mlist_shell;
+#endif
+
+#else /* CMD_HISTORY */
+
+/* If CMD_HISTORY is off, these are just flags. */
+public void * constant ml_search = (void *)1;
+public void * constant ml_examine = (void *)2;
+#if SHELL_ESCAPE || PIPEC
+public void * constant ml_shell = (void *)3;
+#endif
+
+#endif /* CMD_HISTORY */
+
+/*
+ * History for the current command.
+ */
+static struct mlist *curr_mlist = NULL;
+static int curr_cmdflags;
+
+
+/*
+ * Reset command buffer (to empty).
+ */
+       public void
+cmd_reset()
+{
+       cp = cmdbuf;
+       *cp = '\0';
+       cmd_col = 0;
+       cmd_offset = 0;
+       literal = 0;
+}
+
+/*
+ * Clear command line on display.
+ */
+       public void
+clear_cmd()
+{
+       clear_bot();
+       cmd_col = prompt_col = 0;
+}
+
+/*
+ * Display a string, usually as a prompt for input into the command buffer.
+ */
+       public void
+cmd_putstr(s)
+       char *s;
+{
+       putstr(s);
+       cmd_col += strlen(s);
+       prompt_col += strlen(s);
+}
+
+/*
+ * How many characters are in the command buffer?
+ */
+       public int
+len_cmdbuf()
+{
+       return (strlen(cmdbuf));
+}
+
+/*
+ * Repaint the line from cp onwards.
+ * Then position the cursor just after the char old_cp (a pointer into cmdbuf).
+ */
+       static void
+cmd_repaint(old_cp)
+       char *old_cp;
+{
+       char *p;
+
+       /*
+        * Repaint the line from the current position.
+        */
+       clear_eol();
+       for ( ;  *cp != '\0';  cp++)
+       {
+               p = prchar(*cp);
+               if (cmd_col + (int)strlen(p) >= sc_width)
+                       break;
+               putstr(p);
+               cmd_col += strlen(p);
+       }
+
+       /*
+        * Back up the cursor to the correct position.
+        */
+       while (cp > old_cp)
+               cmd_left();
+}
+
+/*
+ * Put the cursor at "home" (just after the prompt),
+ * and set cp to the corresponding char in cmdbuf.
+ */
+       static void
+cmd_home()
+{
+       while (cmd_col > prompt_col)
+       {
+               putbs();
+               cmd_col--;
+       }
+
+       cp = &cmdbuf[cmd_offset];
+}
+
+/*
+ * Shift the cmdbuf display left a half-screen.
+ */
+       static void
+cmd_lshift()
+{
+       char *s;
+       char *save_cp;
+       int cols;
+
+       /*
+        * Start at the first displayed char, count how far to the
+        * right we'd have to move to reach the center of the screen.
+        */
+       s = cmdbuf + cmd_offset;
+       cols = 0;
+       while (cols < (sc_width - prompt_col) / 2 && *s != '\0')
+               cols += strlen(prchar(*s++));
+
+       cmd_offset = s - cmdbuf;
+       save_cp = cp;
+       cmd_home();
+       cmd_repaint(save_cp);
+}
+
+/*
+ * Shift the cmdbuf display right a half-screen.
+ */
+       static void
+cmd_rshift()
+{
+       char *s;
+       char *p;
+       char *save_cp;
+       int cols;
+
+       /*
+        * Start at the first displayed char, count how far to the
+        * left we'd have to move to traverse a half-screen width
+        * of displayed characters.
+        */
+       s = cmdbuf + cmd_offset;
+       cols = 0;
+       while (cols < (sc_width - prompt_col) / 2 && s > cmdbuf)
+       {
+               p = prchar(*--s);
+               cols += strlen(p);
+       }
+
+       cmd_offset = s - cmdbuf;
+       save_cp = cp;
+       cmd_home();
+       cmd_repaint(save_cp);
+}
+
+/*
+ * Move cursor right one character.
+ */
+       static int
+cmd_right()
+{
+       char *p;
+       
+       if (*cp == '\0')
+       {
+               /* 
+                * Already at the end of the line.
+                */
+               return (CC_OK);
+       }
+       p = prchar(*cp);
+       if (cmd_col + (int)strlen(p) >= sc_width)
+               cmd_lshift();
+       else if (cmd_col + (int)strlen(p) == sc_width - 1 && cp[1] != '\0')
+               cmd_lshift();
+       cp++;
+       putstr(p);
+       cmd_col += strlen(p);
+       return (CC_OK);
+}
+
+/*
+ * Move cursor left one character.
+ */
+       static int
+cmd_left()
+{
+       char *p;
+       
+       if (cp <= cmdbuf)
+       {
+               /* Already at the beginning of the line */
+               return (CC_OK);
+       }
+       p = prchar(cp[-1]);
+       if (cmd_col < prompt_col + (int)strlen(p))
+               cmd_rshift();
+       cp--;
+       cmd_col -= strlen(p);
+       while (*p++ != '\0')
+               putbs();
+       return (CC_OK);
+}
+
+/*
+ * Insert a char into the command buffer, at the current position.
+ */
+       static int
+cmd_ichar(c)
+       int c;
+{
+       char *s;
+       
+       if (strlen(cmdbuf) >= sizeof(cmdbuf)-2)
+       {
+               /*
+                * No room in the command buffer for another char.
+                */
+               bell();
+               return (CC_ERROR);
+       }
+               
+       /*
+        * Insert the character into the buffer.
+        */
+       for (s = &cmdbuf[strlen(cmdbuf)];  s >= cp;  s--)
+               s[1] = s[0];
+       *cp = c;
+       /*
+        * Reprint the tail of the line from the inserted char.
+        */
+       cmd_repaint(cp);
+       cmd_right();
+       return (CC_OK);
+}
+
+/*
+ * Backspace in the command buffer.
+ * Delete the char to the left of the cursor.
+ */
+       static int
+cmd_erase()
+{
+       register char *s;
+
+       if (cp == cmdbuf)
+       {
+               /*
+                * Backspace past beginning of the buffer:
+                * this usually means abort the command.
+                */
+               return (CC_QUIT);
+       }
+       /*
+        * Move cursor left (to the char being erased).
+        */
+       cmd_left();
+       /*
+        * Remove the char from the buffer (shift the buffer left).
+        */
+       for (s = cp;  *s != '\0';  s++)
+               s[0] = s[1];
+       /*
+        * Repaint the buffer after the erased char.
+        */
+       cmd_repaint(cp);
+       
+       /*
+        * We say that erasing the entire command string causes us
+        * to abort the current command, if CF_QUIT_ON_ERASE is set.
+        */
+       if ((curr_cmdflags & CF_QUIT_ON_ERASE) && cp == cmdbuf && *cp == '\0')
+               return (CC_QUIT);
+       return (CC_OK);
+}
+
+/*
+ * Delete the char under the cursor.
+ */
+       static int
+cmd_delete()
+{
+       if (*cp == '\0')
+       {
+               /*
+                * At end of string; there is no char under the cursor.
+                */
+               return (CC_OK);
+       }
+       /*
+        * Move right, then use cmd_erase.
+        */
+       cmd_right();
+       cmd_erase();
+       return (CC_OK);
+}
+
+/*
+ * Delete the "word" to the left of the cursor.
+ */
+       static int
+cmd_werase()
+{
+       if (cp > cmdbuf && cp[-1] == ' ')
+       {
+               /*
+                * If the char left of cursor is a space,
+                * erase all the spaces left of cursor (to the first non-space).
+                */
+               while (cp > cmdbuf && cp[-1] == ' ')
+                       (void) cmd_erase();
+       } else
+       {
+               /*
+                * If the char left of cursor is not a space,
+                * erase all the nonspaces left of cursor (the whole "word").
+                */
+               while (cp > cmdbuf && cp[-1] != ' ')
+                       (void) cmd_erase();
+       }
+       return (CC_OK);
+}
+
+/*
+ * Delete the "word" under the cursor.
+ */
+       static int
+cmd_wdelete()
+{
+       if (*cp == ' ')
+       {
+               /*
+                * If the char under the cursor is a space,
+                * delete it and all the spaces right of cursor.
+                */
+               while (*cp == ' ')
+                       (void) cmd_delete();
+       } else
+       {
+               /*
+                * If the char under the cursor is not a space,
+                * delete it and all nonspaces right of cursor (the whole word).
+                */
+               while (*cp != ' ' && *cp != '\0')
+                       (void) cmd_delete();
+       }
+       return (CC_OK);
+}
+
+/*
+ * Delete all chars in the command buffer.
+ */
+       static int
+cmd_kill()
+{
+       if (cmdbuf[0] == '\0')
+       {
+               /*
+                * Buffer is already empty; abort the current command.
+                */
+               return (CC_QUIT);
+       }
+       cmd_offset = 0;
+       cmd_home();
+       *cp = '\0';
+       cmd_repaint(cp);
+
+       /*
+        * We say that erasing the entire command string causes us
+        * to abort the current command, if CF_QUIT_ON_ERASE is set.
+        */
+       if (curr_cmdflags & CF_QUIT_ON_ERASE)
+               return (CC_QUIT);
+       return (CC_OK);
+}
+
+/*
+ * Select an mlist structure to be the current command history.
+ */
+       public void
+set_mlist(mlist, cmdflags)
+       void *mlist;
+       int cmdflags;
+{
+       curr_mlist = (struct mlist *) mlist;
+       curr_cmdflags = cmdflags;
+}
+
+#if CMD_HISTORY
+/*
+ * Move up or down in the currently selected command history list.
+ */
+       static int
+cmd_updown(action)
+       int action;
+{
+       char *s;
+       
+       if (curr_mlist == NULL)
+       {
+               /*
+                * The current command has no history list.
+                */
+               bell();
+               return (CC_OK);
+       }
+       cmd_home();
+       clear_eol();
+       /*
+        * Move curr_mp to the next/prev entry.
+        */
+       if (action == EC_UP)
+               curr_mlist->curr_mp = curr_mlist->curr_mp->prev;
+       else
+               curr_mlist->curr_mp = curr_mlist->curr_mp->next;
+       /*
+        * Copy the entry into cmdbuf and echo it on the screen.
+        */
+       s = curr_mlist->curr_mp->string;
+       if (s == NULL)
+               s = "";
+       for (cp = cmdbuf;  *s != '\0';  s++)
+       {
+               *cp = *s;
+               cmd_right();
+       }
+       *cp = '\0';
+       return (CC_OK);
+}
+#endif
+
+/*
+ * Add a string to a history list.
+ */
+       public void
+cmd_addhist(mlist, cmd)
+       struct mlist *mlist;
+       char *cmd;
+{
+#if CMD_HISTORY
+       struct mlist *ml;
+       
+       /*
+        * Don't save a trivial command.
+        */
+       if (strlen(cmd) == 0)
+               return;
+       /*
+        * Don't save if a duplicate of a command which is already 
+        * in the history.
+        * But select the one already in the history to be current.
+        */
+       for (ml = mlist->next;  ml != mlist;  ml = ml->next)
+       {
+               if (strcmp(ml->string, cmd) == 0)
+                       break;
+       }
+       if (ml == mlist)
+       {
+               /*
+                * Did not find command in history.
+                * Save the command and put it at the end of the history list.
+                */
+               ml = (struct mlist *) ecalloc(1, sizeof(struct mlist));
+               ml->string = save(cmd);
+               ml->next = mlist;
+               ml->prev = mlist->prev;
+               mlist->prev->next = ml;
+               mlist->prev = ml;
+       }
+       /*
+        * Point to the cmd just after the just-accepted command.
+        * Thus, an UPARROW will always retrieve the previous command.
+        */
+       mlist->curr_mp = ml->next;
+#endif
+}
+
+/*
+ * Accept the command in the command buffer.
+ * Add it to the currently selected history list.
+ */
+       public void
+cmd_accept()
+{
+#if CMD_HISTORY
+       /*
+        * Nothing to do if there is no currently selected history list.
+        */
+       if (curr_mlist == NULL)
+               return;
+       cmd_addhist(curr_mlist, cmdbuf);
+#endif
+}
+
+/*
+ * Try to perform a line-edit function on the command buffer,
+ * using a specified char as a line-editing command.
+ * Returns:
+ *     CC_PASS The char does not invoke a line edit function.
+ *     CC_OK   Line edit function done.
+ *     CC_QUIT The char requests the current command to be aborted.
+ */
+       static int
+cmd_edit(c)
+       int c;
+{
+       int action;
+       int flags;
+
+#if TAB_COMPLETE_FILENAME
+#define        not_in_completion()     in_completion = 0
+#else
+#define        not_in_completion()
+#endif
+       
+       /*
+        * See if the char is indeed a line-editing command.
+        */
+       flags = 0;
+#if CMD_HISTORY
+       if (curr_mlist == NULL)
+               /*
+                * No current history; don't accept history manipulation cmds.
+                */
+               flags |= EC_NOHISTORY;
+#endif
+#if TAB_COMPLETE_FILENAME
+       if (curr_mlist == ml_search)
+               /*
+                * In a search command; don't accept file-completion cmds.
+                */
+               flags |= EC_NOCOMPLETE;
+#endif
+
+       action = editchar(c, flags);
+
+       switch (action)
+       {
+       case EC_RIGHT:
+               not_in_completion();
+               return (cmd_right());
+       case EC_LEFT:
+               not_in_completion();
+               return (cmd_left());
+       case EC_W_RIGHT:
+               not_in_completion();
+               while (*cp != '\0' && *cp != ' ')
+                       cmd_right();
+               while (*cp == ' ')
+                       cmd_right();
+               return (CC_OK);
+       case EC_W_LEFT:
+               not_in_completion();
+               while (cp > cmdbuf && cp[-1] == ' ')
+                       cmd_left();
+               while (cp > cmdbuf && cp[-1] != ' ')
+                       cmd_left();
+               return (CC_OK);
+       case EC_HOME:
+               not_in_completion();
+               cmd_offset = 0;
+               cmd_home();
+               cmd_repaint(cp);
+               return (CC_OK);
+       case EC_END:
+               not_in_completion();
+               while (*cp != '\0')
+                       cmd_right();
+               return (CC_OK);
+       case EC_INSERT:
+               not_in_completion();
+               return (CC_OK);
+       case EC_BACKSPACE:
+               not_in_completion();
+               return (cmd_erase());
+       case EC_LINEKILL:
+               not_in_completion();
+               return (cmd_kill());
+       case EC_W_BACKSPACE:
+               not_in_completion();
+               return (cmd_werase());
+       case EC_DELETE:
+               not_in_completion();
+               return (cmd_delete());
+       case EC_W_DELETE:
+               not_in_completion();
+               return (cmd_wdelete());
+       case EC_LITERAL:
+               literal = 1;
+               return (CC_OK);
+#if CMD_HISTORY
+       case EC_UP:
+       case EC_DOWN:
+               not_in_completion();
+               return (cmd_updown(action));
+#endif
+#if TAB_COMPLETE_FILENAME
+       case EC_F_COMPLETE:
+       case EC_B_COMPLETE:
+       case EC_EXPAND:
+               return (cmd_complete(action));
+#endif
+       case EC_NOACTION:
+               return (CC_OK);
+       default:
+               not_in_completion();
+               return (CC_PASS);
+       }
+}
+
+#if TAB_COMPLETE_FILENAME
+/*
+ * Insert a string into the command buffer, at the current position.
+ */
+       static int
+cmd_istr(str)
+       char *str;
+{
+       char *s;
+       int action;
+       
+       for (s = str;  *s != '\0';  s++)
+       {
+               action = cmd_ichar(*s);
+               if (action != CC_OK)
+               {
+                       bell();
+                       return (action);
+               }
+       }
+       return (CC_OK);
+}
+
+/*
+ * Find the beginning and end of the "current" word.
+ * This is the word which the cursor (cp) is inside or at the end of.
+ * Return pointer to the beginning of the word and put the
+ * cursor at the end of the word.
+ */
+       static char *
+delimit_word()
+{
+       char *word;
+#if SPACES_IN_FILENAMES
+       char *p;
+       int delim_quoted = 0;
+       int meta_quoted = 0;
+       char *esc = get_meta_escape();
+       int esclen = strlen(esc);
+#endif
+       
+       /*
+        * Move cursor to end of word.
+        */
+       if (*cp != ' ' && *cp != '\0')
+       {
+               /*
+                * Cursor is on a nonspace.
+                * Move cursor right to the next space.
+                */
+               while (*cp != ' ' && *cp != '\0')
+                       cmd_right();
+       } else if (cp > cmdbuf && cp[-1] != ' ')
+       {
+               /*
+                * Cursor is on a space, and char to the left is a nonspace.
+                * We're already at the end of the word.
+                */
+               ;
+#if 0
+       } else
+       {
+               /*
+                * Cursor is on a space and char to the left is a space.
+                * Huh? There's no word here.
+                */
+               return (NULL);
+#endif
+       }
+       /*
+        * Find the beginning of the word which the cursor is in.
+        */
+       if (cp == cmdbuf)
+               return (NULL);
+#if SPACES_IN_FILENAMES
+       /*
+        * If we have an unbalanced quote (that is, an open quote
+        * without a corresponding close quote), we return everything
+        * from the open quote, including spaces.
+        */
+       for (word = cmdbuf;  word < cp;  word++)
+               if (*word != ' ')
+                       break;
+       if (word >= cp)
+               return (cp);
+       for (p = cmdbuf;  p < cp;  p++)
+       {
+               if (meta_quoted)
+               {
+                       meta_quoted = 0;
+               } else if (esclen > 0 && p + esclen < cp &&
+                          strncmp(p, esc, esclen) == 0)
+               {
+                       meta_quoted = 1;
+                       p += esclen - 1;
+               } else if (delim_quoted)
+               {
+                       if (*p == closequote)
+                               delim_quoted = 0;
+               } else /* (!delim_quoted) */
+               {
+                       if (*p == openquote)
+                               delim_quoted = 1;
+                       else if (*p == ' ')
+                               word = p+1;
+               }
+       }
+#endif
+       return (word);
+}
+
+/*
+ * Set things up to enter completion mode.
+ * Expand the word under the cursor into a list of filenames 
+ * which start with that word, and set tk_text to that list.
+ */
+       static void
+init_compl()
+{
+       char *word;
+       char c;
+       
+       /*
+        * Get rid of any previous tk_text.
+        */
+       if (tk_text != NULL)
+       {
+               free(tk_text);
+               tk_text = NULL;
+       }
+       /*
+        * Find the original (uncompleted) word in the command buffer.
+        */
+       word = delimit_word();
+       if (word == NULL)
+               return;
+       /*
+        * Set the insertion point to the point in the command buffer
+        * where the original (uncompleted) word now sits.
+        */
+       tk_ipoint = word;
+       /*
+        * Save the original (uncompleted) word
+        */
+       if (tk_original != NULL)
+               free(tk_original);
+       tk_original = (char *) ecalloc(cp-word+1, sizeof(char));
+       strncpy(tk_original, word, cp-word);
+       /*
+        * Get the expanded filename.
+        * This may result in a single filename, or
+        * a blank-separated list of filenames.
+        */
+       c = *cp;
+       *cp = '\0';
+       if (*word != openquote)
+       {
+               tk_text = fcomplete(word);
+       } else
+       {
+               char *qword = shell_quote(word+1);
+               if (qword == NULL)
+                       tk_text = fcomplete(word+1);
+               else
+               {
+                       tk_text = fcomplete(qword);
+                       free(qword);
+               }
+       }
+       *cp = c;
+}
+
+/*
+ * Return the next word in the current completion list.
+ */
+       static char *
+next_compl(action, prev)
+       int action;
+       char *prev;
+{
+       switch (action)
+       {
+       case EC_F_COMPLETE:
+               return (forw_textlist(&tk_tlist, prev));
+       case EC_B_COMPLETE:
+               return (back_textlist(&tk_tlist, prev));
+       }
+       /* Cannot happen */
+       return ("?");
+}
+
+/*
+ * Complete the filename before (or under) the cursor.
+ * cmd_complete may be called multiple times.  The global in_completion
+ * remembers whether this call is the first time (create the list),
+ * or a subsequent time (step thru the list).
+ */
+       static int
+cmd_complete(action)
+       int action;
+{
+       char *s;
+
+       if (!in_completion || action == EC_EXPAND)
+       {
+               /*
+                * Expand the word under the cursor and 
+                * use the first word in the expansion 
+                * (or the entire expansion if we're doing EC_EXPAND).
+                */
+               init_compl();
+               if (tk_text == NULL)
+               {
+                       bell();
+                       return (CC_OK);
+               }
+               if (action == EC_EXPAND)
+               {
+                       /*
+                        * Use the whole list.
+                        */
+                       tk_trial = tk_text;
+               } else
+               {
+                       /*
+                        * Use the first filename in the list.
+                        */
+                       in_completion = 1;
+                       init_textlist(&tk_tlist, tk_text);
+                       tk_trial = next_compl(action, (char*)NULL);
+               }
+       } else
+       {
+               /*
+                * We already have a completion list.
+                * Use the next/previous filename from the list.
+                */
+               tk_trial = next_compl(action, tk_trial);
+       }
+       
+       /*
+        * Remove the original word, or the previous trial completion.
+        */
+       while (cp > tk_ipoint)
+               (void) cmd_erase();
+       
+       if (tk_trial == NULL)
+       {
+               /*
+                * There are no more trial completions.
+                * Insert the original (uncompleted) filename.
+                */
+               in_completion = 0;
+               if (cmd_istr(tk_original) != CC_OK)
+                       goto fail;
+       } else
+       {
+               /*
+                * Insert trial completion.
+                */
+               if (cmd_istr(tk_trial) != CC_OK)
+                       goto fail;
+               /*
+                * If it is a directory, append a slash.
+                */
+               if (is_dir(tk_trial))
+               {
+                       if (cp > cmdbuf && cp[-1] == closequote)
+                               (void) cmd_erase();
+                       s = lgetenv("LESSSEPARATOR");
+                       if (s == NULL)
+                               s = PATHNAME_SEP;
+                       if (cmd_istr(s) != CC_OK)
+                               goto fail;
+               }
+       }
+       
+       return (CC_OK);
+       
+fail:
+       in_completion = 0;
+       bell();
+       return (CC_OK);
+}
+
+#endif /* TAB_COMPLETE_FILENAME */
+
+/*
+ * Process a single character of a multi-character command, such as
+ * a number, or the pattern of a search command.
+ * Returns:
+ *     CC_OK           The char was accepted.
+ *     CC_QUIT         The char requests the command to be aborted.
+ *     CC_ERROR        The char could not be accepted due to an error.
+ */
+       public int
+cmd_char(c)
+       int c;
+{
+       int action;
+
+       if (literal)
+       {
+               /*
+                * Insert the char, even if it is a line-editing char.
+                */
+               literal = 0;
+               return (cmd_ichar(c));
+       }
+               
+       /*
+        * See if it is a special line-editing character.
+        */
+       if (in_mca())
+       {
+               action = cmd_edit(c);
+               switch (action)
+               {
+               case CC_OK:
+               case CC_QUIT:
+                       return (action);
+               case CC_PASS:
+                       break;
+               }
+       }
+       
+       /*
+        * Insert the char into the command buffer.
+        */
+       return (cmd_ichar(c));
+}
+
+/*
+ * Return the number currently in the command buffer.
+ */
+       public LINENUM
+cmd_int()
+{
+       register char *p;
+       LINENUM n = 0;
+
+       for (p = cmdbuf;  *p != '\0';  p++)
+               n = (10 * n) + (*p - '0');
+       return (n);
+}
+
+/*
+ * Return a pointer to the command buffer.
+ */
+       public char *
+get_cmdbuf()
+{
+       return (cmdbuf);
+}
diff --git a/contrib/less-381/command.c b/contrib/less-381/command.c
new file mode 100644 (file)
index 0000000..9b059ec
--- /dev/null
@@ -0,0 +1,1621 @@
+/*
+ * Copyright (C) 1984-2002  Mark Nudelman
+ *
+ * You may distribute under the terms of either the GNU General Public
+ * License or the Less License, as specified in the README file.
+ *
+ * For more information about less, or for information on how to 
+ * contact the author, see the README file.
+ */
+
+
+/*
+ * User-level command processor.
+ */
+
+#include "less.h"
+#if MSDOS_COMPILER==WIN32C
+#include <windows.h>
+#endif
+#include "position.h"
+#include "option.h"
+#include "cmd.h"
+
+extern int erase_char, kill_char;
+extern int sigs;
+extern int quit_at_eof;
+extern int quit_if_one_screen;
+extern int squished;
+extern int hit_eof;
+extern int sc_width;
+extern int sc_height;
+extern int swindow;
+extern int jump_sline;
+extern int quitting;
+extern int wscroll;
+extern int top_scroll;
+extern int ignore_eoi;
+extern int secure;
+extern int hshift;
+extern int show_attn;
+extern char *every_first_cmd;
+extern char *curr_altfilename;
+extern char version[];
+extern struct scrpos initial_scrpos;
+extern IFILE curr_ifile;
+extern void constant *ml_search;
+extern void constant *ml_examine;
+#if SHELL_ESCAPE || PIPEC
+extern void constant *ml_shell;
+#endif
+#if EDITOR
+extern char *editor;
+extern char *editproto;
+#endif
+extern int screen_trashed;     /* The screen has been overwritten */
+extern int shift_count;
+
+static char ungot[UNGOT_SIZE];
+static char *ungotp = NULL;
+#if SHELL_ESCAPE
+static char *shellcmd = NULL;  /* For holding last shell command for "!!" */
+#endif
+static int mca;                        /* The multicharacter command (action) */
+static int search_type;                /* The previous type of search */
+static LINENUM number;         /* The number typed by the user */
+static char optchar;
+static int optflag;
+static int optgetname;
+static POSITION bottompos;
+#if PIPEC
+static char pipec;
+#endif
+
+static void multi_search();
+
+/*
+ * Move the cursor to lower left before executing a command.
+ * This looks nicer if the command takes a long time before
+ * updating the screen.
+ */
+       static void
+cmd_exec()
+{
+       clear_attn();
+       lower_left();
+       flush();
+}
+
+/*
+ * Set up the display to start a new multi-character command.
+ */
+       static void
+start_mca(action, prompt, mlist, cmdflags)
+       int action;
+       char *prompt;
+       void *mlist;
+       int cmdflags;
+{
+       mca = action;
+       clear_cmd();
+       cmd_putstr(prompt);
+       set_mlist(mlist, cmdflags);
+}
+
+       public int
+in_mca()
+{
+       return (mca != 0 && mca != A_PREFIX);
+}
+
+/*
+ * Set up the display to start a new search command.
+ */
+       static void
+mca_search()
+{
+       if (search_type & SRCH_FORW)
+               mca = A_F_SEARCH;
+       else
+               mca = A_B_SEARCH;
+
+       clear_cmd();
+
+       if (search_type & SRCH_NO_MATCH)
+               cmd_putstr("Non-match ");
+       if (search_type & SRCH_FIRST_FILE)
+               cmd_putstr("First-file ");
+       if (search_type & SRCH_PAST_EOF)
+               cmd_putstr("EOF-ignore ");
+       if (search_type & SRCH_NO_MOVE)
+               cmd_putstr("Keep-pos ");
+       if (search_type & SRCH_NO_REGEX)
+               cmd_putstr("Regex-off ");
+
+       if (search_type & SRCH_FORW)
+               cmd_putstr("/");
+       else
+               cmd_putstr("?");
+       set_mlist(ml_search, 0);
+}
+
+/*
+ * Set up the display to start a new toggle-option command.
+ */
+       static void
+mca_opt_toggle()
+{
+       int no_prompt;
+       int flag;
+       char *dash;
+       
+       no_prompt = (optflag & OPT_NO_PROMPT);
+       flag = (optflag & ~OPT_NO_PROMPT);
+       dash = (flag == OPT_NO_TOGGLE) ? "_" : "-";
+
+       mca = A_OPT_TOGGLE;
+       clear_cmd();
+       cmd_putstr(dash);
+       if (optgetname)
+               cmd_putstr(dash);
+       if (no_prompt)
+               cmd_putstr("(P)");
+       switch (flag)
+       {
+       case OPT_UNSET:
+               cmd_putstr("+");
+               break;
+       case OPT_SET:
+               cmd_putstr("!");
+               break;
+       }
+       set_mlist(NULL, 0);
+}
+
+/*
+ * Execute a multicharacter command.
+ */
+       static void
+exec_mca()
+{
+       register char *cbuf;
+
+       cmd_exec();
+       cbuf = get_cmdbuf();
+
+       switch (mca)
+       {
+       case A_F_SEARCH:
+       case A_B_SEARCH:
+               multi_search(cbuf, (int) number);
+               break;
+       case A_FIRSTCMD:
+               /*
+                * Skip leading spaces or + signs in the string.
+                */
+               while (*cbuf == '+' || *cbuf == ' ')
+                       cbuf++;
+               if (every_first_cmd != NULL)
+                       free(every_first_cmd);
+               if (*cbuf == '\0')
+                       every_first_cmd = NULL;
+               else
+                       every_first_cmd = save(cbuf);
+               break;
+       case A_OPT_TOGGLE:
+               toggle_option(optchar, cbuf, optflag);
+               optchar = '\0';
+               break;
+       case A_F_BRACKET:
+               match_brac(cbuf[0], cbuf[1], 1, (int) number);
+               break;
+       case A_B_BRACKET:
+               match_brac(cbuf[1], cbuf[0], 0, (int) number);
+               break;
+#if EXAMINE
+       case A_EXAMINE:
+               if (secure)
+                       break;
+               edit_list(cbuf);
+#if TAGS
+               /* If tag structure is loaded then clean it up. */
+               cleantags();
+#endif
+               break;
+#endif
+#if SHELL_ESCAPE
+       case A_SHELL:
+               /*
+                * !! just uses whatever is in shellcmd.
+                * Otherwise, copy cmdbuf to shellcmd,
+                * expanding any special characters ("%" or "#").
+                */
+               if (*cbuf != '!')
+               {
+                       if (shellcmd != NULL)
+                               free(shellcmd);
+                       shellcmd = fexpand(cbuf);
+               }
+
+               if (secure)
+                       break;
+               if (shellcmd == NULL)
+                       lsystem("", "!done");
+               else
+                       lsystem(shellcmd, "!done");
+               break;
+#endif
+#if PIPEC
+       case A_PIPE:
+               if (secure)
+                       break;
+               (void) pipe_mark(pipec, cbuf);
+               error("|done", NULL_PARG);
+               break;
+#endif
+       }
+}
+
+/*
+ * Add a character to a multi-character command.
+ */
+       static int
+mca_char(c)
+       int c;
+{
+       char *p;
+       int flag;
+       char buf[3];
+       PARG parg;
+
+       switch (mca)
+       {
+       case 0:
+               /*
+                * Not in a multicharacter command.
+                */
+               return (NO_MCA);
+
+       case A_PREFIX:
+               /*
+                * In the prefix of a command.
+                * This not considered a multichar command
+                * (even tho it uses cmdbuf, etc.).
+                * It is handled in the commands() switch.
+                */
+               return (NO_MCA);
+
+       case A_DIGIT:
+               /*
+                * Entering digits of a number.
+                * Terminated by a non-digit.
+                */
+               if ((c < '0' || c > '9') && 
+                 editchar(c, EC_PEEK|EC_NOHISTORY|EC_NOCOMPLETE|EC_NORIGHTLEFT) == A_INVALID)
+               {
+                       /*
+                        * Not part of the number.
+                        * Treat as a normal command character.
+                        */
+                       number = cmd_int();
+                       mca = 0;
+                       cmd_accept();
+                       return (NO_MCA);
+               }
+               break;
+
+       case A_OPT_TOGGLE:
+               /*
+                * Special case for the TOGGLE_OPTION command.
+                * If the option letter which was entered is a
+                * single-char option, execute the command immediately,
+                * so user doesn't have to hit RETURN.
+                * If the first char is + or -, this indicates
+                * OPT_UNSET or OPT_SET respectively, instead of OPT_TOGGLE.
+                * "--" begins inputting a long option name.
+                */
+               if (optchar == '\0' && len_cmdbuf() == 0)
+               {
+                       flag = (optflag & ~OPT_NO_PROMPT);
+                       if (flag == OPT_NO_TOGGLE)
+                       {
+                               switch (c)
+                               {
+                               case '_':
+                                       /* "__" = long option name. */
+                                       optgetname = TRUE;
+                                       mca_opt_toggle();
+                                       return (MCA_MORE);
+                               }
+                       } else
+                       {
+                               switch (c)
+                               {
+                               case '+':
+                                       /* "-+" = UNSET. */
+                                       optflag = (flag == OPT_UNSET) ?
+                                               OPT_TOGGLE : OPT_UNSET;
+                                       mca_opt_toggle();
+                                       return (MCA_MORE);
+                               case '!':
+                                       /* "-!" = SET */
+                                       optflag = (flag == OPT_SET) ?
+                                               OPT_TOGGLE : OPT_SET;
+                                       mca_opt_toggle();
+                                       return (MCA_MORE);
+                               case CONTROL('P'):
+                                       optflag ^= OPT_NO_PROMPT;
+                                       mca_opt_toggle();
+                                       return (MCA_MORE);
+                               case '-':
+                                       /* "--" = long option name. */
+                                       optgetname = TRUE;
+                                       mca_opt_toggle();
+                                       return (MCA_MORE);
+                               }
+                       }
+               }
+               if (optgetname)
+               {
+                       /*
+                        * We're getting a long option name.
+                        * See if we've matched an option name yet.
+                        * If so, display the complete name and stop 
+                        * accepting chars until user hits RETURN.
+                        */
+                       struct loption *o;
+                       char *oname;
+                       int lc;
+
+                       if (c == '\n' || c == '\r')
+                       {
+                               /*
+                                * When the user hits RETURN, make sure
+                                * we've matched an option name, then
+                                * pretend he just entered the equivalent
+                                * option letter.
+                                */
+                               if (optchar == '\0')
+                               {
+                                       parg.p_string = get_cmdbuf();
+                                       error("There is no --%s option", &parg);
+                                       return (MCA_DONE);
+                               }
+                               optgetname = FALSE;
+                               cmd_reset();
+                               c = optchar;
+                       } else
+                       {
+                               if (optchar != '\0')
+                               {
+                                       /*
+                                        * Already have a match for the name.
+                                        * Don't accept anything but erase/kill.
+                                        */
+                                       if (c == erase_char || c == kill_char)
+                                               return (MCA_DONE);
+                                       return (MCA_MORE);
+                               }
+                               /*
+                                * Add char to cmd buffer and try to match
+                                * the option name.
+                                */
+                               if (cmd_char(c) == CC_QUIT)
+                                       return (MCA_DONE);
+                               p = get_cmdbuf();
+                               lc = islower(p[0]);
+                               o = findopt_name(&p, &oname, NULL);
+                               if (o != NULL)
+                               {
+                                       /*
+                                        * Got a match.
+                                        * Remember the option letter and
+                                        * display the full option name.
+                                        */
+                                       optchar = o->oletter;
+                                       if (!lc && islower(optchar))
+                                               optchar = toupper(optchar);
+                                       cmd_reset();
+                                       mca_opt_toggle();
+                                       for (p = oname;  *p != '\0';  p++)
+                                       {
+                                               c = *p;
+                                               if (!lc && islower(c))
+                                                       c = toupper(c);
+                                               if (cmd_char(c) != CC_OK)
+                                                       return (MCA_DONE);
+                                       }
+                               }
+                               return (MCA_MORE);
+                       }
+               } else
+               {
+                       if (c == erase_char || c == kill_char)
+                               break;
+                       if (optchar != '\0')
+                               /* We already have the option letter. */
+                               break;
+               }
+
+               optchar = c;
+               if ((optflag & ~OPT_NO_PROMPT) != OPT_TOGGLE ||
+                   single_char_option(c))
+               {
+                       toggle_option(c, "", optflag);
+                       return (MCA_DONE);
+               }
+               /*
+                * Display a prompt appropriate for the option letter.
+                */
+               if ((p = opt_prompt(c)) == NULL)
+               {
+                       buf[0] = '-';
+                       buf[1] = c;
+                       buf[2] = '\0';
+                       p = buf;
+               }
+               start_mca(A_OPT_TOGGLE, p, (void*)NULL, 0);
+               return (MCA_MORE);
+
+       case A_F_SEARCH:
+       case A_B_SEARCH:
+               /*
+                * Special case for search commands.
+                * Certain characters as the first char of 
+                * the pattern have special meaning:
+                *      !  Toggle the NO_MATCH flag
+                *      *  Toggle the PAST_EOF flag
+                *      @  Toggle the FIRST_FILE flag
+                */
+               if (len_cmdbuf() > 0)
+                       /*
+                        * Only works for the first char of the pattern.
+                        */
+                       break;
+
+               flag = 0;
+               switch (c)
+               {
+               case CONTROL('E'): /* ignore END of file */
+               case '*':
+                       flag = SRCH_PAST_EOF;
+                       break;
+               case CONTROL('F'): /* FIRST file */
+               case '@':
+                       flag = SRCH_FIRST_FILE;
+                       break;
+               case CONTROL('K'): /* KEEP position */
+                       flag = SRCH_NO_MOVE;
+                       break;
+               case CONTROL('R'): /* Don't use REGULAR EXPRESSIONS */
+                       flag = SRCH_NO_REGEX;
+                       break;
+               case CONTROL('N'): /* NOT match */
+               case '!':
+                       flag = SRCH_NO_MATCH;
+                       break;
+               }
+               if (flag != 0)
+               {
+                       search_type ^= flag;
+                       mca_search();
+                       return (MCA_MORE);
+               }
+               break;
+       }
+
+       /*
+        * Any other multicharacter command
+        * is terminated by a newline.
+        */
+       if (c == '\n' || c == '\r')
+       {
+               /*
+                * Execute the command.
+                */
+               exec_mca();
+               return (MCA_DONE);
+       }
+
+       /*
+        * Append the char to the command buffer.
+        */
+       if (cmd_char(c) == CC_QUIT)
+               /*
+                * Abort the multi-char command.
+                */
+               return (MCA_DONE);
+
+       if ((mca == A_F_BRACKET || mca == A_B_BRACKET) && len_cmdbuf() >= 2)
+       {
+               /*
+                * Special case for the bracket-matching commands.
+                * Execute the command after getting exactly two
+                * characters from the user.
+                */
+               exec_mca();
+               return (MCA_DONE);
+       }
+
+       /*
+        * Need another character.
+        */
+       return (MCA_MORE);
+}
+
+/*
+ * Make sure the screen is displayed.
+ */
+       static void
+make_display()
+{
+       /*
+        * If nothing is displayed yet, display starting from initial_scrpos.
+        */
+       if (empty_screen())
+       {
+               if (initial_scrpos.pos == NULL_POSITION)
+                       /*
+                        * {{ Maybe this should be:
+                        *    jump_loc(ch_zero(), jump_sline);
+                        *    but this behavior seems rather unexpected 
+                        *    on the first screen. }}
+                        */
+                       jump_loc(ch_zero(), 1);
+               else
+                       jump_loc(initial_scrpos.pos, initial_scrpos.ln);
+       } else if (screen_trashed)
+       {
+               int save_top_scroll;
+               save_top_scroll = top_scroll;
+               top_scroll = 1;
+               repaint();
+               top_scroll = save_top_scroll;
+       }
+}
+
+/*
+ * Display the appropriate prompt.
+ */
+       static void
+prompt()
+{
+       register char *p;
+
+       if (ungotp != NULL && ungotp > ungot)
+       {
+               /*
+                * No prompt necessary if commands are from 
+                * ungotten chars rather than from the user.
+                */
+               return;
+       }
+
+       /*
+        * Make sure the screen is displayed.
+        */
+       make_display();
+       bottompos = position(BOTTOM_PLUS_ONE);
+
+       /*
+        * If the -E flag is set and we've hit EOF on the last file, quit.
+        */
+       if ((quit_at_eof == OPT_ONPLUS || quit_if_one_screen) &&
+           hit_eof && !(ch_getflags() & CH_HELPFILE) && 
+           next_ifile(curr_ifile) == NULL_IFILE)
+               quit(QUIT_OK);
+       quit_if_one_screen = FALSE;
+#if 0 /* This doesn't work well because some "te"s clear the screen. */
+       /*
+        * If the -e flag is set and we've hit EOF on the last file,
+        * and the file is squished (shorter than the screen), quit.
+        */
+       if (quit_at_eof && squished &&
+           next_ifile(curr_ifile) == NULL_IFILE)
+               quit(QUIT_OK);
+#endif
+
+#if MSDOS_COMPILER==WIN32C
+       /* 
+        * In Win32, display the file name in the window title.
+        */
+       if (!(ch_getflags() & CH_HELPFILE))
+               SetConsoleTitle(pr_expand("Less?f - %f.", 0));
+#endif
+       /*
+        * Select the proper prompt and display it.
+        */
+       clear_cmd();
+       p = pr_string();
+       if (p == NULL)
+               putchr(':');
+       else
+       {
+               so_enter();
+               putstr(p);
+               so_exit();
+       }
+}
+
+/*
+ * Display the less version message.
+ */
+       public void
+dispversion()
+{
+       PARG parg;
+
+       parg.p_string = version;
+       error("less %s", &parg);
+}
+
+/*
+ * Get command character.
+ * The character normally comes from the keyboard,
+ * but may come from ungotten characters
+ * (characters previously given to ungetcc or ungetsc).
+ */
+       public int
+getcc()
+{
+       if (ungotp == NULL)
+               /*
+                * Normal case: no ungotten chars, so get one from the user.
+                */
+               return (getchr());
+
+       if (ungotp > ungot)
+               /*
+                * Return the next ungotten char.
+                */
+               return (*--ungotp);
+
+       /*
+        * We have just run out of ungotten chars.
+        */
+       ungotp = NULL;
+       if (len_cmdbuf() == 0 || !empty_screen())
+               return (getchr());
+       /*
+        * Command is incomplete, so try to complete it.
+        */
+       switch (mca)
+       {
+       case A_DIGIT:
+               /*
+                * We have a number but no command.  Treat as #g.
+                */
+               return ('g');
+
+       case A_F_SEARCH:
+       case A_B_SEARCH:
+               /*
+                * We have "/string" but no newline.  Add the \n.
+                */
+               return ('\n'); 
+
+       default:
+               /*
+                * Some other incomplete command.  Let user complete it.
+                */
+               return (getchr());
+       }
+}
+
+/*
+ * "Unget" a command character.
+ * The next getcc() will return this character.
+ */
+       public void
+ungetcc(c)
+       int c;
+{
+       if (ungotp == NULL)
+               ungotp = ungot;
+       if (ungotp >= ungot + sizeof(ungot))
+       {
+               error("ungetcc overflow", NULL_PARG);
+               quit(QUIT_ERROR);
+       }
+       *ungotp++ = c;
+}
+
+/*
+ * Unget a whole string of command characters.
+ * The next sequence of getcc()'s will return this string.
+ */
+       public void
+ungetsc(s)
+       char *s;
+{
+       register char *p;
+
+       for (p = s + strlen(s) - 1;  p >= s;  p--)
+               ungetcc(*p);
+}
+
+/*
+ * Search for a pattern, possibly in multiple files.
+ * If SRCH_FIRST_FILE is set, begin searching at the first file.
+ * If SRCH_PAST_EOF is set, continue the search thru multiple files.
+ */
+       static void
+multi_search(pattern, n)
+       char *pattern;
+       int n;
+{
+       register int nomore;
+       IFILE save_ifile;
+       int changed_file;
+
+       changed_file = 0;
+       save_ifile = save_curr_ifile();
+
+       if (search_type & SRCH_FIRST_FILE)
+       {
+               /*
+                * Start at the first (or last) file 
+                * in the command line list.
+                */
+               if (search_type & SRCH_FORW)
+                       nomore = edit_first();
+               else
+                       nomore = edit_last();
+               if (nomore)
+               {
+                       unsave_ifile(save_ifile);
+                       return;
+               }
+               changed_file = 1;
+               search_type &= ~SRCH_FIRST_FILE;
+       }
+
+       for (;;)
+       {
+               n = search(search_type, pattern, n);
+               /*
+                * The SRCH_NO_MOVE flag doesn't "stick": it gets cleared
+                * after being used once.  This allows "n" to work after
+                * using a /@@ search.
+                */
+               search_type &= ~SRCH_NO_MOVE;
+               if (n == 0)
+               {
+                       /*
+                        * Found it.
+                        */
+                       unsave_ifile(save_ifile);
+                       return;
+               }
+
+               if (n < 0)
+                       /*
+                        * Some kind of error in the search.
+                        * Error message has been printed by search().
+                        */
+                       break;
+
+               if ((search_type & SRCH_PAST_EOF) == 0)
+                       /*
+                        * We didn't find a match, but we're
+                        * supposed to search only one file.
+                        */
+                       break;
+               /*
+                * Move on to the next file.
+                */
+               if (search_type & SRCH_FORW)
+                       nomore = edit_next(1);
+               else
+                       nomore = edit_prev(1);
+               if (nomore)
+                       break;
+               changed_file = 1;
+       }
+
+       /*
+        * Didn't find it.
+        * Print an error message if we haven't already.
+        */
+       if (n > 0)
+               error("Pattern not found", NULL_PARG);
+
+       if (changed_file)
+       {
+               /*
+                * Restore the file we were originally viewing.
+                */
+               reedit_ifile(save_ifile);
+       }
+}
+
+/*
+ * Main command processor.
+ * Accept and execute commands until a quit command.
+ */
+       public void
+commands()
+{
+       register int c;
+       register int action;
+       register char *cbuf;
+       int newaction;
+       int save_search_type;
+       char *extra;
+       char tbuf[2];
+       PARG parg;
+       IFILE old_ifile;
+       IFILE new_ifile;
+       char *tagfile;
+
+       search_type = SRCH_FORW;
+       wscroll = (sc_height + 1) / 2;
+       newaction = A_NOACTION;
+
+       for (;;)
+       {
+               mca = 0;
+               cmd_accept();
+               number = 0;
+               optchar = '\0';
+
+               /*
+                * See if any signals need processing.
+                */
+               if (sigs)
+               {
+                       psignals();
+                       if (quitting)
+                               quit(QUIT_SAVED_STATUS);
+               }
+
+               /*
+                * See if window size changed, for systems that don't
+                * generate SIGWINCH.
+                */
+               check_winch();
+
+               /*
+                * Display prompt and accept a character.
+                */
+               cmd_reset();
+               prompt();
+               if (sigs)
+                       continue;
+               if (newaction == A_NOACTION)
+                       c = getcc();
+
+       again:
+               if (sigs)
+                       continue;
+
+               if (newaction != A_NOACTION)
+               {
+                       action = newaction;
+                       newaction = A_NOACTION;
+               } else
+               {
+                       /*
+                        * If we are in a multicharacter command, call mca_char.
+                        * Otherwise we call fcmd_decode to determine the
+                        * action to be performed.
+                        */
+                       if (mca)
+                               switch (mca_char(c))
+                               {
+                               case MCA_MORE:
+                                       /*
+                                        * Need another character.
+                                        */
+                                       c = getcc();
+                                       goto again;
+                               case MCA_DONE:
+                                       /*
+                                        * Command has been handled by mca_char.
+                                        * Start clean with a prompt.
+                                        */
+                                       continue;
+                               case NO_MCA:
+                                       /*
+                                        * Not a multi-char command
+                                        * (at least, not anymore).
+                                        */
+                                       break;
+                               }
+
+                       /*
+                        * Decode the command character and decide what to do.
+                        */
+                       if (mca)
+                       {
+                               /*
+                                * We're in a multichar command.
+                                * Add the character to the command buffer
+                                * and display it on the screen.
+                                * If the user backspaces past the start 
+                                * of the line, abort the command.
+                                */
+                               if (cmd_char(c) == CC_QUIT || len_cmdbuf() == 0)
+                                       continue;
+                               cbuf = get_cmdbuf();
+                       } else
+                       {
+                               /*
+                                * Don't use cmd_char if we're starting fresh
+                                * at the beginning of a command, because we
+                                * don't want to echo the command until we know
+                                * it is a multichar command.  We also don't
+                                * want erase_char/kill_char to be treated
+                                * as line editing characters.
+                                */
+                               tbuf[0] = c;
+                               tbuf[1] = '\0';
+                               cbuf = tbuf;
+                       }
+                       extra = NULL;
+                       action = fcmd_decode(cbuf, &extra);
+                       /*
+                        * If an "extra" string was returned,
+                        * process it as a string of command characters.
+                        */
+                       if (extra != NULL)
+                               ungetsc(extra);
+               }
+               /*
+                * Clear the cmdbuf string.
+                * (But not if we're in the prefix of a command,
+                * because the partial command string is kept there.)
+                */
+               if (action != A_PREFIX)
+                       cmd_reset();
+
+               switch (action)
+               {
+               case A_DIGIT:
+                       /*
+                        * First digit of a number.
+                        */
+                       start_mca(A_DIGIT, ":", (void*)NULL, CF_QUIT_ON_ERASE);
+                       goto again;
+
+               case A_F_WINDOW:
+                       /*
+                        * Forward one window (and set the window size).
+                        */
+                       if (number > 0)
+                               swindow = (int) number;
+                       /* FALLTHRU */
+               case A_F_SCREEN:
+                       /*
+                        * Forward one screen.
+                        */
+                       if (number <= 0)
+                               number = get_swindow();
+                       cmd_exec();
+                       if (show_attn)
+                               set_attnpos(bottompos);
+                       forward((int) number, 0, 1);
+                       break;
+
+               case A_B_WINDOW:
+                       /*
+                        * Backward one window (and set the window size).
+                        */
+                       if (number > 0)
+                               swindow = (int) number;
+                       /* FALLTHRU */
+               case A_B_SCREEN:
+                       /*
+                        * Backward one screen.
+                        */
+                       if (number <= 0)
+                               number = get_swindow();
+                       cmd_exec();
+                       backward((int) number, 0, 1);
+                       break;
+
+               case A_F_LINE:
+                       /*
+                        * Forward N (default 1) line.
+                        */
+                       if (number <= 0)
+                               number = 1;
+                       cmd_exec();
+                       if (show_attn == OPT_ONPLUS && number > 1)
+                               set_attnpos(bottompos);
+                       forward((int) number, 0, 0);
+                       break;
+
+               case A_B_LINE:
+                       /*
+                        * Backward N (default 1) line.
+                        */
+                       if (number <= 0)
+                               number = 1;
+                       cmd_exec();
+                       backward((int) number, 0, 0);
+                       break;
+
+               case A_FF_LINE:
+                       /*
+                        * Force forward N (default 1) line.
+                        */
+                       if (number <= 0)
+                               number = 1;
+                       cmd_exec();
+                       if (show_attn == OPT_ONPLUS && number > 1)
+                               set_attnpos(bottompos);
+                       forward((int) number, 1, 0);
+                       break;
+
+               case A_BF_LINE:
+                       /*
+                        * Force backward N (default 1) line.
+                        */
+                       if (number <= 0)
+                               number = 1;
+                       cmd_exec();
+                       backward((int) number, 1, 0);
+                       break;
+               
+               case A_FF_SCREEN:
+                       /*
+                        * Force forward one screen.
+                        */
+                       if (number <= 0)
+                               number = get_swindow();
+                       cmd_exec();
+                       if (show_attn == OPT_ONPLUS)
+                               set_attnpos(bottompos);
+                       forward((int) number, 1, 0);
+                       break;
+
+               case A_F_FOREVER:
+                       /*
+                        * Forward forever, ignoring EOF.
+                        */
+                       if (ch_getflags() & CH_HELPFILE)
+                               break;
+                       cmd_exec();
+                       jump_forw();
+                       ignore_eoi = 1;
+                       hit_eof = 0;
+                       while (!sigs)
+                               forward(1, 0, 0);
+                       ignore_eoi = 0;
+                       /*
+                        * This gets us back in "F mode" after processing 
+                        * a non-abort signal (e.g. window-change).  
+                        */
+                       if (sigs && !ABORT_SIGS())
+                               newaction = A_F_FOREVER;
+                       break;
+
+               case A_F_SCROLL:
+                       /*
+                        * Forward N lines 
+                        * (default same as last 'd' or 'u' command).
+                        */
+                       if (number > 0)
+                               wscroll = (int) number;
+                       cmd_exec();
+                       if (show_attn == OPT_ONPLUS)
+                               set_attnpos(bottompos);
+                       forward(wscroll, 0, 0);
+                       break;
+
+               case A_B_SCROLL:
+                       /*
+                        * Forward N lines 
+                        * (default same as last 'd' or 'u' command).
+                        */
+                       if (number > 0)
+                               wscroll = (int) number;
+                       cmd_exec();
+                       backward(wscroll, 0, 0);
+                       break;
+
+               case A_FREPAINT:
+                       /*
+                        * Flush buffers, then repaint screen.
+                        * Don't flush the buffers on a pipe!
+                        */
+                       if (ch_getflags() & CH_CANSEEK)
+                       {
+                               ch_flush();
+                               clr_linenum();
+#if HILITE_SEARCH
+                               clr_hilite();
+#endif
+                       }
+                       /* FALLTHRU */
+               case A_REPAINT:
+                       /*
+                        * Repaint screen.
+                        */
+                       cmd_exec();
+                       repaint();
+                       break;
+
+               case A_GOLINE:
+                       /*
+                        * Go to line N, default beginning of file.
+                        */
+                       if (number <= 0)
+                               number = 1;
+                       cmd_exec();
+                       jump_back(number);
+                       break;
+
+               case A_PERCENT:
+                       /*
+                        * Go to a specified percentage into the file.
+                        */
+                       if (number < 0)
+                               number = 0;
+                       if (number > 100)
+                               number = 100;
+                       cmd_exec();
+                       jump_percent((int) number);
+                       break;
+
+               case A_GOEND:
+                       /*
+                        * Go to line N, default end of file.
+                        */
+                       cmd_exec();
+                       if (number <= 0)
+                               jump_forw();
+                       else
+                               jump_back(number);
+                       break;
+
+               case A_GOPOS:
+                       /*
+                        * Go to a specified byte position in the file.
+                        */
+                       cmd_exec();
+                       if (number < 0)
+                               number = 0;
+                       jump_line_loc((POSITION) number, jump_sline);
+                       break;
+
+               case A_STAT:
+                       /*
+                        * Print file name, etc.
+                        */
+                       if (ch_getflags() & CH_HELPFILE)
+                               break;
+                       cmd_exec();
+                       parg.p_string = eq_message();
+                       error("%s", &parg);
+                       break;
+
+               case A_VERSION:
+                       /*
+                        * Print version number, without the "@(#)".
+                        */
+                       cmd_exec();
+                       dispversion();
+                       break;
+
+               case A_QUIT:
+                       /*
+                        * Exit.
+                        */
+                       if (curr_ifile != NULL_IFILE && 
+                           ch_getflags() & CH_HELPFILE)
+                       {
+                               /*
+                                * Quit while viewing the help file
+                                * just means return to viewing the
+                                * previous file.
+                                */
+                               if (edit_prev(1) == 0)
+                                       break;
+                       }
+                       if (extra != NULL)
+                               quit(*extra);
+                       quit(QUIT_OK);
+                       break;
+
+/*
+ * Define abbreviation for a commonly used sequence below.
+ */
+#define        DO_SEARCH()     if (number <= 0) number = 1;    \
+                       mca_search();                   \
+                       cmd_exec();                     \
+                       multi_search((char *)NULL, (int) number);
+
+
+               case A_F_SEARCH:
+                       /*
+                        * Search forward for a pattern.
+                        * Get the first char of the pattern.
+                        */
+                       search_type = SRCH_FORW;
+                       if (number <= 0)
+                               number = 1;
+                       mca_search();
+                       c = getcc();
+                       goto again;
+
+               case A_B_SEARCH:
+                       /*
+                        * Search backward for a pattern.
+                        * Get the first char of the pattern.
+                        */
+                       search_type = SRCH_BACK;
+                       if (number <= 0)
+                               number = 1;
+                       mca_search();
+                       c = getcc();
+                       goto again;
+
+               case A_AGAIN_SEARCH:
+                       /*
+                        * Repeat previous search.
+                        */
+                       DO_SEARCH();
+                       break;
+               
+               case A_T_AGAIN_SEARCH:
+                       /*
+                        * Repeat previous search, multiple files.
+                        */
+                       search_type |= SRCH_PAST_EOF;
+                       DO_SEARCH();
+                       break;
+
+               case A_REVERSE_SEARCH:
+                       /*
+                        * Repeat previous search, in reverse direction.
+                        */
+                       save_search_type = search_type;
+                       search_type = SRCH_REVERSE(search_type);
+                       DO_SEARCH();
+                       search_type = save_search_type;
+                       break;
+
+               case A_T_REVERSE_SEARCH:
+                       /* 
+                        * Repeat previous search, 
+                        * multiple files in reverse direction.
+                        */
+                       save_search_type = search_type;
+                       search_type = SRCH_REVERSE(search_type);
+                       search_type |= SRCH_PAST_EOF;
+                       DO_SEARCH();
+                       search_type = save_search_type;
+                       break;
+
+               case A_UNDO_SEARCH:
+                       undo_search();
+                       break;
+
+               case A_HELP:
+                       /*
+                        * Help.
+                        */
+                       if (ch_getflags() & CH_HELPFILE)
+                               break;
+                       cmd_exec();
+                       (void) edit(FAKE_HELPFILE);
+                       break;
+
+               case A_EXAMINE:
+#if EXAMINE
+                       /*
+                        * Edit a new file.  Get the filename.
+                        */
+                       if (secure)
+                       {
+                               error("Command not available", NULL_PARG);
+                               break;
+                       }
+                       start_mca(A_EXAMINE, "Examine: ", ml_examine, 0);
+                       c = getcc();
+                       goto again;
+#else
+                       error("Command not available", NULL_PARG);
+                       break;
+#endif
+                       
+               case A_VISUAL:
+                       /*
+                        * Invoke an editor on the input file.
+                        */
+#if EDITOR
+                       if (secure)
+                       {
+                               error("Command not available", NULL_PARG);
+                               break;
+                       }
+                       if (ch_getflags() & CH_HELPFILE)
+                               break;
+                       if (strcmp(get_filename(curr_ifile), "-") == 0)
+                       {
+                               error("Cannot edit standard input", NULL_PARG);
+                               break;
+                       }
+                       if (curr_altfilename != NULL)
+                       {
+                               error("Cannot edit file processed with LESSOPEN", 
+                                       NULL_PARG);
+                               break;
+                       }
+                       start_mca(A_SHELL, "!", ml_shell, 0);
+                       /*
+                        * Expand the editor prototype string
+                        * and pass it to the system to execute.
+                        * (Make sure the screen is displayed so the
+                        * expansion of "+%lm" works.)
+                        */
+                       make_display();
+                       cmd_exec();
+                       lsystem(pr_expand(editproto, 0), (char*)NULL);
+                       break;
+#else
+                       error("Command not available", NULL_PARG);
+                       break;
+#endif
+
+               case A_NEXT_FILE:
+                       /*
+                        * Examine next file.
+                        */
+#if TAGS
+                       if (ntags())
+                       {
+                               error("No next file", NULL_PARG);
+                               break;
+                       }
+#endif
+                       if (number <= 0)
+                               number = 1;
+                       if (edit_next((int) number))
+                       {
+                               if (quit_at_eof && hit_eof && 
+                                   !(ch_getflags() & CH_HELPFILE))
+                                       quit(QUIT_OK);
+                               parg.p_string = (number > 1) ? "(N-th) " : "";
+                               error("No %snext file", &parg);
+                       }
+                       break;
+
+               case A_PREV_FILE:
+                       /*
+                        * Examine previous file.
+                        */
+#if TAGS
+                       if (ntags())
+                       {
+                               error("No previous file", NULL_PARG);
+                               break;
+                       }
+#endif
+                       if (number <= 0)
+                               number = 1;
+                       if (edit_prev((int) number))
+                       {
+                               parg.p_string = (number > 1) ? "(N-th) " : "";
+                               error("No %sprevious file", &parg);
+                       }
+                       break;
+
+               case A_NEXT_TAG:
+#if TAGS
+                       if (number <= 0)
+                               number = 1;
+                       tagfile = nexttag((int) number);
+                       if (tagfile == NULL)
+                       {
+                               error("No next tag", NULL_PARG);
+                               break;
+                       }
+                       if (edit(tagfile) == 0)
+                       {
+                               POSITION pos = tagsearch();
+                               if (pos != NULL_POSITION)
+                                       jump_loc(pos, jump_sline);
+                       }
+#else
+                       error("Command not available", NULL_PARG);
+#endif
+                       break;
+
+               case A_PREV_TAG:
+#if TAGS
+                       if (number <= 0)
+                               number = 1;
+                       tagfile = prevtag((int) number);
+                       if (tagfile == NULL)
+                       {
+                               error("No previous tag", NULL_PARG);
+                               break;
+                       }
+                       if (edit(tagfile) == 0)
+                       {
+                               POSITION pos = tagsearch();
+                               if (pos != NULL_POSITION)
+                                       jump_loc(pos, jump_sline);
+                       }
+#else
+                       error("Command not available", NULL_PARG);
+#endif
+                       break;
+
+               case A_INDEX_FILE:
+                       /*
+                        * Examine a particular file.
+                        */
+                       if (number <= 0)
+                               number = 1;
+                       if (edit_index((int) number))
+                               error("No such file", NULL_PARG);
+                       break;
+
+               case A_REMOVE_FILE:
+                       if (ch_getflags() & CH_HELPFILE)
+                               break;
+                       old_ifile = curr_ifile;
+                       new_ifile = getoff_ifile(curr_ifile);
+                       if (new_ifile == NULL_IFILE)
+                       {
+                               bell();
+                               break;
+                       }
+                       if (edit_ifile(new_ifile) != 0)
+                       {
+                               reedit_ifile(old_ifile);
+                               break;
+                       }
+                       del_ifile(old_ifile);
+                       break;
+
+               case A_OPT_TOGGLE:
+                       optflag = OPT_TOGGLE;
+                       optgetname = FALSE;
+                       mca_opt_toggle();
+                       c = getcc();
+                       goto again;
+
+               case A_DISP_OPTION:
+                       /*
+                        * Report a flag setting.
+                        */
+                       optflag = OPT_NO_TOGGLE;
+                       optgetname = FALSE;
+                       mca_opt_toggle();
+                       c = getcc();
+                       goto again;
+
+               case A_FIRSTCMD:
+                       /*
+                        * Set an initial command for new files.
+                        */
+                       start_mca(A_FIRSTCMD, "+", (void*)NULL, 0);
+                       c = getcc();
+                       goto again;
+
+               case A_SHELL:
+                       /*
+                        * Shell escape.
+                        */
+#if SHELL_ESCAPE
+                       if (secure)
+                       {
+                               error("Command not available", NULL_PARG);
+                               break;
+                       }
+                       start_mca(A_SHELL, "!", ml_shell, 0);
+                       c = getcc();
+                       goto again;
+#else
+                       error("Command not available", NULL_PARG);
+                       break;
+#endif
+
+               case A_SETMARK:
+                       /*
+                        * Set a mark.
+                        */
+                       if (ch_getflags() & CH_HELPFILE)
+                               break;
+                       start_mca(A_SETMARK, "mark: ", (void*)NULL, 0);
+                       c = getcc();
+                       if (c == erase_char || c == kill_char ||
+                           c == '\n' || c == '\r')
+                               break;
+                       setmark(c);
+                       break;
+
+               case A_GOMARK:
+                       /*
+                        * Go to a mark.
+                        */
+                       start_mca(A_GOMARK, "goto mark: ", (void*)NULL, 0);
+                       c = getcc();
+                       if (c == erase_char || c == kill_char || 
+                           c == '\n' || c == '\r')
+                               break;
+                       gomark(c);
+                       break;
+
+               case A_PIPE:
+#if PIPEC
+                       if (secure)
+                       {
+                               error("Command not available", NULL_PARG);
+                               break;
+                       }
+                       start_mca(A_PIPE, "|mark: ", (void*)NULL, 0);
+                       c = getcc();
+                       if (c == erase_char || c == kill_char)
+                               break;
+                       if (c == '\n' || c == '\r')
+                               c = '.';
+                       if (badmark(c))
+                               break;
+                       pipec = c;
+                       start_mca(A_PIPE, "!", ml_shell, 0);
+                       c = getcc();
+                       goto again;
+#else
+                       error("Command not available", NULL_PARG);
+                       break;
+#endif
+
+               case A_B_BRACKET:
+               case A_F_BRACKET:
+                       start_mca(action, "Brackets: ", (void*)NULL, 0);
+                       c = getcc();
+                       goto again;
+
+               case A_LSHIFT:
+                       if (number > 0)
+                               shift_count = number;
+                       else
+                               number = (shift_count > 0) ?
+                                       shift_count : sc_width / 2;
+                       if (number > hshift)
+                               number = hshift;
+                       hshift -= number;
+                       screen_trashed = 1;
+                       break;
+
+               case A_RSHIFT:
+                       if (number > 0)
+                               shift_count = number;
+                       else
+                               number = (shift_count > 0) ?
+                                       shift_count : sc_width / 2;
+                       hshift += number;
+                       screen_trashed = 1;
+                       break;
+
+               case A_PREFIX:
+                       /*
+                        * The command is incomplete (more chars are needed).
+                        * Display the current char, so the user knows
+                        * what's going on, and get another character.
+                        */
+                       if (mca != A_PREFIX)
+                       {
+                               cmd_reset();
+                               start_mca(A_PREFIX, " ", (void*)NULL,
+                                       CF_QUIT_ON_ERASE);
+                               (void) cmd_char(c);
+                       }
+                       c = getcc();
+                       goto again;
+
+               case A_NOACTION:
+                       break;
+
+               default:
+                       bell();
+                       break;
+               }
+       }
+}
diff --git a/contrib/less-381/configure b/contrib/less-381/configure
new file mode 100755 (executable)
index 0000000..6264a36
--- /dev/null
@@ -0,0 +1,6511 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.54 for less 1.
+#
+# 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_ALL LC_COLLATE LC_CTYPE LC_NUMERIC LC_MESSAGES 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" >conftest.sh
+  echo  "exit 0"   >>conftest.sh
+  chmod +x conftest.sh
+  if (PATH="/nonexistent;."; conftest.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conftest.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='less'
+PACKAGE_TARNAME='less'
+PACKAGE_VERSION='1'
+PACKAGE_STRING='less 1'
+PACKAGE_BUGREPORT=''
+
+ac_unique_file="forwback.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 CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA REGEX_O 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 less 1 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
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of less 1:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --disable-largefile     omit support for large files
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-regex={auto,pcre,posix,regcmp,re_comp,regcomp,regcomp-local}  Select a regular expression library  auto
+  --with-editor=PROGRAM   use PROGRAM as the default editor vi
+
+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
+less configure 1
+generated by GNU Autoconf 2.54
+
+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 less $as_me 1, which was
+generated by GNU Autoconf 2.54.  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.
+# Also quote any args containing shell meta-characters.
+ac_configure_args=
+ac_sep=
+for ac_arg
+do
+  case $ac_arg in
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n ) continue ;;
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    continue ;;
+  *" "*|*"     "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+    ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+  esac
+  ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+  # Get rid of the leading space.
+  ac_sep=" "
+done
+
+# 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 defines.h"
+
+
+# Checks for programs.
+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" >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH" >&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"
+#include "confdefs.h"
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe"
+# 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=
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+    a.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 --akim.
+          export ac_cv_exeext
+          break;;
+    * ) break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+check \`config.log' for details." >&5
+echo "$as_me: error: C compiler cannot create executables
+check \`config.log' for 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'." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'." >&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
+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" >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link" >&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"
+#include "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
+cat conftest.$ac_ext >&5
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile" >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile" >&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"
+#include "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
+cat 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"
+#include "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
+cat 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"
+#include "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
+cat 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"
+#include "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
+cat conftest.$ac_ext >&5
+continue
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "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
+cat 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
+cat 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
+
+
+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"
+#include "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
+cat 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"
+#include "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
+cat 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
+
+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.
+  # 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"
+#include "confdefs.h"
+#include <assert.h>
+                     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
+  cat 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"
+#include "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
+  cat 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.
+  # 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"
+#include "confdefs.h"
+#include <assert.h>
+                     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
+  cat 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"
+#include "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
+  cat 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" >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&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"
+#include "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"
+#include "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
+
+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'
+
+
+# Checks for compilation model.
+# Check whether --enable-largefile or --disable-largefile was given.
+if test "${enable_largefile+set}" = set; then
+  enableval="$enable_largefile"
+
+fi;
+if test "$enable_largefile" != no; then
+
+  echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5
+echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6
+if test "${ac_cv_sys_largefile_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_sys_largefile_CC=no
+     if test "$GCC" != yes; then
+       ac_save_CC=$CC
+       while :; do
+        # IRIX 6.2 and later do not support large files by default,
+        # so use the C compiler's -n32 option if that helps.
+         cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+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
+  break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext
+        CC="$CC -n32"
+        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_sys_largefile_CC=' -n32'; break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext
+         break
+       done
+       CC=$ac_save_CC
+       rm -f conftest.$ac_ext
+    fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5
+echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6
+  if test "$ac_cv_sys_largefile_CC" != no; then
+    CC=$CC$ac_cv_sys_largefile_CC
+  fi
+
+  echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6
+if test "${ac_cv_sys_file_offset_bits+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  while :; do
+  ac_cv_sys_file_offset_bits=no
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+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
+  break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+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_sys_file_offset_bits=64; break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+  break
+done
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5
+echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6
+if test "$ac_cv_sys_file_offset_bits" != no; then
+
+cat >>confdefs.h <<_ACEOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
+_ACEOF
+
+fi
+rm -f conftest*
+  echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5
+echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6
+if test "${ac_cv_sys_large_files+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  while :; do
+  ac_cv_sys_large_files=no
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+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
+  break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#define _LARGE_FILES 1
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+                      && LARGE_OFF_T % 2147483647 == 1)
+                     ? 1 : -1];
+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_sys_large_files=1; break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+  break
+done
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5
+echo "${ECHO_T}$ac_cv_sys_large_files" >&6
+if test "$ac_cv_sys_large_files" != no; then
+
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+
+fi
+rm -f conftest*
+fi
+
+
+# Checks for general libraries.
+echo "$as_me:$LINENO: checking for initscr in -lxcurses" >&5
+echo $ECHO_N "checking for initscr in -lxcurses... $ECHO_C" >&6
+if test "${ac_cv_lib_xcurses_initscr+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lxcurses  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "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 initscr ();
+int
+main ()
+{
+initscr ();
+  ;
+  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_xcurses_initscr=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_xcurses_initscr=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_xcurses_initscr" >&5
+echo "${ECHO_T}$ac_cv_lib_xcurses_initscr" >&6
+if test $ac_cv_lib_xcurses_initscr = yes; then
+  have_xcurses=yes
+else
+  have_xcurses=no
+fi
+
+echo "$as_me:$LINENO: checking for initscr in -lncurses" >&5
+echo $ECHO_N "checking for initscr in -lncurses... $ECHO_C" >&6
+if test "${ac_cv_lib_ncurses_initscr+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lncurses  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "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 initscr ();
+int
+main ()
+{
+initscr ();
+  ;
+  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_ncurses_initscr=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_ncurses_initscr=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_ncurses_initscr" >&5
+echo "${ECHO_T}$ac_cv_lib_ncurses_initscr" >&6
+if test $ac_cv_lib_ncurses_initscr = yes; then
+  have_ncurses=yes
+else
+  have_ncurses=no
+fi
+
+echo "$as_me:$LINENO: checking for initscr in -lcurses" >&5
+echo $ECHO_N "checking for initscr in -lcurses... $ECHO_C" >&6
+if test "${ac_cv_lib_curses_initscr+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lcurses  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "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 initscr ();
+int
+main ()
+{
+initscr ();
+  ;
+  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_curses_initscr=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_curses_initscr=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_curses_initscr" >&5
+echo "${ECHO_T}$ac_cv_lib_curses_initscr" >&6
+if test $ac_cv_lib_curses_initscr = yes; then
+  have_curses=yes
+else
+  have_curses=no
+fi
+
+echo "$as_me:$LINENO: checking for tgetent in -ltermcap" >&5
+echo $ECHO_N "checking for tgetent in -ltermcap... $ECHO_C" >&6
+if test "${ac_cv_lib_termcap_tgetent+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltermcap  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "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 tgetent ();
+int
+main ()
+{
+tgetent ();
+  ;
+  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_termcap_tgetent=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_termcap_tgetent=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_termcap_tgetent" >&5
+echo "${ECHO_T}$ac_cv_lib_termcap_tgetent" >&6
+if test $ac_cv_lib_termcap_tgetent = yes; then
+  have_termcap=yes
+else
+  have_termcap=no
+fi
+
+echo "$as_me:$LINENO: checking for tgetent in -ltermlib" >&5
+echo $ECHO_N "checking for tgetent in -ltermlib... $ECHO_C" >&6
+if test "${ac_cv_lib_termlib_tgetent+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-ltermlib  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "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 tgetent ();
+int
+main ()
+{
+tgetent ();
+  ;
+  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_termlib_tgetent=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_termlib_tgetent=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_termlib_tgetent" >&5
+echo "${ECHO_T}$ac_cv_lib_termlib_tgetent" >&6
+if test $ac_cv_lib_termlib_tgetent = yes; then
+  have_termlib=yes
+else
+  have_termlib=no
+fi
+
+# Regular expressions (regcmp) are in -lgen on Solaris 2,
+# and in -lintl on SCO Unix.
+
+echo "$as_me:$LINENO: checking for regcmp in -lgen" >&5
+echo $ECHO_N "checking for regcmp in -lgen... $ECHO_C" >&6
+if test "${ac_cv_lib_gen_regcmp+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lgen  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "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 regcmp ();
+int
+main ()
+{
+regcmp ();
+  ;
+  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_gen_regcmp=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_gen_regcmp=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_gen_regcmp" >&5
+echo "${ECHO_T}$ac_cv_lib_gen_regcmp" >&6
+if test $ac_cv_lib_gen_regcmp = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBGEN 1
+_ACEOF
+
+  LIBS="-lgen $LIBS"
+
+fi
+
+
+echo "$as_me:$LINENO: checking for regcmp in -lintl" >&5
+echo $ECHO_N "checking for regcmp in -lintl... $ECHO_C" >&6
+if test "${ac_cv_lib_intl_regcmp+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lintl  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "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 regcmp ();
+int
+main ()
+{
+regcmp ();
+  ;
+  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_intl_regcmp=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_intl_regcmp=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_intl_regcmp" >&5
+echo "${ECHO_T}$ac_cv_lib_intl_regcmp" >&6
+if test $ac_cv_lib_intl_regcmp = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBINTL 1
+_ACEOF
+
+  LIBS="-lintl $LIBS"
+
+fi
+
+
+echo "$as_me:$LINENO: checking for regcmp in -lPW" >&5
+echo $ECHO_N "checking for regcmp in -lPW... $ECHO_C" >&6
+if test "${ac_cv_lib_PW_regcmp+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lPW  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "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 regcmp ();
+int
+main ()
+{
+regcmp ();
+  ;
+  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_PW_regcmp=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_PW_regcmp=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_PW_regcmp" >&5
+echo "${ECHO_T}$ac_cv_lib_PW_regcmp" >&6
+if test $ac_cv_lib_PW_regcmp = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBPW 1
+_ACEOF
+
+  LIBS="-lPW $LIBS"
+
+fi
+
+
+# Checks for terminal libraries
+echo "$as_me:$LINENO: checking for working terminal libraries" >&5
+echo $ECHO_N "checking for working terminal libraries... $ECHO_C" >&6
+TERMLIBS=
+
+# Check for systems where curses is broken.
+curses_broken=0
+if test x`uname -s` = "xHP-UX" >/dev/null 2>&1; then
+if test x`uname -r` = "xB.11.00" >/dev/null 2>&1; then
+   curses_broken=1
+fi
+if test x`uname -r` = "xB.11.11" >/dev/null 2>&1; then
+   curses_broken=1
+fi
+fi
+
+if test $curses_broken = 0; then
+# -- Try xcurses.
+if test "x$TERMLIBS" = x; then
+  if test $have_xcurses = yes; then
+    TERMLIBS="-lxcurses"
+    SAVE_LIBS=$LIBS
+    LIBS="$LIBS $TERMLIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(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
+  termok=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+termok=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+    LIBS=$SAVE_LIBS
+    if test $termok = no; then TERMLIBS=""; fi
+  fi
+fi
+
+# -- Try ncurses.
+if test "x$TERMLIBS" = x; then
+  if test $have_ncurses = yes; then
+    TERMLIBS="-lncurses"
+    SAVE_LIBS=$LIBS
+    LIBS="$LIBS $TERMLIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(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
+  termok=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+termok=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+    LIBS=$SAVE_LIBS
+    if test $termok = no; then TERMLIBS=""; fi
+  fi
+fi
+
+# -- Try curses.
+if test "x$TERMLIBS" = x; then
+  if test $have_curses = yes; then
+    TERMLIBS="-lcurses"
+    SAVE_LIBS=$LIBS
+    LIBS="$LIBS $TERMLIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(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=$?