From 5e29d55ee65bb15a8f24e002654dcf4203c87ee0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Wed, 20 Aug 2008 23:24:01 +0000 Subject: [PATCH] updating less with version 418, based on a checked patch from Scott. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27093 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/bin/less/COPYING | 848 ++-- src/bin/less/LICENSE | 2 +- src/bin/less/Makefile | 112 - src/bin/less/Makefile.aut | 12 +- src/bin/less/Makefile.in | 37 +- src/bin/less/Makefile.wnb | 35 +- src/bin/less/NEWS | 142 + src/bin/less/README | 21 +- src/bin/less/brac.c | 2 +- src/bin/less/ch.c | 62 +- src/bin/less/charset.c | 917 ++++- src/bin/less/charset.h | 19 + src/bin/less/cmd.h | 2 +- src/bin/less/cmdbuf.c | 593 ++- src/bin/less/command.c | 138 +- src/bin/less/configure | 7634 +++++++++++++++++++++++-------------- src/bin/less/configure.ac | 111 +- src/bin/less/decode.c | 9 +- src/bin/less/defines.ds | 11 +- src/bin/less/defines.h | 75 +- src/bin/less/defines.o2 | 11 +- src/bin/less/defines.o9 | 11 +- src/bin/less/defines.wn | 11 +- src/bin/less/edit.c | 51 +- src/bin/less/filename.c | 82 +- src/bin/less/forwback.c | 42 +- src/bin/less/funcs.h | 39 +- src/bin/less/help.c | 7 +- src/bin/less/ifile.c | 2 +- src/bin/less/input.c | 93 +- src/bin/less/install.sh | 2 +- src/bin/less/jump.c | 22 +- src/bin/less/less.h | 125 +- src/bin/less/less.hlp | 7 +- src/bin/less/less.man | 2520 +++++------- src/bin/less/less.nro | 489 ++- src/bin/less/less.rdef | 10 +- src/bin/less/lessecho.c | 4 +- src/bin/less/lessecho.man | 49 + src/bin/less/lessecho.nro | 47 + src/bin/less/lesskey.c | 2 +- src/bin/less/lesskey.h | 2 +- src/bin/less/lesskey.man | 336 +- src/bin/less/lesskey.nro | 4 +- src/bin/less/lglob.h | 2 +- src/bin/less/line.c | 932 +++-- src/bin/less/linenum.c | 10 +- src/bin/less/lsystem.c | 8 +- src/bin/less/main.c | 38 +- src/bin/less/mark.c | 2 +- src/bin/less/mkhelp.c | 2 +- src/bin/less/optfunc.c | 93 +- src/bin/less/option.c | 105 +- src/bin/less/option.h | 2 +- src/bin/less/opttbl.c | 53 +- src/bin/less/os.c | 46 +- src/bin/less/output.c | 255 +- src/bin/less/pckeys.h | 2 +- src/bin/less/position.c | 2 +- src/bin/less/position.h | 2 +- src/bin/less/prompt.c | 39 +- src/bin/less/screen.c | 333 +- src/bin/less/scrsize.c | 2 +- src/bin/less/search.c | 367 +- src/bin/less/signal.c | 10 +- src/bin/less/tags.c | 53 +- src/bin/less/ttyin.c | 37 +- src/bin/less/version.c | 65 +- 68 files changed, 10912 insertions(+), 6298 deletions(-) delete mode 100644 src/bin/less/Makefile create mode 100644 src/bin/less/charset.h create mode 100644 src/bin/less/lessecho.man create mode 100644 src/bin/less/lessecho.nro diff --git a/src/bin/less/COPYING b/src/bin/less/COPYING index d104746444..94a9ed024d 100644 --- a/src/bin/less/COPYING +++ b/src/bin/less/COPYING @@ -1,285 +1,626 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. - 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. + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. - 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. + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. - 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. + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". + TERMS AND CONDITIONS -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. + 0. Definitions. - 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. + "This License" refers to version 3 of the GNU General Public License. -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. + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. - 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: + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. - 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. + A "covered work" means either the unmodified Program or a work based +on the Program. - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. -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. + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. -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. + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. - 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: + 1. Source Code. - 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, + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. - 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, + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. - 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 "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. -The 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. + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. - 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. + The Corresponding Source for a work in source code form is that +same work. - 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 + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of this License. - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. -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. + 13. Use with the GNU Affero General Public License. -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. + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. + 14. Revised Versions 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 + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. - 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. + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. - NO WARRANTY + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. - 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. + 15. Disclaimer of Warranty. - 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. + 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. - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it @@ -287,15 +628,15 @@ free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least +state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) - This program is free software; you can redistribute it and/or modify + This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -304,37 +645,30 @@ the "copyright" line and a pointer to where the full notice is found. 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 - + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 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. + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/src/bin/less/LICENSE b/src/bin/less/LICENSE index dd154f6771..8112859e8a 100644 --- a/src/bin/less/LICENSE +++ b/src/bin/less/LICENSE @@ -2,7 +2,7 @@ ------------ Less -Copyright (C) 1984-2002 Mark Nudelman +Copyright (C) 1984-2007 Mark Nudelman Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/src/bin/less/Makefile b/src/bin/less/Makefile deleted file mode 100644 index 9878a4f465..0000000000 --- a/src/bin/less/Makefile +++ /dev/null @@ -1,112 +0,0 @@ -# Makefile for less. - -#### Start of system configuration section. #### - -srcdir = . - - -CC = gcc -INSTALL = /bin/install -c -INSTALL_PROGRAM = ${INSTALL} -INSTALL_DATA = ${INSTALL} -m 644 - -CFLAGS = -g -O2 -CFLAGS_COMPILE_ONLY = -c -LDFLAGS = -O=o - -LIBS = -ltermcap - -prefix = /usr/local -exec_prefix = ${prefix} - -# Where the installed binary goes. -bindir = ${exec_prefix}/bin -binprefix = - -sysconfdir = ${prefix}/etc - -mandir = ${prefix}/man -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} - -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/src/bin/less/Makefile.aut b/src/bin/less/Makefile.aut index f105d6902f..b2497c03ef 100644 --- a/src/bin/less/Makefile.aut +++ b/src/bin/less/Makefile.aut @@ -24,9 +24,10 @@ 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 \ + charset.h 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 \ + less.nro less.man lesskey.nro lesskey.man lessecho.nro lessecho.man \ + less.hlp \ mkfuncs.awk mkhelp.c \ ${DISTFILES_W} @@ -55,7 +56,8 @@ lint: clean: rm -f Makefile config.status config.log config.cache defines.h stamp-h \ - README NEWS less.nro lesskey.nro less.man lesskey.man + README NEWS \ + less.nro less.man lesskey.nro lesskey.man lessecho.nro lessecho.man distclean: clean realclean: clean @@ -78,6 +80,8 @@ ${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}/lessecho.nro: ${srcdir}/lessecho.nro.VER ${srcdir}/version.c + ${REPLACE_VERSION} ${srcdir}/lessecho.nro.VER ${srcdir}/less.hlp: ${srcdir}/less.hlp.VER ${srcdir}/version.c ${REPLACE_VERSION} ${srcdir}/less.hlp.VER @@ -85,6 +89,8 @@ ${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 +${srcdir}/lessecho.man: ${srcdir}/lessecho.nro + ${NROFF} ${srcdir}/lessecho.nro >${srcdir}/lessecho.man distfiles: ${DISTFILES} diff --git a/src/bin/less/Makefile.in b/src/bin/less/Makefile.in index 8e976bb43a..9d27d4a0ca 100644 --- a/src/bin/less/Makefile.in +++ b/src/bin/less/Makefile.in @@ -13,6 +13,8 @@ INSTALL_DATA = @INSTALL_DATA@ CFLAGS = @CFLAGS@ CFLAGS_COMPILE_ONLY = -c LDFLAGS = @LDFLAGS@ +CPPFLAGS = @CPPFLAGS@ +EXEEXT = @EXEEXT@ O=o LIBS = @LIBS@ @@ -25,10 +27,12 @@ bindir = @bindir@ binprefix = sysconfdir = @sysconfdir@ +datarootdir = @datarootdir@ mandir = @mandir@ manext = 1 manprefix = +DESTDIR = #### End of system configuration section. #### @@ -46,35 +50,40 @@ OBJ = main.${O} screen.${O} brac.${O} ch.${O} charset.${O} cmdbuf.${O} \ output.${O} position.${O} prompt.${O} search.${O} signal.${O} \ tags.${O} ttyin.${O} version.${O} @REGEX_O@ -all: less lesskey lessecho +all: less$(EXEEXT) lesskey$(EXEEXT) lessecho$(EXEEXT) -less: ${OBJ} +less$(EXEEXT): ${OBJ} ${CC} ${LDFLAGS} -o $@ ${OBJ} ${LIBS} -lesskey: lesskey.${O} version.${O} +lesskey$(EXEEXT): lesskey.${O} version.${O} ${CC} ${LDFLAGS} -o $@ lesskey.${O} version.${O} -lessecho: lessecho.${O} version.${O} +lessecho$(EXEEXT): 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: all ${srcdir}/less.nro ${srcdir}/lesskey.nro ${srcdir}/lessecho.nro installdirs + ${INSTALL_PROGRAM} less$(EXEEXT) ${DESTDIR}${bindir}/${binprefix}less$(EXEEXT) + ${INSTALL_PROGRAM} lesskey$(EXEEXT) ${DESTDIR}${bindir}/${binprefix}lesskey$(EXEEXT) + ${INSTALL_PROGRAM} lessecho$(EXEEXT) ${DESTDIR}${bindir}/${binprefix}lessecho$(EXEEXT) + ${INSTALL_DATA} ${srcdir}/less.nro ${DESTDIR}${mandir}/man${manext}/${manprefix}less.${manext} + ${INSTALL_DATA} ${srcdir}/lesskey.nro ${DESTDIR}${mandir}/man${manext}/${manprefix}lesskey.${manext} + ${INSTALL_DATA} ${srcdir}/lessecho.nro ${DESTDIR}${mandir}/man${manext}/${manprefix}lessecho.${manext} install-strip: ${MAKE} INSTALL_PROGRAM='${INSTALL_PROGRAM} -s' install installdirs: mkinstalldirs - ${srcdir}/mkinstalldirs ${bindir} ${mandir}/man${manext} + ${srcdir}/mkinstalldirs ${DESTDIR}${bindir} ${DESTDIR}${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} + rm -f ${DESTDIR}${bindir}/${binprefix}less$(EXEEXT) + rm -f ${DESTDIR}${bindir}/${binprefix}lesskey$(EXEEXT) + rm -f ${DESTDIR}${bindir}/${binprefix}lessecho$(EXEEXT) + rm -f ${DESTDIR}${mandir}/man${manext}/${manprefix}less.${manext} + rm -f ${DESTDIR}${mandir}/man${manext}/${manprefix}lesskey.${manext} + rm -f ${DESTDIR}${mandir}/man${manext}/${manprefix}lessecho.${manext} info: install-info: @@ -100,7 +109,7 @@ ${srcdir}/configure: ${srcdir}/configure.ac cd ${srcdir}; autoheader; autoconf clean: - rm -f *.${O} core less lesskey lessecho + rm -f *.${O} core less$(EXEEXT) lesskey$(EXEEXT) lessecho$(EXEEXT) mostlyclean: clean diff --git a/src/bin/less/Makefile.wnb b/src/bin/less/Makefile.wnb index 4da10fcbe2..2d1c85b862 100644 --- a/src/bin/less/Makefile.wnb +++ b/src/bin/less/Makefile.wnb @@ -1,20 +1,27 @@ # Makefile for less. # Windows version +# Bolarnd C++ 5.5.1 free command line tools #### Start of system configuration section. #### +# +# Borland's make knows its own location in the +# filesystem. +# CC = bcc32 -LIBDIR = d:\bc45\lib +LIBDIR = $(MAKEDIR)\..\lib CFLAGS = -O2 -w-pro -TWC -P-c -v- -d -f- -ff- -vi -LDFLAGS = /Tpe /v- /ap /c /x -LD = tlink32 +LDFLAGS = -Tpe -v- -ap -c -x -V4.0 -GF:AGGRESSIVE +LD = ilink32 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} $< @@ -25,16 +32,20 @@ OBJ = main.obj screen.obj brac.obj ch.obj charset.obj cmdbuf.obj command.obj \ position.obj prompt.obj search.obj signal.obj tags.obj \ ttyin.obj version.obj regexp.obj -all: less lesskey +all: less lesskey lessecho +# # 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} + ${LD} ${LDFLAGS} ${LIBDIR}\c0x32.obj $**, $@,,${LIBS} lesskey: lesskey.obj version.obj - ${LD} ${LDFLAGS} ${LIBDIR}\c0x32.obj lesskey.obj version.obj, $@,,${LIBS} + ${LD} ${LDFLAGS} ${LIBDIR}\c0x32.obj $**, $@,,${LIBS} + +lessecho: lessecho.obj version.obj + ${LD} ${LDFLAGS} ${LIBDIR}\c0x32.obj $**, $@,,${LIBS} defines.h: defines.wn -del defines.h @@ -44,6 +55,16 @@ ${OBJ}: less.h defines.h funcs.h cmd.h clean: -del *.obj + -del *.il? + -del *.tds + -del defines.h + +spotless: clean -del less.exe -del lesskey.exe + -del lessecho.exe + +realclean: spotless + +distclean: spotless diff --git a/src/bin/less/NEWS b/src/bin/less/NEWS index 6019cad3b7..3887081caf 100644 --- a/src/bin/less/NEWS +++ b/src/bin/less/NEWS @@ -13,6 +13,143 @@ ====================================================================== + Major changes between "less" versions 416 and 418 + +* Color escape sequences are now supported in WIN32 build. + +* Makefile now uses EXEEXT feature of autoconf. + +* Fix search bug when using -R and text contains ANSI color escape sequences. + +* Fix crash when using -r with UTF-8 text containing 0x9B bytes. + +* Fix display bug when using ' command to move less than one page forward. + +* Update GPL to version 3. + +====================================================================== + + Major changes between "less" versions 409 and 416 + +* New --follow-name option makes F command follow the name of a file + rather than the file descriptor if an open file is renamed. + +* Make searching with -i/-I work correctly with non-ASCII text. + +* Fix DJGPP build. + +====================================================================== + + Major changes between "less" versions 406 and 409 + +* Support CSI escape sequences, like SGR escape sequences. + +* Fix bug which caused screen to fail to repaint when window is resized. + +* Fix bug in using -i and -I flags with non-ASCII text. + +* Fix configure bug on systems which don't support langinfo.h. + +* Fix crash when searching text containing certain invalid UTF-8 sequences. + +====================================================================== + + Major changes between "less" versions 394 and 406 + +* Allow decimal point in number for % (percent) command. + +* Allow decimal point in number for -j option (fraction of screen height). + +* Make n command fetch previous pattern from history file on first search. + +* Don't rewrite history file if it has not changed. + +* Don't move to bottom of screen on first page. + +* Don't output extraneous newlines, so copy & pasting lines from the + output works better. + +* The -c option has been made identical with the -C option. + +* Allow "/dev/null" as synomym for "-" in LESSHISTFILE to indicate + that no history file should be used. + +* Search can now find text which follows a null byte, if the PCRE + library is used, or if no-regex searching (ctrl-R) is used. + +* Better compatibility with POSIX more specification. + +* Make -f work for directories. + +* Make "t" cmd traverse tags in the correct order. + +* Allow a few binary characters in the input file before warning + that the file is binary. + +* Don't warn that file is binary if it merely contains ANSI color sequences + and -R is in effect. + +* Update Unicode character tables. + +* Support DESTDIR in Makefile. + +* Fix bug when filename contains certain shell metacharacters such as "$". + +* Fix bug when resizing the window while waiting for input from a pipe. + +* Fix configure bugs. + +====================================================================== + + Major changes between "less" versions 382 and 394 + +* Add history file to save search and shell command history between + invocations of less. + +* Improve behavior of history list for search and shell commands. + +* Add -K (or --quit-on-intr) option to make less exit immediately on ctrl-C. + +* Improve handling of UTF-8 files and commands, including better + line wrapping and handling double-width chars. + +* Added LESSUTFBINFMT environment variable to control display of + non-printable characters in a UTF-8 file. + +* Add --with-secure option to configure, to make it easier to + build a secure version of less. + +* Show search matches in the status column even if search highlights + are disabled via the -G option or the ESC-u command. + +* Improve performance when the file contains very long lines. + +* Add "windows" charset. + +* Add man page for lessecho. + +* Add support for erase2 character, treated same as erase. + +* Use ASCII lowercase/uppercase logic when operating on the command line. + +* Update makefile for Borland C++ 5.5.1. + +* Fix bug in calculating number of pages for %D prompt. + +* Fix bug in handling tag file error. + +* Fix obscure bug if input file is deleted while viewing help. + +* Fix bug handling filenames which include square brackets. + +* Fix possible buffer overflow in "global" tag search. + +* Fix possible buffer overflow in usage of LESSOPEN and LESSCLOSE. + +* Fix buffer overflow in reverse search. + +====================================================================== + Major changes between "less" versions 381 and 382 * Removed some old copyrighted code. @@ -584,3 +721,8 @@ * 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/src/bin/less/README b/src/bin/less/README index cf7806f9a2..c9e520aa62 100644 --- a/src/bin/less/README +++ b/src/bin/less/README @@ -1,26 +1,20 @@ - Less, version 382 + Less, version 418 - This is the distribution of less, version 382, released 03 Feb 2004. + This is the distribution of less, version 418, released 02 Jan 2008. 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 + Software Foundation; either version 3, 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 ========================================================================= @@ -46,6 +40,7 @@ INSTALLATION (Unix systems only): --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 @@ -57,6 +52,11 @@ INSTALLATION (Unix systems only): regcomp Use the V8-compatible regcomp. regcomp-local Use Henry Spencer's V8-compatible regcomp (source is supplied with less). + --with-secure + Builds a "secure" version of less, with some features disabled + to prevent users from viewing other files, accessing shell + commands, etc. + 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 @@ -67,9 +67,6 @@ INSTALLATION (Unix systems only): -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. diff --git a/src/bin/less/brac.c b/src/bin/less/brac.c index 43c9dacb24..20c7353469 100644 --- a/src/bin/less/brac.c +++ b/src/bin/less/brac.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. diff --git a/src/bin/less/ch.c b/src/bin/less/ch.c index 0446a2c229..eb607d593b 100644 --- a/src/bin/less/ch.c +++ b/src/bin/less/ch.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -21,6 +21,12 @@ #include #endif +#if HAVE_STAT_INO +#include +extern dev_t curr_dev; +extern ino_t curr_ino; +#endif + typedef POSITION BLOCKNUM; public int ignore_eoi; @@ -98,6 +104,8 @@ static int maxbufs = -1; extern int autobuf; extern int sigs; extern int secure; +extern int screen_trashed; +extern int follow_mode; extern constant char helpdata[]; extern constant int size_helpdata; extern IFILE curr_ifile; @@ -128,6 +136,9 @@ fch_get() POSITION pos; POSITION len; + if (thisfile == NULL) + return (EOI); + slept = FALSE; /* @@ -192,7 +203,7 @@ fch_get() */ if (!(ch_flags & CH_CANSEEK)) return ('?'); - if (lseek(ch_file, (off_t)pos, 0) == BAD_LSEEK) + if (lseek(ch_file, (off_t)pos, SEEK_SET) == BAD_LSEEK) { error("seek error", NULL_PARG); clear_eol(); @@ -273,6 +284,25 @@ fch_get() #endif #endif slept = TRUE; + +#if HAVE_STAT_INO + if (follow_mode == FOLLOW_NAME) + { + /* See whether the file's i-number has changed. + * If so, force the file to be closed and + * reopened. */ + struct stat st; + int r = stat(get_filename(curr_ifile), &st); + if (r == 0 && (st.st_ino != curr_ino || + st.st_dev != curr_dev)) + { + /* screen_trashed=2 causes + * make_display to reopen the file. */ + screen_trashed = 2; + return (EOI); + } + } +#endif } if (sigs) return (EOI); @@ -416,6 +446,9 @@ ch_seek(pos) BLOCKNUM new_block; POSITION len; + if (thisfile == NULL) + return (0); + len = ch_length(); if (pos < ch_zero() || (len != NULL_POSITION && pos > len)) return (1); @@ -450,6 +483,9 @@ ch_end_seek() { POSITION len; + if (thisfile == NULL) + return (0); + if (ch_flags & CH_CANSEEK) ch_fsize = filesize(ch_file); @@ -503,6 +539,8 @@ ch_beg_seek() public POSITION ch_length() { + if (thisfile == NULL) + return (NULL_POSITION); if (ignore_eoi) return (NULL_POSITION); if (ch_flags & CH_HELPFILE) @@ -516,6 +554,8 @@ ch_length() public POSITION ch_tell() { + if (thisfile == NULL) + return (NULL_POSITION); return (ch_block * LBUFSIZE) + ch_offset; } @@ -527,6 +567,8 @@ ch_forw_get() { register int c; + if (thisfile == NULL) + return (EOI); c = ch_get(); if (c == EOI) return (EOI); @@ -546,6 +588,8 @@ ch_forw_get() public int ch_back_get() { + if (thisfile == NULL) + return (EOI); if (ch_offset > 0) ch_offset --; else @@ -586,6 +630,9 @@ ch_flush() { register struct buf *bp; + if (thisfile == NULL) + return; + if (!(ch_flags & CH_CANSEEK)) { /* @@ -628,7 +675,7 @@ ch_flush() } #endif - if (lseek(ch_file, (off_t)0, 0) == BAD_LSEEK) + if (lseek(ch_file, (off_t)0, SEEK_SET) == BAD_LSEEK) { /* * Warning only; even if the seek fails for some reason, @@ -691,7 +738,7 @@ ch_delbufs() while (ch_bufhead != END_OF_CHAIN) { bp = ch_bufhead; - bp->next->prev = bp->prev;; + bp->next->prev = bp->prev; bp->prev->next = bp->next; free(bp); } @@ -717,7 +764,7 @@ seekable(f) return (0); } #endif - return (lseek(f, (off_t)1, 0) != BAD_LSEEK); + return (lseek(f, (off_t)1, SEEK_SET) != BAD_LSEEK); } /* @@ -769,6 +816,9 @@ ch_close() { int keepstate = FALSE; + if (thisfile == NULL) + return; + if (ch_flags & (CH_CANSEEK|CH_POPENED|CH_HELPFILE)) { /* @@ -807,6 +857,8 @@ ch_close() public int ch_getflags() { + if (thisfile == NULL) + return (0); return (ch_flags); } diff --git a/src/bin/less/charset.c b/src/bin/less/charset.c index 163994f564..37d344de69 100644 --- a/src/bin/less/charset.c +++ b/src/bin/less/charset.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -18,8 +18,11 @@ #if HAVE_LOCALE #include #include +#include #endif +#include "charset.h" + public int utf_mode = 0; /* @@ -31,23 +34,76 @@ struct charset { 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." }, + { "ascii", NULL, "8bcccbcc18b95.b" }, + { "utf-8", &utf_mode, "8bcccbcc18b95.b126.bb" }, + { "iso8859", NULL, "8bcccbcc18b95.33b." }, + { "latin3", NULL, "8bcccbcc18b95.33b5.b8.b15.b4.b12.b18.b12.b." }, + { "arabic", NULL, "8bcccbcc18b95.33b.3b.7b2.13b.3b.b26.5b19.b" }, + { "greek", NULL, "8bcccbcc18b95.33b4.2b4.b3.b35.b44.b" }, + { "greek2005", NULL, "8bcccbcc18b95.33b14.b35.b44.b" }, + { "hebrew", NULL, "8bcccbcc18b95.33b.b29.32b28.2b2.b" }, + { "koi8-r", NULL, "8bcccbcc18b95.b." }, + { "KOI8-T", NULL, "8bcccbcc18b95.b8.b6.b8.b.b.5b7.3b4.b4.b3.b.b.3b." }, + { "georgianps", NULL, "8bcccbcc18b95.3b11.4b12.2b." }, + { "tcvn", NULL, "b..b...bcccbccbbb7.8b95.b48.5b." }, + { "TIS-620", NULL, "8bcccbcc18b95.b.4b.11b7.8b." }, + { "next", NULL, "8bcccbcc18b95.bb125.bb" }, + { "dos", NULL, "8bcccbcc12bc5b95.b." }, + { "windows-1251", NULL, "8bcccbcc12bc5b95.b24.b." }, + { "windows-1252", NULL, "8bcccbcc12bc5b95.b.b11.b.2b12.b." }, + { "windows-1255", NULL, "8bcccbcc12bc5b95.b.b8.b.5b9.b.4b." }, + { "ebcdic", NULL, "5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b." }, + { "IBM-1047", NULL, "4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc191.b" }, { NULL, NULL, NULL } }; +/* + * Support "locale charmap"/nl_langinfo(CODESET) values, as well as others. + */ struct cs_alias { char *name; char *oname; } cs_aliases[] = { - { "latin1", "iso8859" }, - { "latin9", "iso8859" }, + { "UTF-8", "utf-8" }, + { "ANSI_X3.4-1968", "ascii" }, + { "US-ASCII", "ascii" }, + { "latin1", "iso8859" }, + { "ISO-8859-1", "iso8859" }, + { "latin9", "iso8859" }, + { "ISO-8859-15", "iso8859" }, + { "latin2", "iso8859" }, + { "ISO-8859-2", "iso8859" }, + { "ISO-8859-3", "latin3" }, + { "latin4", "iso8859" }, + { "ISO-8859-4", "iso8859" }, + { "cyrillic", "iso8859" }, + { "ISO-8859-5", "iso8859" }, + { "ISO-8859-6", "arabic" }, + { "ISO-8859-7", "greek" }, + { "IBM9005", "greek2005" }, + { "ISO-8859-8", "hebrew" }, + { "latin5", "iso8859" }, + { "ISO-8859-9", "iso8859" }, + { "latin6", "iso8859" }, + { "ISO-8859-10", "iso8859" }, + { "latin7", "iso8859" }, + { "ISO-8859-13", "iso8859" }, + { "latin8", "iso8859" }, + { "ISO-8859-14", "iso8859" }, + { "latin10", "iso8859" }, + { "ISO-8859-16", "iso8859" }, + { "IBM437", "dos" }, + { "EBCDIC-US", "ebcdic" }, + { "IBM1047", "IBM-1047" }, + { "KOI8-R", "koi8-r" }, + { "KOI8-U", "koi8-r" }, + { "GEORGIAN-PS", "georgianps" }, + { "TCVN5712-1", "tcvn" }, + { "NEXTSTEP", "next" }, + { "windows", "windows-1252" }, /* backward compatibility */ + { "CP1251", "windows-1251" }, + { "CP1252", "windows-1252" }, + { "CP1255", "windows-1255" }, { NULL, NULL } }; @@ -56,6 +112,7 @@ struct cs_alias { static char chardef[256]; static char *binfmt = NULL; +static char *utfbinfmt = NULL; public int binattr = AT_STANDOUT; @@ -131,8 +188,9 @@ ichardef(s) * The valid charset names are listed in the "charsets" array. */ static int -icharset(name) +icharset(name, no_error) register char *name; + int no_error; { register struct charset *p; register struct cs_alias *a; @@ -161,9 +219,10 @@ icharset(name) } } - error("invalid charset name", NULL_PARG); - quit(QUIT_ERROR); - /*NOTREACHED*/ + if (!no_error) { + error("invalid charset name", NULL_PARG); + quit(QUIT_ERROR); + } return (0); } @@ -176,7 +235,6 @@ ilocale() { register int c; - setlocale(LC_ALL, ""); for (c = 0; c < (int) sizeof(chardef); c++) { if (isprint(c)) @@ -190,17 +248,39 @@ ilocale() #endif /* - * Define the printing format for control chars. + * Define the printing format for control (or binary utf) chars. */ - public void -setbinfmt(s) + static void +setbinfmt(s, fmtvarptr, default_fmt) char *s; + char **fmtvarptr; + char *default_fmt; { - if (s == NULL || *s == '\0') - s = "*s<%X>"; + if (s && utf_mode) + { + /* It would be too hard to account for width otherwise. */ + char *t = s; + while (*t) + { + if (*t < ' ' || *t > '~') + { + s = default_fmt; + goto attr; + } + t++; + } + } + + /* %n is evil */ + if (s == NULL || *s == '\0' || + (*s == '*' && (s[1] == '\0' || s[2] == '\0' || strchr(s + 2, 'n'))) || + (*s != '*' && strchr(s, 'n'))) + s = default_fmt; + /* * Select the attributes if it starts with "*". */ + attr: if (*s == '*') { switch (s[1]) @@ -213,26 +293,24 @@ setbinfmt(s) } s += 2; } - binfmt = s; + *fmtvarptr = s; } /* - * Initialize charset data structures. + * */ - public void -init_charset() + static void +set_charset() { - register char *s; + char *s; - s = lgetenv("LESSBINFMT"); - setbinfmt(s); - /* * See if environment variable LESSCHARSET is defined. */ s = lgetenv("LESSCHARSET"); - if (icharset(s)) + if (icharset(s, 0)) return; + /* * LESSCHARSET is not defined: try LESSCHARDEF. */ @@ -243,6 +321,17 @@ init_charset() return; } +#if HAVE_LOCALE +#ifdef CODESET + /* + * Try using the codeset name as the charset name. + */ + s = nl_langinfo(CODESET); + if (icharset(s, 1)) + return; +#endif +#endif + #if HAVE_STRSTR /* * Check whether LC_ALL, LC_CTYPE or LANG look like UTF-8 is used. @@ -251,32 +340,54 @@ init_charset() (s = lgetenv("LC_CTYPE")) != NULL || (s = lgetenv("LANG")) != NULL) { - if (strstr(s, "UTF-8") != NULL || strstr(s, "utf-8") != NULL) - if (icharset("utf-8")) + if ( strstr(s, "UTF-8") != NULL || strstr(s, "utf-8") != NULL + || strstr(s, "UTF8") != NULL || strstr(s, "utf8") != NULL) + if (icharset("utf-8", 1)) return; } #endif #if HAVE_LOCALE /* - * Use setlocale. + * Get character definitions from locale functions, + * rather than from predefined charset entry. */ ilocale(); -#else #if MSDOS_COMPILER /* * Default to "dos". */ - (void) icharset("dos"); + (void) icharset("dos", 1); #else /* * Default to "latin1". */ - (void) icharset("latin1"); + (void) icharset("latin1", 1); #endif #endif } +/* + * Initialize charset data structures. + */ + public void +init_charset() +{ + char *s; + +#if HAVE_LOCALE + setlocale(LC_ALL, ""); +#endif + + set_charset(); + + s = lgetenv("LESSBINFMT"); + setbinfmt(s, &binfmt, "*s<%02X>"); + + s = lgetenv("LESSUTFBINFMT"); + setbinfmt(s, &utfbinfmt, ""); +} + /* * Is a given character a "binary" character? */ @@ -307,16 +418,17 @@ control_char(c) prchar(c) int c; { - static char buf[8]; + /* {{ This buffer can be overrun if LESSBINFMT is a long string. }} */ + static char buf[32]; c &= 0377; - if (!control_char(c)) - sprintf(buf, "%c", c); + if ((c < 128 || !utf_mode) && !control_char(c)) + SNPRINTF1(buf, sizeof(buf), "%c", c); else if (c == ESC) - sprintf(buf, "ESC"); + strcpy(buf, "ESC"); #if IS_EBCDIC_HOST else if (!binary_char(c) && c < 64) - sprintf(buf, "^%c", + SNPRINTF1(buf, sizeof(buf), "^%c", /* * This array roughly inverts CONTROL() #defined in less.h, * and should be kept in sync with CONTROL() and IBM-1047. @@ -328,9 +440,728 @@ prchar(c) "..V....D....TU.Z"[c]); #else else if (c < 128 && !control_char(c ^ 0100)) - sprintf(buf, "^%c", c ^ 0100); + SNPRINTF1(buf, sizeof(buf), "^%c", c ^ 0100); #endif else - sprintf(buf, binfmt, c); + SNPRINTF1(buf, sizeof(buf), binfmt, c); return (buf); } + +/* + * Return the printable form of a UTF-8 character. + */ + public char * +prutfchar(ch) + LWCHAR ch; +{ + static char buf[32]; + + if (ch == ESC) + strcpy(buf, "ESC"); + else if (ch < 128 && control_char(ch)) + { + if (!control_char(ch ^ 0100)) + SNPRINTF1(buf, sizeof(buf), "^%c", ((char) ch) ^ 0100); + else + SNPRINTF1(buf, sizeof(buf), binfmt, (char) ch); + } else if (is_ubin_char(ch)) + SNPRINTF1(buf, sizeof(buf), utfbinfmt, ch); + else + { + int len; + if (ch >= 0x80000000) + { + len = 3; + ch = 0xFFFD; + } else + { + len = (ch < 0x80) ? 1 + : (ch < 0x800) ? 2 + : (ch < 0x10000) ? 3 + : (ch < 0x200000) ? 4 + : (ch < 0x4000000) ? 5 + : 6; + } + buf[len] = '\0'; + if (len == 1) + *buf = (char) ch; + else + { + *buf = ((1 << len) - 1) << (8 - len); + while (--len > 0) + { + buf[len] = (char) (0x80 | (ch & 0x3F)); + ch >>= 6; + } + *buf |= ch; + } + } + return (buf); +} + +/* + * Get the length of a UTF-8 character in bytes. + */ + public int +utf_len(ch) + char ch; +{ + if ((ch & 0x80) == 0) + return 1; + if ((ch & 0xE0) == 0xC0) + return 2; + if ((ch & 0xF0) == 0xE0) + return 3; + if ((ch & 0xF8) == 0xF0) + return 4; + if ((ch & 0xFC) == 0xF8) + return 5; + if ((ch & 0xFE) == 0xFC) + return 6; + /* Invalid UTF-8 encoding. */ + return 1; +} + +/* + * Is a UTF-8 character well-formed? + */ + public int +is_utf8_well_formed(s) + unsigned char *s; +{ + int i; + int len; + + if (IS_UTF8_INVALID(s[0])) + return (0); + + len = utf_len((char) s[0]); + if (len == 1) + return (1); + if (len == 2) + { + if (s[0] < 0xC2) + return (0); + } else + { + unsigned char mask; + mask = (~((1 << (8-len)) - 1)) & 0xFF; + if (s[0] == mask && (s[1] & mask) == 0x80) + return (0); + } + + for (i = 1; i < len; i++) + if (!IS_UTF8_TRAIL(s[i])) + return (0); + return (1); +} + +/* + * Get the value of a UTF-8 character. + */ + public LWCHAR +get_wchar(p) + char *p; +{ + switch (utf_len(p[0])) + { + case 1: + default: + /* 0xxxxxxx */ + return (LWCHAR) + (p[0] & 0xFF); + case 2: + /* 110xxxxx 10xxxxxx */ + return (LWCHAR) ( + ((p[0] & 0x1F) << 6) | + (p[1] & 0x3F)); + case 3: + /* 1110xxxx 10xxxxxx 10xxxxxx */ + return (LWCHAR) ( + ((p[0] & 0x0F) << 12) | + ((p[1] & 0x3F) << 6) | + (p[2] & 0x3F)); + case 4: + /* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */ + return (LWCHAR) ( + ((p[0] & 0x07) << 18) | + ((p[1] & 0x3F) << 12) | + ((p[2] & 0x3F) << 6) | + (p[3] & 0x3F)); + case 5: + /* 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */ + return (LWCHAR) ( + ((p[0] & 0x03) << 24) | + ((p[1] & 0x3F) << 18) | + ((p[2] & 0x3F) << 12) | + ((p[3] & 0x3F) << 6) | + (p[4] & 0x3F)); + case 6: + /* 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */ + return (LWCHAR) ( + ((p[0] & 0x01) << 30) | + ((p[1] & 0x3F) << 24) | + ((p[2] & 0x3F) << 18) | + ((p[3] & 0x3F) << 12) | + ((p[4] & 0x3F) << 6) | + (p[5] & 0x3F)); + } +} + +/* + * Store a character into a UTF-8 string. + */ + public void +put_wchar(pp, ch) + char **pp; + LWCHAR ch; +{ + if (!utf_mode || ch < 0x80) + { + /* 0xxxxxxx */ + *(*pp)++ = (char) ch; + } else if (ch < 0x800) + { + /* 110xxxxx 10xxxxxx */ + *(*pp)++ = (char) (0xC0 | ((ch >> 6) & 0x1F)); + *(*pp)++ = (char) (0x80 | (ch & 0x3F)); + } else if (ch < 0x10000) + { + /* 1110xxxx 10xxxxxx 10xxxxxx */ + *(*pp)++ = (char) (0xE0 | ((ch >> 12) & 0x0F)); + *(*pp)++ = (char) (0x80 | ((ch >> 6) & 0x3F)); + *(*pp)++ = (char) (0x80 | (ch & 0x3F)); + } else if (ch < 0x200000) + { + /* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */ + *(*pp)++ = (char) (0xF0 | ((ch >> 18) & 0x07)); + *(*pp)++ = (char) (0x80 | ((ch >> 12) & 0x3F)); + *(*pp)++ = (char) (0x80 | ((ch >> 6) & 0x3F)); + *(*pp)++ = (char) (0x80 | (ch & 0x3F)); + } else if (ch < 0x4000000) + { + /* 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */ + *(*pp)++ = (char) (0xF0 | ((ch >> 24) & 0x03)); + *(*pp)++ = (char) (0x80 | ((ch >> 18) & 0x3F)); + *(*pp)++ = (char) (0x80 | ((ch >> 12) & 0x3F)); + *(*pp)++ = (char) (0x80 | ((ch >> 6) & 0x3F)); + *(*pp)++ = (char) (0x80 | (ch & 0x3F)); + } else + { + /* 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */ + *(*pp)++ = (char) (0xF0 | ((ch >> 30) & 0x01)); + *(*pp)++ = (char) (0x80 | ((ch >> 24) & 0x3F)); + *(*pp)++ = (char) (0x80 | ((ch >> 18) & 0x3F)); + *(*pp)++ = (char) (0x80 | ((ch >> 12) & 0x3F)); + *(*pp)++ = (char) (0x80 | ((ch >> 6) & 0x3F)); + *(*pp)++ = (char) (0x80 | (ch & 0x3F)); + } +} + +/* + * Step forward or backward one character in a string. + */ + public LWCHAR +step_char(pp, dir, limit) + char **pp; + signed int dir; + char *limit; +{ + LWCHAR ch; + int len; + char *p = *pp; + + if (!utf_mode) + { + /* It's easy if chars are one byte. */ + if (dir > 0) + ch = (LWCHAR) ((p < limit) ? *p++ : 0); + else + ch = (LWCHAR) ((p > limit) ? *--p : 0); + } else if (dir > 0) + { + len = utf_len(*p); + if (p + len > limit) + { + ch = 0; + p = limit; + } else + { + ch = get_wchar(p); + p += len; + } + } else + { + while (p > limit && IS_UTF8_TRAIL(p[-1])) + p--; + if (p > limit) + ch = get_wchar(--p); + else + ch = 0; + } + *pp = p; + return ch; +} + +/* + * Unicode characters data + */ +struct wchar_range { LWCHAR first, last; }; + +/* + * Characters with general category values + * Mn: Mark, Nonspacing + * Me: Mark, Enclosing + * Last synched with + * + * dated 2005-11-30T00:58:48Z + */ +static struct wchar_range comp_table[] = { + { 0x0300, 0x036F} /* Mn */, { 0x0483, 0x0486} /* Mn */, + { 0x0488, 0x0489} /* Me */, + { 0x0591, 0x05BD} /* Mn */, { 0x05BF, 0x05BF} /* Mn */, + { 0x05C1, 0x05C2} /* Mn */, { 0x05C4, 0x05C5} /* Mn */, + { 0x05C7, 0x05C7} /* Mn */, { 0x0610, 0x0615} /* Mn */, + { 0x064B, 0x065E} /* Mn */, { 0x0670, 0x0670} /* Mn */, + { 0x06D6, 0x06DC} /* Mn */, + { 0x06DE, 0x06DE} /* Me */, + { 0x06DF, 0x06E4} /* Mn */, { 0x06E7, 0x06E8} /* Mn */, + { 0x06EA, 0x06ED} /* Mn */, { 0x0711, 0x0711} /* Mn */, + { 0x0730, 0x074A} /* Mn */, { 0x07A6, 0x07B0} /* Mn */, + { 0x07EB, 0x07F3} /* Mn */, { 0x0901, 0x0902} /* Mn */, + { 0x093C, 0x093C} /* Mn */, { 0x0941, 0x0948} /* Mn */, + { 0x094D, 0x094D} /* Mn */, { 0x0951, 0x0954} /* Mn */, + { 0x0962, 0x0963} /* Mn */, { 0x0981, 0x0981} /* Mn */, + { 0x09BC, 0x09BC} /* Mn */, { 0x09C1, 0x09C4} /* Mn */, + { 0x09CD, 0x09CD} /* Mn */, { 0x09E2, 0x09E3} /* Mn */, + { 0x0A01, 0x0A02} /* Mn */, { 0x0A3C, 0x0A3C} /* Mn */, + { 0x0A41, 0x0A42} /* Mn */, { 0x0A47, 0x0A48} /* Mn */, + { 0x0A4B, 0x0A4D} /* Mn */, { 0x0A70, 0x0A71} /* Mn */, + { 0x0A81, 0x0A82} /* Mn */, { 0x0ABC, 0x0ABC} /* Mn */, + { 0x0AC1, 0x0AC5} /* Mn */, { 0x0AC7, 0x0AC8} /* Mn */, + { 0x0ACD, 0x0ACD} /* Mn */, { 0x0AE2, 0x0AE3} /* Mn */, + { 0x0B01, 0x0B01} /* Mn */, { 0x0B3C, 0x0B3C} /* Mn */, + { 0x0B3F, 0x0B3F} /* Mn */, { 0x0B41, 0x0B43} /* Mn */, + { 0x0B4D, 0x0B4D} /* Mn */, { 0x0B56, 0x0B56} /* Mn */, + { 0x0B82, 0x0B82} /* Mn */, { 0x0BC0, 0x0BC0} /* Mn */, + { 0x0BCD, 0x0BCD} /* Mn */, { 0x0C3E, 0x0C40} /* Mn */, + { 0x0C46, 0x0C48} /* Mn */, { 0x0C4A, 0x0C4D} /* Mn */, + { 0x0C55, 0x0C56} /* Mn */, { 0x0CBC, 0x0CBC} /* Mn */, + { 0x0CBF, 0x0CBF} /* Mn */, { 0x0CC6, 0x0CC6} /* Mn */, + { 0x0CCC, 0x0CCD} /* Mn */, { 0x0CE2, 0x0CE3} /* Mn */, + { 0x0D41, 0x0D43} /* Mn */, { 0x0D4D, 0x0D4D} /* Mn */, + { 0x0DCA, 0x0DCA} /* Mn */, { 0x0DD2, 0x0DD4} /* Mn */, + { 0x0DD6, 0x0DD6} /* Mn */, { 0x0E31, 0x0E31} /* Mn */, + { 0x0E34, 0x0E3A} /* Mn */, { 0x0E47, 0x0E4E} /* Mn */, + { 0x0EB1, 0x0EB1} /* Mn */, { 0x0EB4, 0x0EB9} /* Mn */, + { 0x0EBB, 0x0EBC} /* Mn */, { 0x0EC8, 0x0ECD} /* Mn */, + { 0x0F18, 0x0F19} /* Mn */, { 0x0F35, 0x0F35} /* Mn */, + { 0x0F37, 0x0F37} /* Mn */, { 0x0F39, 0x0F39} /* Mn */, + { 0x0F71, 0x0F7E} /* Mn */, { 0x0F80, 0x0F84} /* Mn */, + { 0x0F86, 0x0F87} /* Mn */, { 0x0F90, 0x0F97} /* Mn */, + { 0x0F99, 0x0FBC} /* Mn */, { 0x0FC6, 0x0FC6} /* Mn */, + { 0x102D, 0x1030} /* Mn */, { 0x1032, 0x1032} /* Mn */, + { 0x1036, 0x1037} /* Mn */, { 0x1039, 0x1039} /* Mn */, + { 0x1058, 0x1059} /* Mn */, { 0x135F, 0x135F} /* Mn */, + { 0x1712, 0x1714} /* Mn */, { 0x1732, 0x1734} /* Mn */, + { 0x1752, 0x1753} /* Mn */, { 0x1772, 0x1773} /* Mn */, + { 0x17B7, 0x17BD} /* Mn */, { 0x17C6, 0x17C6} /* Mn */, + { 0x17C9, 0x17D3} /* Mn */, { 0x17DD, 0x17DD} /* Mn */, + { 0x180B, 0x180D} /* Mn */, { 0x18A9, 0x18A9} /* Mn */, + { 0x1920, 0x1922} /* Mn */, { 0x1927, 0x1928} /* Mn */, + { 0x1932, 0x1932} /* Mn */, { 0x1939, 0x193B} /* Mn */, + { 0x1A17, 0x1A18} /* Mn */, { 0x1B00, 0x1B03} /* Mn */, + { 0x1B34, 0x1B34} /* Mn */, { 0x1B36, 0x1B3A} /* Mn */, + { 0x1B3C, 0x1B3C} /* Mn */, { 0x1B42, 0x1B42} /* Mn */, + { 0x1B6B, 0x1B73} /* Mn */, { 0x1DC0, 0x1DCA} /* Mn */, + { 0x1DFE, 0x1DFF} /* Mn */, { 0x20D0, 0x20DC} /* Mn */, + { 0x20DD, 0x20E0} /* Me */, + { 0x20E1, 0x20E1} /* Mn */, + { 0x20E2, 0x20E4} /* Me */, + { 0x20E5, 0x20EF} /* Mn */, { 0x302A, 0x302F} /* Mn */, + { 0x3099, 0x309A} /* Mn */, { 0xA806, 0xA806} /* Mn */, + { 0xA80B, 0xA80B} /* Mn */, { 0xA825, 0xA826} /* Mn */, + { 0xFB1E, 0xFB1E} /* Mn */, { 0xFE00, 0xFE0F} /* Mn */, + { 0xFE20, 0xFE23} /* Mn */, { 0x10A01, 0x10A03} /* Mn */, + { 0x10A05, 0x10A06} /* Mn */, { 0x10A0C, 0x10A0F} /* Mn */, + { 0x10A38, 0x10A3A} /* Mn */, { 0x10A3F, 0x10A3F} /* Mn */, + { 0x1D167, 0x1D169} /* Mn */, { 0x1D17B, 0x1D182} /* Mn */, + { 0x1D185, 0x1D18B} /* Mn */, { 0x1D1AA, 0x1D1AD} /* Mn */, + { 0x1D242, 0x1D244} /* Mn */, { 0xE0100, 0xE01EF} /* Mn */, +}; + +/* + * Special pairs, not ranges. + */ +static struct wchar_range comb_table[] = { + {0x0644,0x0622}, {0x0644,0x0623}, {0x0644,0x0625}, {0x0644,0x0627}, +}; + +/* + * Characters with general category values + * Cc: Other, Control + * Cf: Other, Format + * Cs: Other, Surrogate + * Co: Other, Private Use + * Cn: Other, Not Assigned + * Zl: Separator, Line + * Zp: Separator, Paragraph + * Last synched with + * + * dated 2005-11-30T00:58:48Z + */ +static struct wchar_range ubin_table[] = { + { 0x0000, 0x001F} /* Cc */, { 0x007F, 0x009F} /* Cc */, +#if 0 + { 0x00AD, 0x00AD} /* Cf */, +#endif + { 0x0370, 0x0373} /* Cn */, { 0x0376, 0x0379} /* Cn */, + { 0x037F, 0x0383} /* Cn */, { 0x038B, 0x038B} /* Cn */, + { 0x038D, 0x038D} /* Cn */, { 0x03A2, 0x03A2} /* Cn */, + { 0x03CF, 0x03CF} /* Cn */, { 0x0487, 0x0487} /* Cn */, + { 0x0514, 0x0530} /* Cn */, { 0x0557, 0x0558} /* Cn */, + { 0x0560, 0x0560} /* Cn */, { 0x0588, 0x0588} /* Cn */, + { 0x058B, 0x0590} /* Cn */, { 0x05C8, 0x05CF} /* Cn */, + { 0x05EB, 0x05EF} /* Cn */, { 0x05F5, 0x05FF} /* Cn */, +#if 0 + { 0x0600, 0x0603} /* Cf */, +#endif + { 0x0604, 0x060A} /* Cn */, { 0x0616, 0x061A} /* Cn */, + { 0x061C, 0x061D} /* Cn */, { 0x0620, 0x0620} /* Cn */, + { 0x063B, 0x063F} /* Cn */, { 0x065F, 0x065F} /* Cn */, +#if 0 + { 0x06DD, 0x06DD} /* Cf */, +#endif + { 0x070E, 0x070E} /* Cn */, +#if 0 + { 0x070F, 0x070F} /* Cf */, +#endif + { 0x074B, 0x074C} /* Cn */, { 0x076E, 0x077F} /* Cn */, + { 0x07B2, 0x07BF} /* Cn */, { 0x07FB, 0x0900} /* Cn */, + { 0x093A, 0x093B} /* Cn */, { 0x094E, 0x094F} /* Cn */, + { 0x0955, 0x0957} /* Cn */, { 0x0971, 0x097A} /* Cn */, + { 0x0980, 0x0980} /* Cn */, { 0x0984, 0x0984} /* Cn */, + { 0x098D, 0x098E} /* Cn */, { 0x0991, 0x0992} /* Cn */, + { 0x09A9, 0x09A9} /* Cn */, { 0x09B1, 0x09B1} /* Cn */, + { 0x09B3, 0x09B5} /* Cn */, { 0x09BA, 0x09BB} /* Cn */, + { 0x09C5, 0x09C6} /* Cn */, { 0x09C9, 0x09CA} /* Cn */, + { 0x09CF, 0x09D6} /* Cn */, { 0x09D8, 0x09DB} /* Cn */, + { 0x09DE, 0x09DE} /* Cn */, { 0x09E4, 0x09E5} /* Cn */, + { 0x09FB, 0x0A00} /* Cn */, { 0x0A04, 0x0A04} /* Cn */, + { 0x0A0B, 0x0A0E} /* Cn */, { 0x0A11, 0x0A12} /* Cn */, + { 0x0A29, 0x0A29} /* Cn */, { 0x0A31, 0x0A31} /* Cn */, + { 0x0A34, 0x0A34} /* Cn */, { 0x0A37, 0x0A37} /* Cn */, + { 0x0A3A, 0x0A3B} /* Cn */, { 0x0A3D, 0x0A3D} /* Cn */, + { 0x0A43, 0x0A46} /* Cn */, { 0x0A49, 0x0A4A} /* Cn */, + { 0x0A4E, 0x0A58} /* Cn */, { 0x0A5D, 0x0A5D} /* Cn */, + { 0x0A5F, 0x0A65} /* Cn */, { 0x0A75, 0x0A80} /* Cn */, + { 0x0A84, 0x0A84} /* Cn */, { 0x0A8E, 0x0A8E} /* Cn */, + { 0x0A92, 0x0A92} /* Cn */, { 0x0AA9, 0x0AA9} /* Cn */, + { 0x0AB1, 0x0AB1} /* Cn */, { 0x0AB4, 0x0AB4} /* Cn */, + { 0x0ABA, 0x0ABB} /* Cn */, { 0x0AC6, 0x0AC6} /* Cn */, + { 0x0ACA, 0x0ACA} /* Cn */, { 0x0ACE, 0x0ACF} /* Cn */, + { 0x0AD1, 0x0ADF} /* Cn */, { 0x0AE4, 0x0AE5} /* Cn */, + { 0x0AF0, 0x0AF0} /* Cn */, { 0x0AF2, 0x0B00} /* Cn */, + { 0x0B04, 0x0B04} /* Cn */, { 0x0B0D, 0x0B0E} /* Cn */, + { 0x0B11, 0x0B12} /* Cn */, { 0x0B29, 0x0B29} /* Cn */, + { 0x0B31, 0x0B31} /* Cn */, { 0x0B34, 0x0B34} /* Cn */, + { 0x0B3A, 0x0B3B} /* Cn */, { 0x0B44, 0x0B46} /* Cn */, + { 0x0B49, 0x0B4A} /* Cn */, { 0x0B4E, 0x0B55} /* Cn */, + { 0x0B58, 0x0B5B} /* Cn */, { 0x0B5E, 0x0B5E} /* Cn */, + { 0x0B62, 0x0B65} /* Cn */, { 0x0B72, 0x0B81} /* Cn */, + { 0x0B84, 0x0B84} /* Cn */, { 0x0B8B, 0x0B8D} /* Cn */, + { 0x0B91, 0x0B91} /* Cn */, { 0x0B96, 0x0B98} /* Cn */, + { 0x0B9B, 0x0B9B} /* Cn */, { 0x0B9D, 0x0B9D} /* Cn */, + { 0x0BA0, 0x0BA2} /* Cn */, { 0x0BA5, 0x0BA7} /* Cn */, + { 0x0BAB, 0x0BAD} /* Cn */, { 0x0BBA, 0x0BBD} /* Cn */, + { 0x0BC3, 0x0BC5} /* Cn */, { 0x0BC9, 0x0BC9} /* Cn */, + { 0x0BCE, 0x0BD6} /* Cn */, { 0x0BD8, 0x0BE5} /* Cn */, + { 0x0BFB, 0x0C00} /* Cn */, { 0x0C04, 0x0C04} /* Cn */, + { 0x0C0D, 0x0C0D} /* Cn */, { 0x0C11, 0x0C11} /* Cn */, + { 0x0C29, 0x0C29} /* Cn */, { 0x0C34, 0x0C34} /* Cn */, + { 0x0C3A, 0x0C3D} /* Cn */, { 0x0C45, 0x0C45} /* Cn */, + { 0x0C49, 0x0C49} /* Cn */, { 0x0C4E, 0x0C54} /* Cn */, + { 0x0C57, 0x0C5F} /* Cn */, { 0x0C62, 0x0C65} /* Cn */, + { 0x0C70, 0x0C81} /* Cn */, { 0x0C84, 0x0C84} /* Cn */, + { 0x0C8D, 0x0C8D} /* Cn */, { 0x0C91, 0x0C91} /* Cn */, + { 0x0CA9, 0x0CA9} /* Cn */, { 0x0CB4, 0x0CB4} /* Cn */, + { 0x0CBA, 0x0CBB} /* Cn */, { 0x0CC5, 0x0CC5} /* Cn */, + { 0x0CC9, 0x0CC9} /* Cn */, { 0x0CCE, 0x0CD4} /* Cn */, + { 0x0CD7, 0x0CDD} /* Cn */, { 0x0CDF, 0x0CDF} /* Cn */, + { 0x0CE4, 0x0CE5} /* Cn */, { 0x0CF0, 0x0CF0} /* Cn */, + { 0x0CF3, 0x0D01} /* Cn */, { 0x0D04, 0x0D04} /* Cn */, + { 0x0D0D, 0x0D0D} /* Cn */, { 0x0D11, 0x0D11} /* Cn */, + { 0x0D29, 0x0D29} /* Cn */, { 0x0D3A, 0x0D3D} /* Cn */, + { 0x0D44, 0x0D45} /* Cn */, { 0x0D49, 0x0D49} /* Cn */, + { 0x0D4E, 0x0D56} /* Cn */, { 0x0D58, 0x0D5F} /* Cn */, + { 0x0D62, 0x0D65} /* Cn */, { 0x0D70, 0x0D81} /* Cn */, + { 0x0D84, 0x0D84} /* Cn */, { 0x0D97, 0x0D99} /* Cn */, + { 0x0DB2, 0x0DB2} /* Cn */, { 0x0DBC, 0x0DBC} /* Cn */, + { 0x0DBE, 0x0DBF} /* Cn */, { 0x0DC7, 0x0DC9} /* Cn */, + { 0x0DCB, 0x0DCE} /* Cn */, { 0x0DD5, 0x0DD5} /* Cn */, + { 0x0DD7, 0x0DD7} /* Cn */, { 0x0DE0, 0x0DF1} /* Cn */, + { 0x0DF5, 0x0E00} /* Cn */, { 0x0E3B, 0x0E3E} /* Cn */, + { 0x0E5C, 0x0E80} /* Cn */, { 0x0E83, 0x0E83} /* Cn */, + { 0x0E85, 0x0E86} /* Cn */, { 0x0E89, 0x0E89} /* Cn */, + { 0x0E8B, 0x0E8C} /* Cn */, { 0x0E8E, 0x0E93} /* Cn */, + { 0x0E98, 0x0E98} /* Cn */, { 0x0EA0, 0x0EA0} /* Cn */, + { 0x0EA4, 0x0EA4} /* Cn */, { 0x0EA6, 0x0EA6} /* Cn */, + { 0x0EA8, 0x0EA9} /* Cn */, { 0x0EAC, 0x0EAC} /* Cn */, + { 0x0EBA, 0x0EBA} /* Cn */, { 0x0EBE, 0x0EBF} /* Cn */, + { 0x0EC5, 0x0EC5} /* Cn */, { 0x0EC7, 0x0EC7} /* Cn */, + { 0x0ECE, 0x0ECF} /* Cn */, { 0x0EDA, 0x0EDB} /* Cn */, + { 0x0EDE, 0x0EFF} /* Cn */, { 0x0F48, 0x0F48} /* Cn */, + { 0x0F6B, 0x0F70} /* Cn */, { 0x0F8C, 0x0F8F} /* Cn */, + { 0x0F98, 0x0F98} /* Cn */, { 0x0FBD, 0x0FBD} /* Cn */, + { 0x0FCD, 0x0FCE} /* Cn */, { 0x0FD2, 0x0FFF} /* Cn */, + { 0x1022, 0x1022} /* Cn */, { 0x1028, 0x1028} /* Cn */, + { 0x102B, 0x102B} /* Cn */, { 0x1033, 0x1035} /* Cn */, + { 0x103A, 0x103F} /* Cn */, { 0x105A, 0x109F} /* Cn */, + { 0x10C6, 0x10CF} /* Cn */, { 0x10FD, 0x10FF} /* Cn */, + { 0x115A, 0x115E} /* Cn */, { 0x11A3, 0x11A7} /* Cn */, + { 0x11FA, 0x11FF} /* Cn */, { 0x1249, 0x1249} /* Cn */, + { 0x124E, 0x124F} /* Cn */, { 0x1257, 0x1257} /* Cn */, + { 0x1259, 0x1259} /* Cn */, { 0x125E, 0x125F} /* Cn */, + { 0x1289, 0x1289} /* Cn */, { 0x128E, 0x128F} /* Cn */, + { 0x12B1, 0x12B1} /* Cn */, { 0x12B6, 0x12B7} /* Cn */, + { 0x12BF, 0x12BF} /* Cn */, { 0x12C1, 0x12C1} /* Cn */, + { 0x12C6, 0x12C7} /* Cn */, { 0x12D7, 0x12D7} /* Cn */, + { 0x1311, 0x1311} /* Cn */, { 0x1316, 0x1317} /* Cn */, + { 0x135B, 0x135E} /* Cn */, { 0x137D, 0x137F} /* Cn */, + { 0x139A, 0x139F} /* Cn */, { 0x13F5, 0x1400} /* Cn */, + { 0x1677, 0x167F} /* Cn */, { 0x169D, 0x169F} /* Cn */, + { 0x16F1, 0x16FF} /* Cn */, { 0x170D, 0x170D} /* Cn */, + { 0x1715, 0x171F} /* Cn */, { 0x1737, 0x173F} /* Cn */, + { 0x1754, 0x175F} /* Cn */, { 0x176D, 0x176D} /* Cn */, + { 0x1771, 0x1771} /* Cn */, { 0x1774, 0x177F} /* Cn */, +#if 0 + { 0x17B4, 0x17B5} /* Cf */, +#endif + { 0x17DE, 0x17DF} /* Cn */, { 0x17EA, 0x17EF} /* Cn */, + { 0x17FA, 0x17FF} /* Cn */, { 0x180F, 0x180F} /* Cn */, + { 0x181A, 0x181F} /* Cn */, { 0x1878, 0x187F} /* Cn */, + { 0x18AA, 0x18FF} /* Cn */, { 0x191D, 0x191F} /* Cn */, + { 0x192C, 0x192F} /* Cn */, { 0x193C, 0x193F} /* Cn */, + { 0x1941, 0x1943} /* Cn */, { 0x196E, 0x196F} /* Cn */, + { 0x1975, 0x197F} /* Cn */, { 0x19AA, 0x19AF} /* Cn */, + { 0x19CA, 0x19CF} /* Cn */, { 0x19DA, 0x19DD} /* Cn */, + { 0x1A1C, 0x1A1D} /* Cn */, { 0x1A20, 0x1AFF} /* Cn */, + { 0x1B4C, 0x1B4F} /* Cn */, { 0x1B7D, 0x1CFF} /* Cn */, + { 0x1DCB, 0x1DFD} /* Cn */, { 0x1E9C, 0x1E9F} /* Cn */, + { 0x1EFA, 0x1EFF} /* Cn */, { 0x1F16, 0x1F17} /* Cn */, + { 0x1F1E, 0x1F1F} /* Cn */, { 0x1F46, 0x1F47} /* Cn */, + { 0x1F4E, 0x1F4F} /* Cn */, { 0x1F58, 0x1F58} /* Cn */, + { 0x1F5A, 0x1F5A} /* Cn */, { 0x1F5C, 0x1F5C} /* Cn */, + { 0x1F5E, 0x1F5E} /* Cn */, { 0x1F7E, 0x1F7F} /* Cn */, + { 0x1FB5, 0x1FB5} /* Cn */, { 0x1FC5, 0x1FC5} /* Cn */, + { 0x1FD4, 0x1FD5} /* Cn */, { 0x1FDC, 0x1FDC} /* Cn */, + { 0x1FF0, 0x1FF1} /* Cn */, { 0x1FF5, 0x1FF5} /* Cn */, + { 0x1FFF, 0x1FFF} /* Cn */, + { 0x200B, 0x200F} /* Cf */, + { 0x2028, 0x2028} /* Zl */, + { 0x2029, 0x2029} /* Zp */, + { 0x202A, 0x202E} /* Cf */, + { 0x2060, 0x2063} /* Cf */, + { 0x2064, 0x2069} /* Cn */, + { 0x206A, 0x206F} /* Cf */, + { 0x2072, 0x2073} /* Cn */, { 0x208F, 0x208F} /* Cn */, + { 0x2095, 0x209F} /* Cn */, { 0x20B6, 0x20CF} /* Cn */, + { 0x20F0, 0x20FF} /* Cn */, { 0x214F, 0x2152} /* Cn */, + { 0x2185, 0x218F} /* Cn */, { 0x23E8, 0x23FF} /* Cn */, + { 0x2427, 0x243F} /* Cn */, { 0x244B, 0x245F} /* Cn */, + { 0x269D, 0x269F} /* Cn */, { 0x26B3, 0x2700} /* Cn */, + { 0x2705, 0x2705} /* Cn */, { 0x270A, 0x270B} /* Cn */, + { 0x2728, 0x2728} /* Cn */, { 0x274C, 0x274C} /* Cn */, + { 0x274E, 0x274E} /* Cn */, { 0x2753, 0x2755} /* Cn */, + { 0x2757, 0x2757} /* Cn */, { 0x275F, 0x2760} /* Cn */, + { 0x2795, 0x2797} /* Cn */, { 0x27B0, 0x27B0} /* Cn */, + { 0x27BF, 0x27BF} /* Cn */, { 0x27CB, 0x27CF} /* Cn */, + { 0x27EC, 0x27EF} /* Cn */, { 0x2B1B, 0x2B1F} /* Cn */, + { 0x2B24, 0x2BFF} /* Cn */, { 0x2C2F, 0x2C2F} /* Cn */, + { 0x2C5F, 0x2C5F} /* Cn */, { 0x2C6D, 0x2C73} /* Cn */, + { 0x2C78, 0x2C7F} /* Cn */, { 0x2CEB, 0x2CF8} /* Cn */, + { 0x2D26, 0x2D2F} /* Cn */, { 0x2D66, 0x2D6E} /* Cn */, + { 0x2D70, 0x2D7F} /* Cn */, { 0x2D97, 0x2D9F} /* Cn */, + { 0x2DA7, 0x2DA7} /* Cn */, { 0x2DAF, 0x2DAF} /* Cn */, + { 0x2DB7, 0x2DB7} /* Cn */, { 0x2DBF, 0x2DBF} /* Cn */, + { 0x2DC7, 0x2DC7} /* Cn */, { 0x2DCF, 0x2DCF} /* Cn */, + { 0x2DD7, 0x2DD7} /* Cn */, { 0x2DDF, 0x2DFF} /* Cn */, + { 0x2E18, 0x2E1B} /* Cn */, { 0x2E1E, 0x2E7F} /* Cn */, + { 0x2E9A, 0x2E9A} /* Cn */, { 0x2EF4, 0x2EFF} /* Cn */, + { 0x2FD6, 0x2FEF} /* Cn */, { 0x2FFC, 0x2FFF} /* Cn */, + { 0x3040, 0x3040} /* Cn */, { 0x3097, 0x3098} /* Cn */, + { 0x3100, 0x3104} /* Cn */, { 0x312D, 0x3130} /* Cn */, + { 0x318F, 0x318F} /* Cn */, { 0x31B8, 0x31BF} /* Cn */, + { 0x31D0, 0x31EF} /* Cn */, { 0x321F, 0x321F} /* Cn */, + { 0x3244, 0x324F} /* Cn */, { 0x32FF, 0x32FF} /* Cn */, + { 0x4DB6, 0x4DBF} /* Cn */, { 0x9FBC, 0x9FFF} /* Cn */, + { 0xA48D, 0xA48F} /* Cn */, { 0xA4C7, 0xA6FF} /* Cn */, + { 0xA71B, 0xA71F} /* Cn */, { 0xA722, 0xA7FF} /* Cn */, + { 0xA82C, 0xA83F} /* Cn */, { 0xA878, 0xABFF} /* Cn */, + { 0xD7A4, 0xD7FF} /* Cn */, + { 0xD800, 0xDFFF} /* Cs */, + { 0xE000, 0xF8FF} /* Co */, + { 0xFA2E, 0xFA2F} /* Cn */, { 0xFA6B, 0xFA6F} /* Cn */, + { 0xFADA, 0xFAFF} /* Cn */, { 0xFB07, 0xFB12} /* Cn */, + { 0xFB18, 0xFB1C} /* Cn */, { 0xFB37, 0xFB37} /* Cn */, + { 0xFB3D, 0xFB3D} /* Cn */, { 0xFB3F, 0xFB3F} /* Cn */, + { 0xFB42, 0xFB42} /* Cn */, { 0xFB45, 0xFB45} /* Cn */, + { 0xFBB2, 0xFBD2} /* Cn */, { 0xFD40, 0xFD4F} /* Cn */, + { 0xFD90, 0xFD91} /* Cn */, { 0xFDC8, 0xFDEF} /* Cn */, + { 0xFDFE, 0xFDFF} /* Cn */, { 0xFE1A, 0xFE1F} /* Cn */, + { 0xFE24, 0xFE2F} /* Cn */, { 0xFE53, 0xFE53} /* Cn */, + { 0xFE67, 0xFE67} /* Cn */, { 0xFE6C, 0xFE6F} /* Cn */, + { 0xFE75, 0xFE75} /* Cn */, { 0xFEFD, 0xFEFE} /* Cn */, + { 0xFEFF, 0xFEFF} /* Cf */, + { 0xFF00, 0xFF00} /* Cn */, { 0xFFBF, 0xFFC1} /* Cn */, + { 0xFFC8, 0xFFC9} /* Cn */, { 0xFFD0, 0xFFD1} /* Cn */, + { 0xFFD8, 0xFFD9} /* Cn */, { 0xFFDD, 0xFFDF} /* Cn */, + { 0xFFE7, 0xFFE7} /* Cn */, { 0xFFEF, 0xFFF8} /* Cn */, + { 0xFFF9, 0xFFFB} /* Cf */, + { 0xFFFE, 0xFFFF} /* Cn */, { 0x1000C, 0x1000C} /* Cn */, + { 0x10027, 0x10027} /* Cn */, { 0x1003B, 0x1003B} /* Cn */, + { 0x1003E, 0x1003E} /* Cn */, { 0x1004E, 0x1004F} /* Cn */, + { 0x1005E, 0x1007F} /* Cn */, { 0x100FB, 0x100FF} /* Cn */, + { 0x10103, 0x10106} /* Cn */, { 0x10134, 0x10136} /* Cn */, + { 0x1018B, 0x102FF} /* Cn */, { 0x1031F, 0x1031F} /* Cn */, + { 0x10324, 0x1032F} /* Cn */, { 0x1034B, 0x1037F} /* Cn */, + { 0x1039E, 0x1039E} /* Cn */, { 0x103C4, 0x103C7} /* Cn */, + { 0x103D6, 0x103FF} /* Cn */, + { 0x1049E, 0x1049F} /* Cn */, { 0x104AA, 0x107FF} /* Cn */, + { 0x10806, 0x10807} /* Cn */, { 0x10809, 0x10809} /* Cn */, + { 0x10836, 0x10836} /* Cn */, { 0x10839, 0x1083B} /* Cn */, + { 0x1083D, 0x1083E} /* Cn */, { 0x10840, 0x108FF} /* Cn */, + { 0x1091A, 0x1091E} /* Cn */, { 0x10920, 0x109FF} /* Cn */, + { 0x10A04, 0x10A04} /* Cn */, { 0x10A07, 0x10A0B} /* Cn */, + { 0x10A14, 0x10A14} /* Cn */, { 0x10A18, 0x10A18} /* Cn */, + { 0x10A34, 0x10A37} /* Cn */, { 0x10A3B, 0x10A3E} /* Cn */, + { 0x10A48, 0x10A4F} /* Cn */, { 0x10A59, 0x11FFF} /* Cn */, + { 0x1236F, 0x123FF} /* Cn */, { 0x12463, 0x1246F} /* Cn */, + { 0x12474, 0x1CFFF} /* Cn */, { 0x1D0F6, 0x1D0FF} /* Cn */, + { 0x1D127, 0x1D129} /* Cn */, + { 0x1D173, 0x1D17A} /* Cf */, + { 0x1D1DE, 0x1D1FF} /* Cn */, { 0x1D246, 0x1D2FF} /* Cn */, + { 0x1D357, 0x1D35F} /* Cn */, { 0x1D372, 0x1D3FF} /* Cn */, + { 0x1D455, 0x1D455} /* Cn */, { 0x1D49D, 0x1D49D} /* Cn */, + { 0x1D4A0, 0x1D4A1} /* Cn */, { 0x1D4A3, 0x1D4A4} /* Cn */, + { 0x1D4A7, 0x1D4A8} /* Cn */, { 0x1D4AD, 0x1D4AD} /* Cn */, + { 0x1D4BA, 0x1D4BA} /* Cn */, { 0x1D4BC, 0x1D4BC} /* Cn */, + { 0x1D4C4, 0x1D4C4} /* Cn */, { 0x1D506, 0x1D506} /* Cn */, + { 0x1D50B, 0x1D50C} /* Cn */, { 0x1D515, 0x1D515} /* Cn */, + { 0x1D51D, 0x1D51D} /* Cn */, { 0x1D53A, 0x1D53A} /* Cn */, + { 0x1D53F, 0x1D53F} /* Cn */, { 0x1D545, 0x1D545} /* Cn */, + { 0x1D547, 0x1D549} /* Cn */, { 0x1D551, 0x1D551} /* Cn */, + { 0x1D6A6, 0x1D6A7} /* Cn */, { 0x1D7CC, 0x1D7CD} /* Cn */, + { 0x1D800, 0x1FFFF} /* Cn */, { 0x2A6D7, 0x2F7FF} /* Cn */, + { 0x2FA1E, 0xE0000} /* Cn */, + { 0xE0001, 0xE0001} /* Cf */, + { 0xE0002, 0xE001F} /* Cn */, + { 0xE0020, 0xE007F} /* Cf */, + { 0xE0080, 0xE00FF} /* Cn */, { 0xE01F0, 0xEFFFF} /* Cn */, + { 0xF0000, 0xFFFFD} /* Co */, + { 0xFFFFE, 0xFFFFF} /* Cn */, + {0x100000,0x10FFFD} /* Co */, + {0x10FFFE,0x10FFFF} /* Cn */, + {0x110000,0x7FFFFFFF} /* ISO 10646?? */ +}; + +/* + * Double width characters + * W: East Asian Wide + * F: East Asian Full-width + * Unassigned code points may be included when they allow ranges to be merged. + * Last synched with + * + * dated 2005-11-08T01:32:56Z + */ +static struct wchar_range wide_table[] = { + { 0x1100, 0x115F} /* W */, { 0x2329, 0x232A} /* W */, + { 0x2E80, 0x2FFB} /* W */, + { 0x3000, 0x3000} /* F */, + { 0x3001, 0x303E} /* W */, { 0x3041, 0x4DB5} /* W */, + { 0x4E00, 0x9FBB} /* W */, { 0xA000, 0xA4C6} /* W */, + { 0xAC00, 0xD7A3} /* W */, { 0xF900, 0xFAD9} /* W */, + { 0xFE10, 0xFE19} /* W */, { 0xFE30, 0xFE6B} /* W */, + { 0xFF01, 0xFF60} /* F */, { 0xFFE0, 0xFFE6} /* F */, + { 0x20000, 0x2FFFD} /* W */, { 0x30000, 0x3FFFD} /* W */, +}; + + static int +is_in_table(ch, table, tsize) + LWCHAR ch; + struct wchar_range table[]; + int tsize; +{ + int hi; + int lo; + + /* Binary search in the table. */ + if (ch < table[0].first) + return 0; + lo = 0; + hi = tsize - 1; + while (lo <= hi) + { + int mid = (lo + hi) / 2; + if (ch > table[mid].last) + lo = mid + 1; + else if (ch < table[mid].first) + hi = mid - 1; + else + return 1; + } + return 0; +} + +/* + * Is a character a UTF-8 composing character? + * If a composing character follows any char, the two combine into one glyph. + */ + public int +is_composing_char(ch) + LWCHAR ch; +{ + return is_in_table(ch, comp_table, (sizeof(comp_table) / sizeof(*comp_table))); +} + +/* + * Should this UTF-8 character be treated as binary? + */ + public int +is_ubin_char(ch) + LWCHAR ch; +{ + return is_in_table(ch, ubin_table, (sizeof(ubin_table) / sizeof(*ubin_table))); +} + +/* + * Is this a double width UTF-8 character? + */ + public int +is_wide_char(ch) + LWCHAR ch; +{ + return is_in_table(ch, wide_table, (sizeof(wide_table) / sizeof(*wide_table))); +} + +/* + * Is a character a UTF-8 combining character? + * A combining char acts like an ordinary char, but if it follows + * a specific char (not any char), the two combine into one glyph. + */ + public int +is_combining_char(ch1, ch2) + LWCHAR ch1; + LWCHAR ch2; +{ + /* The table is small; use linear search. */ + int i; + for (i = 0; i < sizeof(comb_table)/sizeof(*comb_table); i++) + { + if (ch1 == comb_table[i].first && + ch2 == comb_table[i].last) + return 1; + } + return 0; +} + diff --git a/src/bin/less/charset.h b/src/bin/less/charset.h new file mode 100644 index 0000000000..548033e1dc --- /dev/null +++ b/src/bin/less/charset.h @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2005-2007 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 IS_ASCII_OCTET(c) (((c) & 0x80) == 0) +#define IS_UTF8_TRAIL(c) (((c) & 0xC0) == 0x80) +#define IS_UTF8_LEAD2(c) (((c) & 0xE0) == 0xC0) +#define IS_UTF8_LEAD3(c) (((c) & 0xF0) == 0xE0) +#define IS_UTF8_LEAD4(c) (((c) & 0xF8) == 0xF0) +#define IS_UTF8_LEAD5(c) (((c) & 0xFC) == 0xF8) +#define IS_UTF8_LEAD6(c) (((c) & 0xFE) == 0xFC) +#define IS_UTF8_INVALID(c) (((c) & 0xFE) == 0xFE) +#define IS_UTF8_LEAD(c) (((c) & 0xC0) == 0xC0 && !IS_UTF8_INVALID(c)) diff --git a/src/bin/less/cmd.h b/src/bin/less/cmd.h index 8f300dbe02..298d3672cd 100644 --- a/src/bin/less/cmd.h +++ b/src/bin/less/cmd.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. diff --git a/src/bin/less/cmdbuf.c b/src/bin/less/cmdbuf.c index dbf5f2afcc..ad79ce9b90 100644 --- a/src/bin/less/cmdbuf.c +++ b/src/bin/less/cmdbuf.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -16,8 +16,13 @@ #include "less.h" #include "cmd.h" +#include "charset.h" +#if HAVE_STAT +#include +#endif extern int sc_width; +extern int utf_mode; static char cmdbuf[CMDBUF_SIZE]; /* Buffer for holding a multi-char command */ static int cmd_col; /* Current column of the cursor */ @@ -48,6 +53,12 @@ public char closequote = '"'; #endif #if CMD_HISTORY + +/* History file */ +#define HISTFILE_FIRST_LINE ".less-history-file:" +#define HISTFILE_SEARCH_SECTION ".search" +#define HISTFILE_SHELL_SECTION ".shell" + /* * A mlist structure represents a command history. */ @@ -57,22 +68,23 @@ struct mlist struct mlist *prev; struct mlist *curr_mp; char *string; + int modified; }; /* * These are the various command histories that exist. */ struct mlist mlist_search = - { &mlist_search, &mlist_search, &mlist_search, NULL }; + { &mlist_search, &mlist_search, &mlist_search, NULL, 0 }; public void * constant ml_search = (void *) &mlist_search; struct mlist mlist_examine = - { &mlist_examine, &mlist_examine, &mlist_examine, NULL }; + { &mlist_examine, &mlist_examine, &mlist_examine, NULL, 0 }; public void * constant ml_examine = (void *) &mlist_examine; #if SHELL_ESCAPE || PIPEC struct mlist mlist_shell = - { &mlist_shell, &mlist_shell, &mlist_shell, NULL }; + { &mlist_shell, &mlist_shell, &mlist_shell, NULL, 0 }; public void * constant ml_shell = (void *) &mlist_shell; #endif @@ -93,6 +105,10 @@ public void * constant ml_shell = (void *)3; static struct mlist *curr_mlist = NULL; static int curr_cmdflags; +static char cmd_mbc_buf[MAX_UTF_CHAR_LEN]; +static int cmd_mbc_buf_len; +static int cmd_mbc_buf_index; + /* * Reset command buffer (to empty). @@ -105,16 +121,17 @@ cmd_reset() cmd_col = 0; cmd_offset = 0; literal = 0; + cmd_mbc_buf_len = 0; } /* - * Clear command line on display. + * Clear command line. */ public void clear_cmd() { - clear_bot(); cmd_col = prompt_col = 0; + cmd_mbc_buf_len = 0; } /* @@ -124,9 +141,28 @@ clear_cmd() cmd_putstr(s) char *s; { - putstr(s); - cmd_col += strlen(s); - prompt_col += strlen(s); + LWCHAR prev_ch = 0; + LWCHAR ch; + char *endline = s + strlen(s); + while (*s != '\0') + { + char *ns = s; + ch = step_char(&ns, +1, endline); + while (s < ns) + putchr(*s++); + if (!utf_mode) + { + cmd_col++; + prompt_col++; + } else if (!is_composing_char(ch) && + !is_combining_char(prev_ch, ch)) + { + int width = is_wide_char(ch) ? 2 : 1; + cmd_col += width; + prompt_col += width; + } + prev_ch = ch; + } } /* @@ -135,7 +171,113 @@ cmd_putstr(s) public int len_cmdbuf() { - return (strlen(cmdbuf)); + char *s = cmdbuf; + char *endline = s + strlen(s); + int len = 0; + + while (*s != '\0') + { + step_char(&s, +1, endline); + len++; + } + return (len); +} + +/* + * Common part of cmd_step_right() and cmd_step_left(). + */ + static char * +cmd_step_common(p, ch, len, pwidth, bswidth) + char *p; + LWCHAR ch; + int len; + int *pwidth; + int *bswidth; +{ + char *pr; + + if (len == 1) + { + pr = prchar((int) ch); + if (pwidth != NULL || bswidth != NULL) + { + int len = strlen(pr); + if (pwidth != NULL) + *pwidth = len; + if (bswidth != NULL) + *bswidth = len; + } + } else + { + pr = prutfchar(ch); + if (pwidth != NULL || bswidth != NULL) + { + if (is_composing_char(ch)) + { + if (pwidth != NULL) + *pwidth = 0; + if (bswidth != NULL) + *bswidth = 0; + } else if (is_ubin_char(ch)) + { + int len = strlen(pr); + if (pwidth != NULL) + *pwidth = len; + if (bswidth != NULL) + *bswidth = len; + } else + { + LWCHAR prev_ch = step_char(&p, -1, cmdbuf); + if (is_combining_char(prev_ch, ch)) + { + if (pwidth != NULL) + *pwidth = 0; + if (bswidth != NULL) + *bswidth = 0; + } else + { + if (pwidth != NULL) + *pwidth = is_wide_char(ch) + ? 2 + : 1; + if (bswidth != NULL) + *bswidth = 1; + } + } + } + } + + return (pr); +} + +/* + * Step a pointer one character right in the command buffer. + */ + static char * +cmd_step_right(pp, pwidth, bswidth) + char **pp; + int *pwidth; + int *bswidth; +{ + char *p = *pp; + LWCHAR ch = step_char(pp, +1, p + strlen(p)); + + return cmd_step_common(p, ch, *pp - p, pwidth, bswidth); +} + +/* + * Step a pointer one character left in the command buffer. + */ + static char * +cmd_step_left(pp, pwidth, bswidth) + char **pp; + int *pwidth; + int *bswidth; +{ + char *p = *pp; + LWCHAR ch = step_char(pp, -1, cmdbuf); + + return cmd_step_common(*pp, ch, p - *pp, pwidth, bswidth); } /* @@ -146,19 +288,30 @@ len_cmdbuf() cmd_repaint(old_cp) char *old_cp; { - char *p; - /* * Repaint the line from the current position. */ clear_eol(); - for ( ; *cp != '\0'; cp++) + while (*cp != '\0') { - p = prchar(*cp); - if (cmd_col + (int)strlen(p) >= sc_width) + char *np = cp; + int width; + char *pr = cmd_step_right(&np, &width, NULL); + if (cmd_col + width >= sc_width) break; - putstr(p); - cmd_col += strlen(p); + cp = np; + putstr(pr); + cmd_col += width; + } + while (*cp != '\0') + { + char *np = cp; + int width; + char *pr = cmd_step_right(&np, &width, NULL); + if (width > 0) + break; + cp = np; + putstr(pr); } /* @@ -177,8 +330,12 @@ cmd_home() { while (cmd_col > prompt_col) { - putbs(); - cmd_col--; + int width, bswidth; + + cmd_step_left(&cp, &width, &bswidth); + while (bswidth-- > 0) + putbs(); + cmd_col -= width; } cp = &cmdbuf[cmd_offset]; @@ -201,7 +358,20 @@ cmd_lshift() s = cmdbuf + cmd_offset; cols = 0; while (cols < (sc_width - prompt_col) / 2 && *s != '\0') - cols += strlen(prchar(*s++)); + { + int width; + cmd_step_right(&s, &width, NULL); + cols += width; + } + while (*s != '\0') + { + int width; + char *ns = s; + cmd_step_right(&ns, &width, NULL); + if (width > 0) + break; + s = ns; + } cmd_offset = s - cmdbuf; save_cp = cp; @@ -216,7 +386,6 @@ cmd_lshift() cmd_rshift() { char *s; - char *p; char *save_cp; int cols; @@ -229,8 +398,9 @@ cmd_rshift() cols = 0; while (cols < (sc_width - prompt_col) / 2 && s > cmdbuf) { - p = prchar(*--s); - cols += strlen(p); + int width; + cmd_step_left(&s, &width, NULL); + cols += width; } cmd_offset = s - cmdbuf; @@ -245,23 +415,32 @@ cmd_rshift() static int cmd_right() { - char *p; + char *pr; + char *ncp; + int width; if (*cp == '\0') { - /* - * Already at the end of the line. - */ + /* Already at the end of the line. */ return (CC_OK); } - p = prchar(*cp); - if (cmd_col + (int)strlen(p) >= sc_width) + ncp = cp; + pr = cmd_step_right(&ncp, &width, NULL); + if (cmd_col + width >= sc_width) cmd_lshift(); - else if (cmd_col + (int)strlen(p) == sc_width - 1 && cp[1] != '\0') + else if (cmd_col + width == sc_width - 1 && cp[1] != '\0') cmd_lshift(); - cp++; - putstr(p); - cmd_col += strlen(p); + cp = ncp; + cmd_col += width; + putstr(pr); + while (*cp != '\0') + { + pr = cmd_step_right(&ncp, &width, NULL); + if (width > 0) + break; + putstr(pr); + cp = ncp; + } return (CC_OK); } @@ -271,19 +450,26 @@ cmd_right() static int cmd_left() { - char *p; + char *ncp; + int width, bswidth; 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)) + ncp = cp; + while (ncp > cmdbuf) + { + cmd_step_left(&ncp, &width, &bswidth); + if (width > 0) + break; + } + if (cmd_col < prompt_col + width) cmd_rshift(); - cp--; - cmd_col -= strlen(p); - while (*p++ != '\0') + cp = ncp; + cmd_col -= width; + while (bswidth-- > 0) putbs(); return (CC_OK); } @@ -292,26 +478,29 @@ cmd_left() * Insert a char into the command buffer, at the current position. */ static int -cmd_ichar(c) - int c; +cmd_ichar(cs, clen) + char *cs; + int clen; { char *s; - if (strlen(cmdbuf) >= sizeof(cmdbuf)-2) + if (strlen(cmdbuf) + clen >= sizeof(cmdbuf)-1) { - /* - * No room in the command buffer for another char. - */ + /* No room in the command buffer for another char. */ bell(); return (CC_ERROR); } /* - * Insert the character into the buffer. + * Make room for the new character (shift the tail of the buffer right). */ for (s = &cmdbuf[strlen(cmdbuf)]; s >= cp; s--) - s[1] = s[0]; - *cp = c; + s[clen] = s[0]; + /* + * Insert the character into the buffer. + */ + for (s = cp; s < cp + clen; s++) + *s = *cs++; /* * Reprint the tail of the line from the inserted char. */ @@ -328,6 +517,7 @@ cmd_ichar(c) cmd_erase() { register char *s; + int clen; if (cp == cmdbuf) { @@ -340,12 +530,20 @@ cmd_erase() /* * Move cursor left (to the char being erased). */ + s = cp; cmd_left(); + clen = s - cp; + /* * Remove the char from the buffer (shift the buffer left). */ - for (s = cp; *s != '\0'; s++) - s[0] = s[1]; + for (s = cp; ; s++) + { + s[0] = s[clen]; + if (s[0] == '\0') + break; + } + /* * Repaint the buffer after the erased char. */ @@ -368,9 +566,7 @@ cmd_delete() { if (*cp == '\0') { - /* - * At end of string; there is no char under the cursor. - */ + /* At end of string; there is no char under the cursor. */ return (CC_OK); } /* @@ -441,9 +637,7 @@ cmd_kill() { if (cmdbuf[0] == '\0') { - /* - * Buffer is already empty; abort the current command. - */ + /* Buffer is already empty; abort the current command. */ return (CC_QUIT); } cmd_offset = 0; @@ -470,6 +664,10 @@ set_mlist(mlist, cmdflags) { curr_mlist = (struct mlist *) mlist; curr_cmdflags = cmdflags; + + /* Make sure the next up-arrow moves to the last string in the mlist. */ + if (curr_mlist != NULL) + curr_mlist->curr_mp = curr_mlist; } #if CMD_HISTORY @@ -505,12 +703,9 @@ cmd_updown(action) s = curr_mlist->curr_mp->string; if (s == NULL) s = ""; - for (cp = cmdbuf; *s != '\0'; s++) - { - *cp = *s; + strcpy(cmdbuf, s); + for (cp = cmdbuf; *cp != '\0'; ) cmd_right(); - } - *cp = '\0'; return (CC_OK); } #endif @@ -531,17 +726,13 @@ cmd_addhist(mlist, cmd) */ 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. + * Save the command unless it's a duplicate of the + * last command in the history. */ - for (ml = mlist->next; ml != mlist; ml = ml->next) - { - if (strcmp(ml->string, cmd) == 0) - break; - } - if (ml == mlist) + ml = mlist->prev; + if (ml == mlist || strcmp(ml->string, cmd) != 0) { /* * Did not find command in history. @@ -576,6 +767,7 @@ cmd_accept() if (curr_mlist == NULL) return; cmd_addhist(curr_mlist, cmdbuf); + curr_mlist->modified = 1; #endif } @@ -705,10 +897,13 @@ cmd_istr(str) { char *s; int action; + char *endline = str + strlen(str); - for (s = str; *s != '\0'; s++) + for (s = str; *s != '\0'; ) { - action = cmd_ichar(*s); + char *os = s; + step_char(&s, +1, endline); + action = cmd_ichar(os, s - os); if (action != CC_OK) { bell(); @@ -995,6 +1190,56 @@ cmd_char(c) int c; { int action; + int len; + + if (!utf_mode) + { + cmd_mbc_buf[0] = c; + len = 1; + } else + { + /* Perform strict validation in all possible cases. */ + if (cmd_mbc_buf_len == 0) + { + retry: + cmd_mbc_buf_index = 1; + *cmd_mbc_buf = c; + if (IS_ASCII_OCTET(c)) + cmd_mbc_buf_len = 1; + else if (IS_UTF8_LEAD(c)) + { + cmd_mbc_buf_len = utf_len(c); + return (CC_OK); + } else + { + /* UTF8_INVALID or stray UTF8_TRAIL */ + bell(); + return (CC_ERROR); + } + } else if (IS_UTF8_TRAIL(c)) + { + cmd_mbc_buf[cmd_mbc_buf_index++] = c; + if (cmd_mbc_buf_index < cmd_mbc_buf_len) + return (CC_OK); + if (!is_utf8_well_formed(cmd_mbc_buf)) + { + /* complete, but not well formed (non-shortest form), sequence */ + cmd_mbc_buf_len = 0; + bell(); + return (CC_ERROR); + } + } else + { + /* Flush incomplete (truncated) sequence. */ + cmd_mbc_buf_len = 0; + bell(); + /* Handle new char. */ + goto retry; + } + + len = cmd_mbc_buf_len; + cmd_mbc_buf_len = 0; + } if (literal) { @@ -1002,13 +1247,13 @@ cmd_char(c) * Insert the char, even if it is a line-editing char. */ literal = 0; - return (cmd_ichar(c)); + return (cmd_ichar(cmd_mbc_buf, len)); } /* - * See if it is a special line-editing character. + * See if it is a line-editing character. */ - if (in_mca()) + if (in_mca() && len == 1) { action = cmd_edit(c); switch (action) @@ -1024,20 +1269,28 @@ cmd_char(c) /* * Insert the char into the command buffer. */ - return (cmd_ichar(c)); + return (cmd_ichar(cmd_mbc_buf, len)); } /* * Return the number currently in the command buffer. */ public LINENUM -cmd_int() +cmd_int(frac) + long *frac; { - register char *p; + char *p; LINENUM n = 0; + int err; - for (p = cmdbuf; *p != '\0'; p++) - n = (10 * n) + (*p - '0'); + for (p = cmdbuf; *p >= '0' && *p <= '9'; p++) + n = (n * 10) + (*p - '0'); + *frac = 0; + if (*p++ == '.') + { + *frac = getfraction(&p, NULL, &err); + /* {{ do something if err is set? }} */ + } return (n); } @@ -1049,3 +1302,183 @@ get_cmdbuf() { return (cmdbuf); } + +/* + * Return the last (most recent) string in the current command history. + */ + public char * +cmd_lastpattern() +{ + if (curr_mlist == NULL) + return (NULL); + return (curr_mlist->curr_mp->prev->string); +} + +#if CMD_HISTORY +/* + * Get the name of the history file. + */ + static char * +histfile_name() +{ + char *home; + char *name; + int len; + + /* See if filename is explicitly specified by $LESSHISTFILE. */ + name = lgetenv("LESSHISTFILE"); + if (name != NULL && *name != '\0') + { + if (strcmp(name, "-") == 0 || strcmp(name, "/dev/null") == 0) + /* $LESSHISTFILE == "-" means don't use a history file. */ + return (NULL); + return (save(name)); + } + + /* Otherwise, file is in $HOME. */ + home = lgetenv("HOME"); + if (home == NULL || *home == '\0') + { +#if OS2 + home = lgetenv("INIT"); + if (home == NULL || *home == '\0') +#endif + return (NULL); + } + len = strlen(home) + strlen(LESSHISTFILE) + 2; + name = (char *) ecalloc(len, sizeof(char)); + SNPRINTF2(name, len, "%s/%s", home, LESSHISTFILE); + return (name); +} +#endif /* CMD_HISTORY */ + +/* + * Initialize history from a .lesshist file. + */ + public void +init_cmdhist() +{ +#if CMD_HISTORY + struct mlist *ml = NULL; + char line[CMDBUF_SIZE]; + char *filename; + FILE *f; + char *p; + + filename = histfile_name(); + if (filename == NULL) + return; + f = fopen(filename, "r"); + free(filename); + if (f == NULL) + return; + if (fgets(line, sizeof(line), f) == NULL || + strncmp(line, HISTFILE_FIRST_LINE, strlen(HISTFILE_FIRST_LINE)) != 0) + { + fclose(f); + return; + } + while (fgets(line, sizeof(line), f) != NULL) + { + for (p = line; *p != '\0'; p++) + { + if (*p == '\n' || *p == '\r') + { + *p = '\0'; + break; + } + } + if (strcmp(line, HISTFILE_SEARCH_SECTION) == 0) + ml = &mlist_search; + else if (strcmp(line, HISTFILE_SHELL_SECTION) == 0) + { +#if SHELL_ESCAPE || PIPEC + ml = &mlist_shell; +#else + ml = NULL; +#endif + } else if (*line == '"') + { + if (ml != NULL) + cmd_addhist(ml, line+1); + } + } + fclose(f); +#endif /* CMD_HISTORY */ +} + +/* + * + */ +#if CMD_HISTORY + static void +save_mlist(ml, f) + struct mlist *ml; + FILE *f; +{ + int histsize = 0; + int n; + char *s; + + s = lgetenv("LESSHISTSIZE"); + if (s != NULL) + histsize = atoi(s); + if (histsize == 0) + histsize = 100; + + ml = ml->prev; + for (n = 0; n < histsize; n++) + { + if (ml->string == NULL) + break; + ml = ml->prev; + } + for (ml = ml->next; ml->string != NULL; ml = ml->next) + fprintf(f, "\"%s\n", ml->string); +} +#endif /* CMD_HISTORY */ + +/* + * + */ + public void +save_cmdhist() +{ +#if CMD_HISTORY + char *filename; + FILE *f; + int modified = 0; + + filename = histfile_name(); + if (filename == NULL) + return; + if (mlist_search.modified) + modified = 1; +#if SHELL_ESCAPE || PIPEC + if (mlist_shell.modified) + modified = 1; +#endif + if (!modified) + return; + f = fopen(filename, "w"); + free(filename); + if (f == NULL) + return; +#if HAVE_FCHMOD + /* Make history file readable only by owner. */ + fchmod(fileno(f), 0600); +#endif + + fprintf(f, "%s\n", HISTFILE_FIRST_LINE); + + fprintf(f, "%s\n", HISTFILE_SEARCH_SECTION); + save_mlist(&mlist_search, f); + +#if SHELL_ESCAPE || PIPEC + fprintf(f, "%s\n", HISTFILE_SHELL_SECTION); + save_mlist(&mlist_shell, f); +#endif + + fclose(f); +#endif /* CMD_HISTORY */ +} diff --git a/src/bin/less/command.c b/src/bin/less/command.c index 9b059eceb8..7012458596 100644 --- a/src/bin/less/command.c +++ b/src/bin/less/command.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -21,9 +21,8 @@ #include "option.h" #include "cmd.h" -extern int erase_char, kill_char; +extern int erase_char, erase2_char, kill_char; extern int sigs; -extern int quit_at_eof; extern int quit_if_one_screen; extern int squished; extern int hit_eof; @@ -54,6 +53,8 @@ extern char *editproto; #endif extern int screen_trashed; /* The screen has been overwritten */ extern int shift_count; +extern int oldbot; +extern int forw_prompt; static char ungot[UNGOT_SIZE]; static char *ungotp = NULL; @@ -63,10 +64,12 @@ static char *shellcmd = NULL; /* For holding last shell command for "!!" */ 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 long fraction; /* The fractional part of the number */ static char optchar; static int optflag; static int optgetname; static POSITION bottompos; +static int save_hshift; #if PIPEC static char pipec; #endif @@ -74,7 +77,7 @@ static char pipec; static void multi_search(); /* - * Move the cursor to lower left before executing a command. + * Move the cursor to start of prompt line before executing a command. * This looks nicer if the command takes a long time before * updating the screen. */ @@ -82,7 +85,7 @@ static void multi_search(); cmd_exec() { clear_attn(); - lower_left(); + clear_bot(); flush(); } @@ -97,6 +100,7 @@ start_mca(action, prompt, mlist, cmdflags) int cmdflags; { mca = action; + clear_bot(); clear_cmd(); cmd_putstr(prompt); set_mlist(mlist, cmdflags); @@ -119,6 +123,7 @@ mca_search() else mca = A_B_SEARCH; + clear_bot(); clear_cmd(); if (search_type & SRCH_NO_MATCH) @@ -154,6 +159,7 @@ mca_opt_toggle() dash = (flag == OPT_NO_TOGGLE) ? "_" : "-"; mca = A_OPT_TOGGLE; + clear_bot(); clear_cmd(); cmd_putstr(dash); if (optgetname) @@ -290,14 +296,14 @@ mca_char(c) * Entering digits of a number. * Terminated by a non-digit. */ - if ((c < '0' || c > '9') && + if (!((c >= '0' && c <= '9') || c == '.') && 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(); + number = cmd_int(&fraction); mca = 0; cmd_accept(); return (NO_MCA); @@ -392,7 +398,9 @@ mca_char(c) * Already have a match for the name. * Don't accept anything but erase/kill. */ - if (c == erase_char || c == kill_char) + if (c == erase_char || + c == erase2_char || + c == kill_char) return (MCA_DONE); return (MCA_MORE); } @@ -403,7 +411,7 @@ mca_char(c) if (cmd_char(c) == CC_QUIT) return (MCA_DONE); p = get_cmdbuf(); - lc = islower(p[0]); + lc = ASCII_IS_LOWER(p[0]); o = findopt_name(&p, &oname, NULL); if (o != NULL) { @@ -413,15 +421,15 @@ mca_char(c) * display the full option name. */ optchar = o->oletter; - if (!lc && islower(optchar)) - optchar = toupper(optchar); + if (!lc && ASCII_IS_LOWER(optchar)) + optchar = ASCII_TO_UPPER(optchar); cmd_reset(); mca_opt_toggle(); for (p = oname; *p != '\0'; p++) { c = *p; - if (!lc && islower(c)) - c = toupper(c); + if (!lc && ASCII_IS_LOWER(c)) + c = ASCII_TO_UPPER(c); if (cmd_char(c) != CC_OK) return (MCA_DONE); } @@ -430,7 +438,7 @@ mca_char(c) } } else { - if (c == erase_char || c == kill_char) + if (c == erase_char || c == erase2_char || c == kill_char) break; if (optchar != '\0') /* We already have the option letter. */ @@ -543,6 +551,21 @@ mca_char(c) return (MCA_MORE); } +/* + * Discard any buffered file data. + */ + static void +clear_buffers() +{ + if (!(ch_getflags() & CH_CANSEEK)) + return; + ch_flush(); + clr_linenum(); +#if HILITE_SEARCH + clr_hilite(); +#endif +} + /* * Make sure the screen is displayed. */ @@ -566,11 +589,20 @@ make_display() jump_loc(initial_scrpos.pos, initial_scrpos.ln); } else if (screen_trashed) { - int save_top_scroll; - save_top_scroll = top_scroll; + int save_top_scroll = top_scroll; + int save_ignore_eoi = ignore_eoi; top_scroll = 1; + ignore_eoi = 0; + if (screen_trashed == 2) + { + /* Special case used by ignore_eoi: re-open the input file + * and jump to the end of the file. */ + reopen_curr_ifile(); + jump_forw(); + } repaint(); top_scroll = save_top_scroll; + ignore_eoi = save_ignore_eoi; } } @@ -598,9 +630,12 @@ prompt() bottompos = position(BOTTOM_PLUS_ONE); /* - * If the -E flag is set and we've hit EOF on the last file, quit. + * If we've hit EOF on the last file, and the -E flag is set + * (or -F is set and this is the first prompt), then quit. + * {{ Relying on "first prompt" to detect a single-screen file + * fails if +G is used, for example. }} */ - if ((quit_at_eof == OPT_ONPLUS || quit_if_one_screen) && + if ((get_quit_at_eof() == OPT_ONPLUS || quit_if_one_screen) && hit_eof && !(ch_getflags() & CH_HELPFILE) && next_ifile(curr_ifile) == NULL_IFILE) quit(QUIT_OK); @@ -610,7 +645,7 @@ prompt() * 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 && + if (get_quit_at_eof() && squished && next_ifile(curr_ifile) == NULL_IFILE) quit(QUIT_OK); #endif @@ -625,16 +660,30 @@ prompt() /* * Select the proper prompt and display it. */ + /* + * If the previous action was a forward movement, + * don't clear the bottom line of the display; + * just print the prompt since the forward movement guarantees + * that we're in the right position to display the prompt. + * Clearing the line could cause a problem: for example, if the last + * line displayed ended at the right screen edge without a newline, + * then clearing would clear the last displayed line rather than + * the prompt line. + */ + if (!forw_prompt) + clear_bot(); clear_cmd(); + forw_prompt = 0; p = pr_string(); - if (p == NULL) + if (p == NULL || *p == '\0') putchr(':'); else { - so_enter(); + at_enter(AT_STANDOUT); putstr(p); - so_exit(); + at_exit(); } + clear_eol(); } /* @@ -826,6 +875,9 @@ multi_search(pattern, n) * Restore the file we were originally viewing. */ reedit_ifile(save_ifile); + } else + { + unsave_ifile(save_ifile); } } @@ -1081,7 +1133,10 @@ commands() ignore_eoi = 1; hit_eof = 0; while (!sigs) + { + make_display(); forward(1, 0, 0); + } ignore_eoi = 0; /* * This gets us back in "F mode" after processing @@ -1120,14 +1175,7 @@ commands() * 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 - } + clear_buffers(); /* FALLTHRU */ case A_REPAINT: /* @@ -1152,11 +1200,17 @@ commands() * Go to a specified percentage into the file. */ if (number < 0) + { number = 0; + fraction = 0; + } if (number > 100) + { number = 100; + fraction = 0; + } cmd_exec(); - jump_percent((int) number); + jump_percent((int) number, fraction); break; case A_GOEND: @@ -1211,6 +1265,7 @@ commands() * just means return to viewing the * previous file. */ + hshift = save_hshift; if (edit_prev(1) == 0) break; } @@ -1222,7 +1277,8 @@ commands() /* * Define abbreviation for a commonly used sequence below. */ -#define DO_SEARCH() if (number <= 0) number = 1; \ +#define DO_SEARCH() \ + if (number <= 0) number = 1; \ mca_search(); \ cmd_exec(); \ multi_search((char *)NULL, (int) number); @@ -1300,6 +1356,8 @@ commands() if (ch_getflags() & CH_HELPFILE) break; cmd_exec(); + save_hshift = hshift; + hshift = 0; (void) edit(FAKE_HELPFILE); break; @@ -1340,9 +1398,8 @@ commands() } if (curr_altfilename != NULL) { - error("Cannot edit file processed with LESSOPEN", + error("WARNING: This file was viewed via LESSOPEN", NULL_PARG); - break; } start_mca(A_SHELL, "!", ml_shell, 0); /* @@ -1375,7 +1432,7 @@ commands() number = 1; if (edit_next((int) number)) { - if (quit_at_eof && hit_eof && + if (get_quit_at_eof() && hit_eof && !(ch_getflags() & CH_HELPFILE)) quit(QUIT_OK); parg.p_string = (number > 1) ? "(N-th) " : ""; @@ -1524,8 +1581,8 @@ commands() break; start_mca(A_SETMARK, "mark: ", (void*)NULL, 0); c = getcc(); - if (c == erase_char || c == kill_char || - c == '\n' || c == '\r') + if (c == erase_char || c == erase2_char || + c == kill_char || c == '\n' || c == '\r') break; setmark(c); break; @@ -1536,9 +1593,10 @@ commands() */ start_mca(A_GOMARK, "goto mark: ", (void*)NULL, 0); c = getcc(); - if (c == erase_char || c == kill_char || - c == '\n' || c == '\r') + if (c == erase_char || c == erase2_char || + c == kill_char || c == '\n' || c == '\r') break; + cmd_exec(); gomark(c); break; @@ -1551,7 +1609,7 @@ commands() } start_mca(A_PIPE, "|mark: ", (void*)NULL, 0); c = getcc(); - if (c == erase_char || c == kill_char) + if (c == erase_char || c == erase2_char || c == kill_char) break; if (c == '\n' || c == '\r') c = '.'; diff --git a/src/bin/less/configure b/src/bin/less/configure index 6264a36eb7..1d3f57aa4f 100755 --- a/src/bin/less/configure +++ b/src/bin/less/configure @@ -1,78 +1,35 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.54 for less 1. +# Generated by GNU Autoconf 2.61 for less 1. # -# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -# Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006 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 +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh 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 + setopt NO_GLOB_SUBST else - as_unset=false + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + 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. +# PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' @@ -82,184 +39,536 @@ 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 + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi - rm -f conftest.sh + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false 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 +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +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 +IFS=$as_save_IFS - ;; - 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 + ;; +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_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME +do + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var 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 - '') +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; 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'` + +# CDPATH. +$as_unset CDPATH + + +if test "x$CONFIG_SHELL" = x; then + if (eval ":") 2>/dev/null; then + as_have_required=yes +else + as_have_required=no +fi + + if test $as_have_required = yes && (eval ": +(as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0) || { (exit 1); exit 1; } + +( + as_lineno_1=\$LINENO + as_lineno_2=\$LINENO + test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && + test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } +") 2> /dev/null; then + : +else + as_candidate_shells= 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 + case $as_dir in /*) - if ("$as_dir/$as_base" -c ' + for as_base in sh bash ksh sh5; do + as_candidate_shells="$as_candidate_shells $as_dir/$as_base" + done;; + esac +done +IFS=$as_save_IFS + + + for as_shell in $as_candidate_shells $SHELL; do + # Try only shells that exist, to save several forks. + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { ("$as_shell") 2> /dev/null <<\_ASEOF +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+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +_ASEOF +}; then + CONFIG_SHELL=$as_shell + as_have_required=yes + if { "$as_shell" 2> /dev/null <<\_ASEOF +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+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + +fi + + +: +(as_func_return () { + (exit $1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = "$1" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test $exitcode = 0) || { (exit 1); exit 1; } + +( 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 + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } + +_ASEOF +}; then + break +fi + +fi + + done + + if test "x$CONFIG_SHELL" != x; then + for as_var in BASH_ENV ENV + do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + done + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + + if test $as_have_required = no; then + echo This script requires a shell more modern than all the + echo shells that I found on your system. Please install a + echo modern shell, or manually run the script under such a + echo shell if you do have one. + { (exit 1); exit 1; } +fi + + +fi + +fi + + + +(eval "as_func_return () { + (exit \$1) +} +as_func_success () { + as_func_return 0 +} +as_func_failure () { + as_func_return 1 +} +as_func_ret_success () { + return 0 +} +as_func_ret_failure () { + return 1 +} + +exitcode=0 +if as_func_success; then + : +else + exitcode=1 + echo as_func_success failed. +fi + +if as_func_failure; then + exitcode=1 + echo as_func_failure succeeded. +fi + +if as_func_ret_success; then + : +else + exitcode=1 + echo as_func_ret_success failed. +fi + +if as_func_ret_failure; then + exitcode=1 + echo as_func_ret_failure succeeded. +fi + +if ( set x; as_func_ret_success y && test x = \"\$1\" ); then + : +else + exitcode=1 + echo positional parameters were not saved. +fi + +test \$exitcode = 0") || { + echo No shell found that supports shell functions. + echo Please tell autoconf@gnu.org about your system, + echo including any error possibly output before this + echo message +} + + + + as_lineno_1=$LINENO + as_lineno_2=$LINENO + test "x$as_lineno_1" != "x$as_lineno_2" && + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # 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. + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, 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 | + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop - s,-$,, - s,^['$as_cr_digits']*\n,, + s/-\n.*// ' >$as_me.lineno && - chmod +x $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 + # original and so on. Autoconf is especially sensitive 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= ;; +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1; then +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi 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='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || 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 +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else + test -d ./-p && rmdir ./-p as_mkdir_p=false fi -as_executable_p="test -f" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # 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" +as_tr_cpp="eval 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" +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH +exec 7<&0 &1 # 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_clean_files= ac_config_libobj_dir=. +LIBOBJS= 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' @@ -271,42 +580,103 @@ ac_unique_file="forwback.c" # Factoring default headers for most tests. ac_includes_default="\ #include -#if HAVE_SYS_TYPES_H +#ifdef HAVE_SYS_TYPES_H # include #endif -#if HAVE_SYS_STAT_H +#ifdef HAVE_SYS_STAT_H # include #endif -#if STDC_HEADERS +#ifdef STDC_HEADERS # include # include #else -# if HAVE_STDLIB_H +# ifdef HAVE_STDLIB_H # include # endif #endif -#if HAVE_STRING_H -# if !STDC_HEADERS && HAVE_MEMORY_H +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif -#if HAVE_STRINGS_H +#ifdef HAVE_STRINGS_H # include #endif -#if HAVE_INTTYPES_H +#ifdef HAVE_INTTYPES_H # include -#else -# if HAVE_STDINT_H -# include -# endif #endif -#if HAVE_UNISTD_H +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H # include #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_vars='SHELL +PATH_SEPARATOR +PACKAGE_NAME +PACKAGE_TARNAME +PACKAGE_VERSION +PACKAGE_STRING +PACKAGE_BUGREPORT +exec_prefix +prefix +program_transform_name +bindir +sbindir +libexecdir +datarootdir +datadir +sysconfdir +sharedstatedir +localstatedir +includedir +oldincludedir +docdir +infodir +htmldir +dvidir +pdfdir +psdir +libdir +localedir +mandir +DEFS +ECHO_C +ECHO_N +ECHO_T +LIBS +build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +CPPFLAGS +ac_ct_CC +EXEEXT +OBJEXT +CPP +GREP +EGREP +INSTALL_PROGRAM +INSTALL_SCRIPT +INSTALL_DATA +REGEX_O +LIBOBJS +LTLIBOBJS' ac_subst_files='' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + # Initialize some variables set by options. ac_init_help= @@ -333,34 +703,48 @@ x_libraries=NONE # 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. +# (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' -datadir='${prefix}/share' +datarootdir='${prefix}/share' +datadir='${datarootdir}' 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' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' ac_prev= +ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" + eval $ac_prev=\$ac_option ac_prev= continue fi - ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` + case $ac_option in + *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *) ac_optarg=yes ;; + esac # Accept the important Cygnus configure options, so we can diagnose typos. - case $ac_option in + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; @@ -382,33 +766,45 @@ do --config-cache | -C) cache_file=config.cache ;; - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) + -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$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 && + 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" ;; + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; -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 && + 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'" ;; + ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` + eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ @@ -435,6 +831,12 @@ do -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; @@ -459,13 +861,16 @@ do | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) + | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) @@ -530,6 +935,16 @@ do | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; @@ -582,24 +997,20 @@ do -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 && + 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'" ;; + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + 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 && + 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" ;; + ac_package=`echo $ac_package | sed 's/[-.]/_/g'` + eval with_$ac_package=no ;; --x) # Obsolete; use --with-x. @@ -630,8 +1041,7 @@ Try \`$0 --help' for more information." >&2 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'" + eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) @@ -651,27 +1061,19 @@ if test -n "$ac_prev"; then { (exit 1); exit 1; }; } fi -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix +# Be sure to have absolute directory names. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir do - eval ac_val=$`echo $ac_var` + eval ac_val=\$$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; }; };; + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac + { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 + { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' @@ -698,74 +1100,76 @@ test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + { echo "$as_me: error: Working directory cannot be determined" >&2 + { (exit 1); exit 1; }; } +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + { echo "$as_me: error: pwd does not report name of working directory" >&2 + { (exit 1); exit 1; }; } + + # 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 || + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$0" || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$0" : 'X\(//\)[^/]' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || + 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'` + 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 + 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 +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&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 +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&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 + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done # # Report the --help message. @@ -794,14 +1198,11 @@ Configuration: -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] + [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] + [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify @@ -814,15 +1215,22 @@ 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] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/less] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF @@ -843,6 +1251,7 @@ Optional Features: Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-secure Compile in secure mode --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 @@ -851,96 +1260,95 @@ Some influential environment variables: CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory - CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have - headers in a nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if + you have headers in a nonstandard directory 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 +ac_status=$? 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 + test -d "$ac_dir" || continue ac_builddir=. -if test "$ac_dir" != .; then +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) 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 + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix case $srcdir in - .) # No --srcdir option. We are building in place. + .) # 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_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. 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 ;; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$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` +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - 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 + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested 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 else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi - cd $ac_popdir + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } done fi -test -n "$ac_init_help" && exit 0 +test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF less configure 1 -generated by GNU Autoconf 2.54 +generated by GNU Autoconf 2.61 -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 -Free Software Foundation, Inc. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006 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 + exit fi -exec 5>config.log -cat >&5 <<_ACEOF +cat >config.log <<_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 +generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF +exec 5>>config.log { cat <<_ASUNAME ## --------- ## @@ -959,7 +1367,7 @@ uname -v = `(uname -v) 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` +/usr/bin/hostinfo = `(/usr/bin/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` @@ -973,6 +1381,7 @@ do test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done +IFS=$as_save_IFS } >&5 @@ -988,30 +1397,57 @@ _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= -ac_sep= -for ac_arg +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 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=" " + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; + 2) + ac_configure_args1="$ac_configure_args1 '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + ac_configure_args="$ac_configure_args '$ac_arg'" + ;; + esac + done done +$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } +$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. -# WARNING: Be sure not to use single quotes in there, as some shells, -# such as our DU 5.0 friend, will then `close' the trap. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { @@ -1024,20 +1460,34 @@ trap 'exit_status=$? _ASBOX echo # The following way of writing the cache mishandles newlines in values, -{ +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done (set) 2>&1 | - case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in - *ac_space=\ *) + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) sed -n \ - "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" - ;; + "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" + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; - esac; -} + esac | + sort +) echo cat <<\_ASBOX @@ -1048,22 +1498,28 @@ _ASBOX echo for ac_var in $ac_subst_vars do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX -## ------------- ## -## Output files. ## -## ------------- ## +## ------------------- ## +## File substitutions. ## +## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do - eval ac_val=$`echo $ac_var` - echo "$ac_var='"'"'$ac_val'"'"'" + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + echo "$ac_var='\''$ac_val'\''" done | sort echo fi @@ -1075,26 +1531,24 @@ _ASBOX ## ----------- ## _ASBOX echo - sed "/^$/d" confdefs.h | sort + cat confdefs.h 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 && + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status - ' 0 +' 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 +rm -f -r conftest* confdefs.h # Predefined preprocessor variables. @@ -1125,14 +1579,17 @@ _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 +if test -n "$CONFIG_SITE"; then + set x "$CONFIG_SITE" +elif test "x$prefix" != xNONE; then + set x "$prefix/share/config.site" "$prefix/etc/config.site" +else + set x "$ac_default_prefix/share/config.site" \ + "$ac_default_prefix/etc/config.site" fi -for ac_site_file in $CONFIG_SITE; do +shift +for ac_site_file +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;} @@ -1148,8 +1605,8 @@ if test -r "$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;; + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; esac fi else @@ -1161,12 +1618,11 @@ 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 +for ac_var in $ac_precious_vars; 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" + 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 @@ -1179,20 +1635,19 @@ echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ,);; *) 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:$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:$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:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} - ac_cache_corrupted=: + 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=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in @@ -1209,6 +1664,30 @@ echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start ov { (exit 1); exit 1; }; } fi + + + + + + + + + + + + + + + + + + + + + + + + ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -1217,32 +1696,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - - - - - - - - - - - - - - - - - - - - - - ac_config_headers="$ac_config_headers defines.h" +ac_config_headers="$ac_config_headers defines.h" # Checks for programs. @@ -1254,8 +1708,8 @@ 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 +{ 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 @@ -1268,32 +1722,34 @@ 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 -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 +IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { 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 + { 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 +{ 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 @@ -1306,36 +1762,51 @@ 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 -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 +IFS=$as_save_IFS 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 + { 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 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi - CC=$ac_ct_CC + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi 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. + 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 +{ 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 @@ -1348,74 +1819,34 @@ 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 -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 +IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { 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 + { 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 +{ 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 @@ -1429,7 +1860,7 @@ 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 -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 @@ -1440,6 +1871,7 @@ do fi done done +IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. @@ -1457,22 +1889,23 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { 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 + { 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 + for ac_prog in cl.exe 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 +{ 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 @@ -1485,36 +1918,38 @@ 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 -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 +IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:$LINENO: result: $CC" >&5 -echo "${ECHO_T}$CC" >&6 + { 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 + { 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 + for ac_prog in cl.exe 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 +{ 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 @@ -1527,61 +1962,96 @@ 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 -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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 +IFS=$as_save_IFS 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 + { 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 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi + test -n "$ac_ct_CC" && break done - CC=$ac_ct_CC + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&5 +echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools +whose name does not start with the host triplet. If you think this +configuration is useful to you, please write to autoconf@gnu.org." >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi 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;} +test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&5 +echo "$as_me: error: no acceptable C compiler found in \$PATH +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. -echo "$as_me:$LINENO:" \ - "checking for C compiler version" >&5 +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 &5\"") >&5 - (eval $ac_compiler --version &5) 2>&5 +{ (ac_try="$ac_compiler --version >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 - (eval $ac_compiler -v &5) 2>&5 +{ (ac_try="$ac_compiler -v >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } -{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 - (eval $ac_compiler -V &5) 2>&5 +{ (ac_try="$ac_compiler -V >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compiler -V >&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" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -1592,63 +2062,107 @@ main () } _ACEOF ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.exe" +ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -echo "$as_me:$LINENO: checking for C compiler default output" >&5 -echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 +echo $ECHO_N "checking for C compiler default output file name... $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 +# +# List of possible output files, starting from the most likely. +# The algorithm is not robust to junk in `.', hence go to wildcards (a.*) +# only as a last resort. b.out is created by i960 compilers. +ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' +# +# The IRIX 6 linker writes into existing files which may not be +# executable, retaining their permissions. Remove them first so a +# subsequent execution test works. +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { (ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +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;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; esac done +test "$ac_cv_exeext" = no && ac_cv_exeext= + else + ac_file='' +fi + +{ echo "$as_me:$LINENO: result: $ac_file" >&5 +echo "${ECHO_T}$ac_file" >&6; } +if test -z "$ac_file"; then echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + { { echo "$as_me:$LINENO: error: C compiler cannot create executables -check \`config.log' for details." >&5 +See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables -check \`config.log' for details." >&2;} +See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_file" >&5 -echo "${ECHO_T}$ac_file" >&6 -# Check the compiler produces executables we can run. If not, either +# Check that 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 +{ 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 + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then @@ -1658,29 +2172,36 @@ if test "$cross_compiling" != yes; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'." >&5 +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. -If you meant to cross compile, use \`--host'." >&2;} +If you meant to cross compile, use \`--host'. +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi -echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6 +{ echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; } -rm -f a.out a.exe conftest$ac_cv_exeext +rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save -# Check the compiler produces executables we can run. If not, either +# Check that 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 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 +{ echo "$as_me:$LINENO: checking for suffix of executables" >&5 +echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then @@ -1691,34 +2212,38 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 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_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - export ac_cv_exeext - break;; + 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;} + { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext -echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 -echo "${ECHO_T}$ac_cv_exeext" >&6 +{ 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 +{ 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" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -1729,40 +2254,52 @@ main () } _ACEOF rm -f conftest.o conftest.obj -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) 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;} +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&5 +echo "$as_me: error: cannot compute suffix of object files: cannot compile +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 -echo "${ECHO_T}$ac_cv_objext" >&6 +{ 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 +{ 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" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -1776,41 +2313,54 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_compiler_gnu=no +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_compiler_gnu=no fi -rm -f conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err 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 +{ 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 +{ 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" + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -1821,27 +2371,118 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; 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 +sed 's/^/| /' conftest.$ac_ext >&5 + + CFLAGS="" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_g=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi -rm -f conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err 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 + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +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 @@ -1857,16 +2498,19 @@ 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 "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 +echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_cv_prog_cc_stdc=no + ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #include @@ -1889,6 +2533,21 @@ static char *f (char * (*g) (char **, int), char **p, ...) va_end (v); return s; } + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; @@ -1903,156 +2562,57 @@ 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__" +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -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 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi -rm -f conftest.$ac_objext + +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break done -rm -f conftest.$ac_ext conftest.$ac_objext +rm -f conftest.$ac_ext 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 ;; +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { echo "$as_me:$LINENO: result: none needed" >&5 +echo "${ECHO_T}none needed" >&6; } ;; + xno) + { echo "$as_me:$LINENO: result: unsupported" >&5 +echo "${ECHO_T}unsupported" >&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" ;; + CC="$CC $ac_cv_prog_cc_c89" + { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 +echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; 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 ' \ - '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 -$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' @@ -2060,99 +2620,86 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ 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 +{ 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" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 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 +for ac_lib in '' cposix; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib 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 + fi + rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_search_strerror=$ac_res else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - done + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext + if test "${ac_cv_search_strerror+set}" = set; then + break fi +done +if test "${ac_cv_search_strerror+set}" = set; then + : +else + ac_cv_search_strerror=no +fi +rm conftest.$ac_ext 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" +{ echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5 +echo "${ECHO_T}$ac_cv_search_strerror" >&6; } +ac_res=$ac_cv_search_strerror +if test "$ac_res" != no; then + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi @@ -2161,8 +2708,8 @@ 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 +{ 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= @@ -2179,73 +2726,87 @@ for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" -#include - Syntax error +/* confdefs.h. */ _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Broken: fails on valid input. continue fi + rm -f conftest.err conftest.$ac_ext - # OK, works on sane cases. Now check whether non-existent headers + # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Passes both tests. ac_preproc_ok=: break fi + rm -f conftest.err conftest.$ac_ext done @@ -2263,80 +2824,94 @@ fi else ac_cv_prog_CPP=$CPP fi -echo "$as_me:$LINENO: result: $CPP" >&5 -echo "${ECHO_T}$CPP" >&6 +{ echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" -#include - Syntax error +/* confdefs.h. */ _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Broken: fails on valid input. continue fi + rm -f conftest.err conftest.$ac_ext - # OK, works on sane cases. Now check whether non-existent headers + # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + # Passes both tests. ac_preproc_ok=: break fi + rm -f conftest.err conftest.$ac_ext done @@ -2345,8 +2920,10 @@ 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;} + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi @@ -2357,31 +2934,181 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ 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 "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 +echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } +if test "${ac_cv_path_GREP+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' + # Extract the first word of "grep ggrep" to use in msg output +if test -z "$GREP"; then +set dummy grep ggrep; ac_prog_name=$2 +if test "${ac_cv_path_GREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_GREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue + # Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_GREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + fi -echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 -echo "${ECHO_T}$ac_cv_prog_egrep" >&6 - EGREP=$ac_cv_prog_egrep + +GREP="$ac_cv_path_GREP" +if test -z "$GREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_GREP=$GREP +fi + + +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 +echo "${ECHO_T}$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } +if test "${ac_cv_path_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_path_EGREP="$GREP -E" + else + # Extract the first word of "egrep" to use in msg output +if test -z "$EGREP"; then +set dummy egrep; ac_prog_name=$2 +if test "${ac_cv_path_EGREP+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_path_EGREP_found=false +# Loop through the user's path and test for each of PROGNAME-LIST +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue + # Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + ac_count=`expr $ac_count + 1` + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + + $ac_path_EGREP_found && break 3 + done +done + +done +IFS=$as_save_IFS + + +fi + +EGREP="$ac_cv_path_EGREP" +if test -z "$EGREP"; then + { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 +echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} + { (exit 1); exit 1; }; } +fi + +else + ac_cv_path_EGREP=$EGREP +fi + + + fi +fi +{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 +echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_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 + { 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" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include Autoconf TIOCGETP _ACEOF @@ -2396,8 +3123,11 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include Autoconf TCGETA _ACEOF @@ -2409,37 +3139,43 @@ 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 +{ 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 +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 + 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 + 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;} + { { 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. + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or @@ -2452,9 +3188,10 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # 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" +# OS/2's system install, which has a completely different semantic # ./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 +{ 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 @@ -2468,6 +3205,7 @@ do case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. @@ -2475,40 +3213,41 @@ case $as_dir/ in # 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 + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$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 +IFS=$as_save_IFS 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 + # As a last resort, use the slow shell script. Don't cache a + # value 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. + # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi -echo "$as_me:$LINENO: result: $INSTALL" >&5 -echo "${ECHO_T}$INSTALL" >&6 +{ 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. @@ -2520,15 +3259,15 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Checks for compilation model. -# Check whether --enable-largefile or --disable-largefile was given. +# Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then - enableval="$enable_largefile" + enableval=$enable_largefile; +fi -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 + { 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 @@ -2536,11 +3275,14 @@ else 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" + # 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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, @@ -2558,65 +3300,83 @@ main () return 0; } _ACEOF - rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then break else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' 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 + +rm -f core conftest.err conftest.$ac_objext + CC="$CC -n32" + rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_sys_largefile_CC=' -n32'; break else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi -rm -f conftest.$ac_objext - break + +rm -f core conftest.err 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 +{ 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 + { 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" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, @@ -2635,26 +3395,37 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_sys_file_offset_bits=no; break else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi -rm -f conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #define _FILE_OFFSET_BITS 64 #include /* Check that off_t can represent 2**63 - 1 correctly. @@ -2674,46 +3445,59 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_sys_file_offset_bits=64; break else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi -rm -f conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown 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 - +{ echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5 +echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6; } +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) cat >>confdefs.h <<_ACEOF #define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits _ACEOF - -fi +;; +esac 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_file_offset_bits = unknown; then + { 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" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, @@ -2732,26 +3516,37 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_sys_large_files=no; break else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi -rm -f conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #define _LARGE_FILES 1 #include /* Check that off_t can represent 2**63 - 1 correctly. @@ -2771,309 +3566,514 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_sys_large_files=1; break else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi -rm -f conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_large_files=unknown 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 - +{ echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5 +echo "${ECHO_T}$ac_cv_sys_large_files" >&6; } +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) cat >>confdefs.h <<_ACEOF #define _LARGE_FILES $ac_cv_sys_large_files _ACEOF - -fi +;; +esac rm -f conftest* + fi 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 +{ echo "$as_me:$LINENO: checking for tgoto in -ltinfo" >&5 +echo $ECHO_N "checking for tgoto in -ltinfo... $ECHO_C" >&6; } +if test "${ac_cv_lib_tinfo_tgoto+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ltinfo $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char tgoto (); +int +main () +{ +return tgoto (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_tinfo_tgoto=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_tinfo_tgoto=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_tinfo_tgoto" >&5 +echo "${ECHO_T}$ac_cv_lib_tinfo_tgoto" >&6; } +if test $ac_cv_lib_tinfo_tgoto = yes; then + have_tinfo=yes +else + have_tinfo=no +fi + +{ 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" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; 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 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_xcurses_initscr=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + 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 +{ 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 +{ echo "$as_me:$LINENO: checking for initscr in -lncursesw" >&5 +echo $ECHO_N "checking for initscr in -lncursesw... $ECHO_C" >&6; } +if test "${ac_cv_lib_ncursesw_initscr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lncursesw $LIBS" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char initscr (); +int +main () +{ +return initscr (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + ac_cv_lib_ncursesw_initscr=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_ncursesw_initscr=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ echo "$as_me:$LINENO: result: $ac_cv_lib_ncursesw_initscr" >&5 +echo "${ECHO_T}$ac_cv_lib_ncursesw_initscr" >&6; } +if test $ac_cv_lib_ncursesw_initscr = yes; then + have_ncursesw=yes +else + have_ncursesw=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" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; 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 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_ncurses_initscr=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + 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 +{ 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 +{ 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" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; 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 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_curses_initscr=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + 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 +{ 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 +{ 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" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; 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 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_termcap_tgetent=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + 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 +{ 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 +{ 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" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; 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 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_termlib_tgetent=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + 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 +{ 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 @@ -3083,55 +4083,67 @@ 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 +{ 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" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; 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 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_gen_regcmp=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + 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 +{ 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 @@ -3142,55 +4154,67 @@ _ACEOF fi -echo "$as_me:$LINENO: checking for regcmp in -lintl" >&5 -echo $ECHO_N "checking for regcmp in -lintl... $ECHO_C" >&6 +{ 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" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; 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 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_intl_regcmp=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + 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 +{ 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 @@ -3201,55 +4225,67 @@ _ACEOF fi -echo "$as_me:$LINENO: checking for regcmp in -lPW" >&5 -echo $ECHO_N "checking for regcmp in -lPW... $ECHO_C" >&6 +{ 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" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; 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 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_PW_regcmp=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + 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 +{ 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 @@ -3261,8 +4297,8 @@ 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 +{ 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. @@ -3277,15 +4313,19 @@ fi fi if test $curses_broken = 0; then -# -- Try xcurses. + +# -- Try tinfo. if test "x$TERMLIBS" = x; then - if test $have_xcurses = yes; then - TERMLIBS="-lxcurses" + if test $have_tinfo = yes; then + TERMLIBS="-ltinfo" SAVE_LIBS=$LIBS LIBS="$LIBS $TERMLIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -3296,24 +4336,141 @@ tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then termok=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -termok=no +sed 's/^/| /' conftest.$ac_ext >&5 + + termok=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$SAVE_LIBS + if test $termok = no; then TERMLIBS=""; fi + fi +fi + +# -- 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 +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end 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 { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + termok=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + termok=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$SAVE_LIBS + if test $termok = no; then TERMLIBS=""; fi + fi +fi + +# -- Try ncursesw. +if test "x$TERMLIBS" = x; then + if test $have_ncursesw = yes; then + TERMLIBS="-lncursesw" + SAVE_LIBS=$LIBS + LIBS="$LIBS $TERMLIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end 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 { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + termok=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + termok=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext LIBS=$SAVE_LIBS if test $termok = no; then TERMLIBS=""; fi fi @@ -3326,8 +4483,11 @@ if test "x$TERMLIBS" = x; then SAVE_LIBS=$LIBS LIBS="$LIBS $TERMLIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -3338,24 +4498,33 @@ tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then termok=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -termok=no +sed 's/^/| /' conftest.$ac_ext >&5 + + termok=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext LIBS=$SAVE_LIBS if test $termok = no; then TERMLIBS=""; fi fi @@ -3368,8 +4537,11 @@ if test "x$TERMLIBS" = x; then SAVE_LIBS=$LIBS LIBS="$LIBS $TERMLIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -3380,24 +4552,33 @@ tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then termok=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -termok=no +sed 's/^/| /' conftest.$ac_ext >&5 + + termok=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext LIBS=$SAVE_LIBS if test $termok = no; then TERMLIBS=""; fi fi @@ -3411,8 +4592,11 @@ if test "x$TERMLIBS" = x; then SAVE_LIBS=$LIBS LIBS="$LIBS $TERMLIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -3423,24 +4607,33 @@ tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then termok=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -termok=no +sed 's/^/| /' conftest.$ac_ext >&5 + + termok=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext LIBS=$SAVE_LIBS if test $termok = no; then TERMLIBS=""; fi fi @@ -3455,8 +4648,11 @@ if test "x$TERMLIBS" = x; then SAVE_LIBS=$LIBS LIBS="$LIBS $TERMLIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -3467,24 +4663,33 @@ tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then termok=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -termok=no +sed 's/^/| /' conftest.$ac_ext >&5 + + termok=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext LIBS=$SAVE_LIBS if test $termok = no; then TERMLIBS=""; fi fi @@ -3497,8 +4702,11 @@ if test "x$TERMLIBS" = x; then SAVE_LIBS=$LIBS LIBS="$LIBS $TERMLIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -3509,83 +4717,107 @@ tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then termok=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -termok=no +sed 's/^/| /' conftest.$ac_ext >&5 + + termok=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext LIBS=$SAVE_LIBS if test $termok = no; then TERMLIBS=""; fi fi fi if test "x$TERMLIBS" = x; then - echo "$as_me:$LINENO: result: Cannot find terminal libraries - configure failed" >&5 -echo "${ECHO_T}Cannot find terminal libraries - configure failed" >&6 + { echo "$as_me:$LINENO: result: Cannot find terminal libraries - configure failed" >&5 +echo "${ECHO_T}Cannot find terminal libraries - configure failed" >&6; } exit 1 fi -echo "$as_me:$LINENO: result: using $TERMLIBS" >&5 -echo "${ECHO_T}using $TERMLIBS" >&6 +{ echo "$as_me:$LINENO: result: using $TERMLIBS" >&5 +echo "${ECHO_T}using $TERMLIBS" >&6; } LIBS="$LIBS $TERMLIBS" # Checks for header files. -echo "$as_me:$LINENO: checking for ANSI C header files" >&5 -echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #include #include +int +main () +{ + + ; + return 0; +} _ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 - ac_cv_header_stdc=no +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_stdc=no fi -rm -f conftest.err conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include _ACEOF @@ -3602,8 +4834,11 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include _ACEOF @@ -3623,16 +4858,21 @@ if test $ac_cv_header_stdc = yes; then : else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include +#include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else -# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif @@ -3643,19 +4883,28 @@ main () int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - exit(2); - exit (0); + || toupper (i) != TOUPPER (i)) + return 2; + return 0; } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then @@ -3663,16 +4912,19 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ( exit $ac_status ) ac_cv_header_stdc=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi + + fi fi -fi -echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 -echo "${ECHO_T}$ac_cv_header_stdc" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF @@ -3692,43 +4944,54 @@ fi for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h + inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -eval "$as_ac_Header=no" +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_Header=no" fi -rm -f conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 @@ -3755,108 +5018,134 @@ done -for ac_header in ctype.h errno.h fcntl.h limits.h stdio.h stdlib.h string.h termcap.h termio.h termios.h time.h unistd.h values.h sys/ioctl.h sys/stream.h sys/ptem.h +for ac_header in ctype.h errno.h fcntl.h limits.h stdio.h stdlib.h string.h termcap.h termio.h termios.h time.h unistd.h values.h sys/ioctl.h sys/stream.h wctype.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -if eval "test \"\${$as_ac_Header+set}\" = set"; then - echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } else # Is the header compilable? -echo "$as_me:$LINENO: checking $ac_header usability" >&5 -echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_header_compiler=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_header_compiler=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 -echo "${ECHO_T}$ac_header_compiler" >&6 - -# Is the header present? -echo "$as_me:$LINENO: checking $ac_header presence" >&5 -echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" -#include <$ac_header> -_ACEOF -if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 - (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes else - ac_cpp_err=yes + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no fi -if test -z "$ac_cpp_err"; then + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 - cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_header_preproc=no fi + rm -f conftest.err conftest.$ac_ext -echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 -echo "${ECHO_T}$ac_header_preproc" >&6 +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? -case $ac_header_compiler:$ac_header_preproc in - yes:no ) +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; - no:yes ) + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} - { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 -echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 -echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};; +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + + ;; esac -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - eval "$as_ac_Header=$ac_header_preproc" + eval "$as_ac_Header=\$ac_header_preproc" fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } fi if test `eval echo '${'$as_ac_Header'}'` = yes; then @@ -3870,53 +5159,66 @@ done # Checks for typedefs, structures, and compiler characteristics. -echo "$as_me:$LINENO: checking whether stat file-mode macros are broken" >&5 -echo $ECHO_N "checking whether stat file-mode macros are broken... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking whether stat file-mode macros are broken" >&5 +echo $ECHO_N "checking whether stat file-mode macros are broken... $ECHO_C" >&6; } if test "${ac_cv_header_stat_broken+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include -#if defined(S_ISBLK) && defined(S_IFDIR) -# if S_ISBLK (S_IFDIR) -You lose. -# endif +#if defined S_ISBLK && defined S_IFDIR +extern char c1[S_ISBLK (S_IFDIR) ? -1 : 1]; #endif -#if defined(S_ISBLK) && defined(S_IFCHR) -# if S_ISBLK (S_IFCHR) -You lose. -# endif +#if defined S_ISBLK && defined S_IFCHR +extern char c2[S_ISBLK (S_IFCHR) ? -1 : 1]; #endif -#if defined(S_ISLNK) && defined(S_IFREG) -# if S_ISLNK (S_IFREG) -You lose. -# endif +#if defined S_ISLNK && defined S_IFREG +extern char c3[S_ISLNK (S_IFREG) ? -1 : 1]; #endif -#if defined(S_ISSOCK) && defined(S_IFREG) -# if S_ISSOCK (S_IFREG) -You lose. -# endif +#if defined S_ISSOCK && defined S_IFREG +extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1]; #endif _ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "You lose" >/dev/null 2>&1; then - ac_cv_header_stat_broken=yes -else +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_header_stat_broken=no -fi -rm -f conftest* +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ac_cv_header_stat_broken=yes fi -echo "$as_me:$LINENO: result: $ac_cv_header_stat_broken" >&5 -echo "${ECHO_T}$ac_cv_header_stat_broken" >&6 + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_header_stat_broken" >&5 +echo "${ECHO_T}$ac_cv_header_stat_broken" >&6; } if test $ac_cv_header_stat_broken = yes; then cat >>confdefs.h <<\_ACEOF @@ -3925,14 +5227,17 @@ _ACEOF fi -echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 -echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 +echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; } if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -3941,10 +5246,10 @@ main () #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; - const charset x; + const charset cs; /* SunOS 4.1.1 cc rejects this. */ - char const *const *ccp; - char **p; + char const *const *pcpcc; + char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; @@ -3953,16 +5258,17 @@ main () an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; - ccp = &g + (g ? g-g : 0); + pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ - ++ccp; - p = (char**) ccp; - ccp = (char const *const *) p; + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; + if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; @@ -3981,7 +5287,9 @@ main () } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; + if (!foo) return 0; } + return !cs[0] && !zero.x; #endif ; @@ -3989,27 +5297,34 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_c_const=no +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_c_const=no fi -rm -f conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 -echo "${ECHO_T}$ac_cv_c_const" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 +echo "${ECHO_T}$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF @@ -4018,118 +5333,143 @@ _ACEOF fi -echo "$as_me:$LINENO: checking for off_t" >&5 -echo $ECHO_N "checking for off_t... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for off_t" >&5 +echo $ECHO_N "checking for off_t... $ECHO_C" >&6; } if test "${ac_cv_type_off_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default +typedef off_t ac__type_new_; int main () { -if ((off_t *) 0) +if ((ac__type_new_ *) 0) return 0; -if (sizeof (off_t)) +if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_type_off_t=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_type_off_t=no +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_off_t=no fi -rm -f conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 -echo "${ECHO_T}$ac_cv_type_off_t" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 +echo "${ECHO_T}$ac_cv_type_off_t" >&6; } if test $ac_cv_type_off_t = yes; then : else cat >>confdefs.h <<_ACEOF -#define off_t long +#define off_t long int _ACEOF fi -echo "$as_me:$LINENO: checking for size_t" >&5 -echo $ECHO_N "checking for size_t... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for size_t" >&5 +echo $ECHO_N "checking for size_t... $ECHO_C" >&6; } if test "${ac_cv_type_size_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default +typedef size_t ac__type_new_; int main () { -if ((size_t *) 0) +if ((ac__type_new_ *) 0) return 0; -if (sizeof (size_t)) +if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_type_size_t=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_type_size_t=no +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_size_t=no fi -rm -f conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 -echo "${ECHO_T}$ac_cv_type_size_t" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5 +echo "${ECHO_T}$ac_cv_type_size_t" >&6; } if test $ac_cv_type_size_t = yes; then : else cat >>confdefs.h <<_ACEOF -#define size_t unsigned +#define size_t unsigned int _ACEOF fi -echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 -echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5 +echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6; } if test "${ac_cv_header_time+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include #include @@ -4144,27 +5484,34 @@ return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_header_time=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_header_time=no +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_header_time=no fi -rm -f conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 -echo "${ECHO_T}$ac_cv_header_time" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5 +echo "${ECHO_T}$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\_ACEOF @@ -4215,6 +5562,12 @@ fi + + + + + + @@ -4223,63 +5576,77 @@ fi # Checks for identifiers. -echo "$as_me:$LINENO: checking for off_t" >&5 -echo $ECHO_N "checking for off_t... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for off_t" >&5 +echo $ECHO_N "checking for off_t... $ECHO_C" >&6; } if test "${ac_cv_type_off_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ $ac_includes_default +typedef off_t ac__type_new_; int main () { -if ((off_t *) 0) +if ((ac__type_new_ *) 0) return 0; -if (sizeof (off_t)) +if (sizeof (ac__type_new_)) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then ac_cv_type_off_t=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_type_off_t=no +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_off_t=no fi -rm -f conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 -echo "${ECHO_T}$ac_cv_type_off_t" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5 +echo "${ECHO_T}$ac_cv_type_off_t" >&6; } if test $ac_cv_type_off_t = yes; then : else cat >>confdefs.h <<_ACEOF -#define off_t long +#define off_t long int _ACEOF fi -echo "$as_me:$LINENO: checking for void" >&5 -echo $ECHO_N "checking for void... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for void" >&5 +echo $ECHO_N "checking for void... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -4290,34 +5657,44 @@ void *foo = 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && - { 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 - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; cat >>confdefs.h <<\_ACEOF + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; }; cat >>confdefs.h <<\_ACEOF #define HAVE_VOID 1 _ACEOF else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: checking for const" >&5 -echo $ECHO_N "checking for const... $ECHO_C" >&6 + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: checking for const" >&5 +echo $ECHO_N "checking for const... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -4328,34 +5705,44 @@ const int foo = 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && - { 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 - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; cat >>confdefs.h <<\_ACEOF + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; }; cat >>confdefs.h <<\_ACEOF #define HAVE_CONST 1 _ACEOF else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:$LINENO: checking for time_t" >&5 -echo $ECHO_N "checking for time_t... $ECHO_C" >&6 + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: checking for time_t" >&5 +echo $ECHO_N "checking for time_t... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include int main () @@ -4366,80 +5753,138 @@ time_t t = 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && - { 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 - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; cat >>confdefs.h <<\_ACEOF + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; }; cat >>confdefs.h <<\_ACEOF #define HAVE_TIME_T 1 _ACEOF else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -f conftest.$ac_objext conftest.$ac_ext -# Checks for library functions. -echo "$as_me:$LINENO: checking return type of signal handlers" >&5 -echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 -if test "${ac_cv_type_signal+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: checking for st_ino in struct stat" >&5 +echo $ECHO_N "checking for st_ino in struct stat... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include -#include -#ifdef signal -# undef signal -#endif -#ifdef __cplusplus -extern "C" void (*signal (int, void (*)(int)))(int); -#else -void (*signal ()) (); -#endif - +#include int main () { -int i; +struct stat s; dev_t dev = s.st_dev; ino_t ino = s.st_ino; ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && - { 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_type_signal=void + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; }; cat >>confdefs.h <<\_ACEOF +#define HAVE_STAT_INO 1 +_ACEOF + else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_type_signal=int +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -f conftest.$ac_objext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +# Checks for library functions. +{ echo "$as_me:$LINENO: checking return type of signal handlers" >&5 +echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6; } +if test "${ac_cv_type_signal+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +#include + +int +main () +{ +return *(signal (0, 0)) (0) == 1; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_signal=int +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_signal=void fi -echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 -echo "${ECHO_T}$ac_cv_type_signal" >&6 + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5 +echo "${ECHO_T}$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal @@ -4455,68 +5900,91 @@ _ACEOF - -for ac_func in fsync memcpy popen _setjmp sigprocmask sigsetmask stat strchr strstr system +for ac_func in fsync popen _setjmp sigprocmask sigsetmask snprintf stat system fchmod do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then +{ echo "$as_me:$LINENO: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } +if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define $ac_func to an innocuous variant, in case declares $ac_func. + For example, HP-UX 11i declares gettimeofday. */ +#define $ac_func innocuous_$ac_func + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ + which can conflict with char $ac_func (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $ac_func + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ char $ac_func (); -char (*f) (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$ac_func || defined __stub___$ac_func +choke me +#endif int main () { -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -f = $ac_func; -#endif - +return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -eval "$as_ac_var=no" +sed 's/^/| /' conftest.$ac_ext >&5 + + eval "$as_ac_var=no" fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +ac_res=`eval echo '${'$as_ac_var'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 @@ -4526,65 +5994,251 @@ fi done -# Some systems have termios.h but not the corresponding functions. -echo "$as_me:$LINENO: checking for tcgetattr" >&5 -echo $ECHO_N "checking for tcgetattr... $ECHO_C" >&6 -if test "${ac_cv_func_tcgetattr+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char tcgetattr (); below. */ -#include -/* 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 tcgetattr (); -char (*f) (); +# AC_CHECK_FUNCS may not work for inline functions, so test these separately. +{ echo "$as_me:$LINENO: checking for memcpy" >&5 +echo $ECHO_N "checking for memcpy... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#if HAVE_STRING_H +#include +#endif int main () { -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_tcgetattr) || defined (__stub___tcgetattr) -choke me -#else -f = tcgetattr; -#endif - +memcpy(0,0,0); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; }; cat >>confdefs.h <<\_ACEOF +#define HAVE_MEMCPY 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + +{ echo "$as_me:$LINENO: checking for strchr" >&5 +echo $ECHO_N "checking for strchr... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#if HAVE_STRING_H +#include +#endif +int +main () +{ +strchr("x",'x'); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); }; }; then + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; }; cat >>confdefs.h <<\_ACEOF +#define HAVE_STRCHR 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + +{ echo "$as_me:$LINENO: checking for strstr" >&5 +echo $ECHO_N "checking for strstr... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +#if HAVE_STRING_H +#include +#endif +int +main () +{ +strstr("x","x"); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; }; cat >>confdefs.h <<\_ACEOF +#define HAVE_STRSTR 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + +# Some systems have termios.h but not the corresponding functions. +{ echo "$as_me:$LINENO: checking for tcgetattr" >&5 +echo $ECHO_N "checking for tcgetattr... $ECHO_C" >&6; } +if test "${ac_cv_func_tcgetattr+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define tcgetattr to an innocuous variant, in case declares tcgetattr. + For example, HP-UX 11i declares gettimeofday. */ +#define tcgetattr innocuous_tcgetattr + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char tcgetattr (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef tcgetattr + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char tcgetattr (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_tcgetattr || defined __stub___tcgetattr +choke me +#endif + +int +main () +{ +return tcgetattr (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_func_tcgetattr=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_func_tcgetattr=no +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_tcgetattr=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_func_tcgetattr" >&5 -echo "${ECHO_T}$ac_cv_func_tcgetattr" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_func_tcgetattr" >&5 +echo "${ECHO_T}$ac_cv_func_tcgetattr" >&6; } if test $ac_cv_func_tcgetattr = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_TERMIOS_FUNCS 1 @@ -4593,11 +6247,14 @@ _ACEOF fi -echo "$as_me:$LINENO: checking for fileno" >&5 -echo $ECHO_N "checking for fileno... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for fileno" >&5 +echo $ECHO_N "checking for fileno... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #if HAVE_STDIO_H #include @@ -4611,35 +6268,47 @@ static int x; x = fileno(stdin); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; cat >>confdefs.h <<\_ACEOF + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; }; cat >>confdefs.h <<\_ACEOF #define HAVE_FILENO 1 _ACEOF else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$as_me:$LINENO: checking for strerror" >&5 -echo $ECHO_N "checking for strerror... $ECHO_C" >&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + +{ echo "$as_me:$LINENO: checking for strerror" >&5 +echo $ECHO_N "checking for strerror... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #if HAVE_STDIO_H #include @@ -4659,35 +6328,47 @@ static char *x; x = strerror(0); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; cat >>confdefs.h <<\_ACEOF + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; }; cat >>confdefs.h <<\_ACEOF #define HAVE_STRERROR 1 _ACEOF else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +sed 's/^/| /' conftest.$ac_ext >&5 -echo "$as_me:$LINENO: checking for sys_errlist" >&5 -echo $ECHO_N "checking for sys_errlist... $ECHO_C" >&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + +{ echo "$as_me:$LINENO: checking for sys_errlist" >&5 +echo $ECHO_N "checking for sys_errlist... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -4698,76 +6379,111 @@ extern char *sys_errlist[]; static char **x; x = sys_errlist; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; cat >>confdefs.h <<\_ACEOF + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; }; cat >>confdefs.h <<\_ACEOF #define HAVE_SYS_ERRLIST 1 _ACEOF else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -echo "$as_me:$LINENO: checking for sigset_t" >&5 -echo $ECHO_N "checking for sigset_t... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +{ echo "$as_me:$LINENO: checking for sigset_t" >&5 +echo $ECHO_N "checking for sigset_t... $ECHO_C" >&6; } +if test "${ac_cv_type_sigset_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include +typedef sigset_t ac__type_new_; int main () { -sigset_t s; s = 0; +if ((ac__type_new_ *) 0) + return 0; +if (sizeof (ac__type_new_)) + return 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 +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 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); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; cat >>confdefs.h <<\_ACEOF + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_cv_type_sigset_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_type_sigset_t=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ echo "$as_me:$LINENO: result: $ac_cv_type_sigset_t" >&5 +echo "${ECHO_T}$ac_cv_type_sigset_t" >&6; } +if test $ac_cv_type_sigset_t = yes; then + +cat >>confdefs.h <<_ACEOF #define HAVE_SIGSET_T 1 _ACEOF -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -echo "$as_me:$LINENO: checking for sigemptyset" >&5 -echo $ECHO_N "checking for sigemptyset... $ECHO_C" >&6 +fi + + +{ echo "$as_me:$LINENO: checking for sigemptyset" >&5 +echo $ECHO_N "checking for sigemptyset... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include @@ -4780,36 +6496,48 @@ sigset_t s; sigemptyset(&s); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; cat >>confdefs.h <<\_ACEOF + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; }; cat >>confdefs.h <<\_ACEOF #define HAVE_SIGEMPTYSET 1 _ACEOF else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext have_errno=no -echo "$as_me:$LINENO: checking for errno" >&5 -echo $ECHO_N "checking for errno... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for errno" >&5 +echo $ECHO_N "checking for errno... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #if HAVE_ERRNO_H #include @@ -4823,31 +6551,44 @@ static int x; x = errno; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes - in errno.h" >&5 -echo "${ECHO_T}yes - in errno.h" >&6; cat >>confdefs.h <<\_ACEOF + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: yes - in errno.h" >&5 +echo "${ECHO_T}yes - in errno.h" >&6; }; cat >>confdefs.h <<\_ACEOF #define HAVE_ERRNO 1 _ACEOF have_errno=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext if test $have_errno = no; then cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #if HAVE_ERRNO_H #include @@ -4861,19 +6602,25 @@ extern int errno; static int x; x = errno; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes - must define" >&5 -echo "${ECHO_T}yes - must define" >&6; cat >>confdefs.h <<\_ACEOF + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: yes - must define" >&5 +echo "${ECHO_T}yes - must define" >&6; }; cat >>confdefs.h <<\_ACEOF #define HAVE_ERRNO 1 _ACEOF cat >>confdefs.h <<\_ACEOF @@ -4882,20 +6629,27 @@ _ACEOF else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -echo "$as_me:$LINENO: checking for locale" >&5 -echo $ECHO_N "checking for locale... $ECHO_C" >&6 +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +fi + +{ echo "$as_me:$LINENO: checking for locale" >&5 +echo $ECHO_N "checking for locale... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include +#include int main () { @@ -4905,34 +6659,47 @@ setlocale(LC_CTYPE,""); isprint(0); iscntrl(0); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; cat >>confdefs.h <<\_ACEOF + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; }; cat >>confdefs.h <<\_ACEOF #define HAVE_LOCALE 1 _ACEOF else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -echo "$as_me:$LINENO: checking for ctype functions" >&5 -echo $ECHO_N "checking for ctype functions... $ECHO_C" >&6 + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + +{ echo "$as_me:$LINENO: checking for ctype functions" >&5 +echo $ECHO_N "checking for ctype functions... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #if HAVE_CTYPE_H #include @@ -4946,37 +6713,100 @@ static int x; x = isupper(x); x = tolower(x); x = toupper(x); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes" >&5 -echo "${ECHO_T}yes" >&6; cat >>confdefs.h <<\_ACEOF + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; }; cat >>confdefs.h <<\_ACEOF #define HAVE_UPPER_LOWER 1 _ACEOF else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + +{ echo "$as_me:$LINENO: checking for wctype functions" >&5 +echo $ECHO_N "checking for wctype functions... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include +int +main () +{ +iswlower(0); iswupper(0); towlower(0); towupper(0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: yes" >&5 +echo "${ECHO_T}yes" >&6; }; cat >>confdefs.h <<\_ACEOF +#define HAVE_WCTYPE 1 +_ACEOF + +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext # Checks for external variable ospeed in the termcap library. have_ospeed=no -echo "$as_me:$LINENO: checking termcap for ospeed" >&5 -echo $ECHO_N "checking termcap for ospeed... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking termcap for ospeed" >&5 +echo $ECHO_N "checking termcap for ospeed... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #if HAVE_TERMIOS_H @@ -4994,31 +6824,44 @@ ospeed = 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes - in termcap.h" >&5 -echo "${ECHO_T}yes - in termcap.h" >&6; cat >>confdefs.h <<\_ACEOF + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: yes - in termcap.h" >&5 +echo "${ECHO_T}yes - in termcap.h" >&6; }; cat >>confdefs.h <<\_ACEOF #define HAVE_OSPEED 1 _ACEOF have_ospeed=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext if test $have_ospeed = no; then cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ int main () @@ -5029,19 +6872,25 @@ extern short ospeed; ospeed = 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: yes - must define" >&5 -echo "${ECHO_T}yes - must define" >&6; cat >>confdefs.h <<\_ACEOF + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: yes - must define" >&5 +echo "${ECHO_T}yes - must define" >&6; }; cat >>confdefs.h <<\_ACEOF #define HAVE_OSPEED 1 _ACEOF cat >>confdefs.h <<\_ACEOF @@ -5050,26 +6899,46 @@ _ACEOF else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 +sed 's/^/| /' conftest.$ac_ext >&5 + + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext fi +# Compile in secure mode? + +# Check whether --with-secure was given. +if test "${with_secure+set}" = set; then + withval=$with_secure; cat >>confdefs.h <<\_ACEOF +#define SECURE_COMPILE 1 +_ACEOF + +else + cat >>confdefs.h <<\_ACEOF +#define SECURE_COMPILE 0 +_ACEOF + +fi + + # Checks for regular expression functions. have_regex=no have_posix_regex=unknown -echo "$as_me:$LINENO: checking for regcomp" >&5 -echo $ECHO_N "checking for regcomp... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for regcomp" >&5 +echo $ECHO_N "checking for regcomp... $ECHO_C" >&6; } +# Select a regular expression library. WANT_REGEX=auto -# Check whether --with-regex or --without-regex was given. +# Check whether --with-regex was given. if test "${with_regex+set}" = set; then - withval="$with_regex" - WANT_REGEX="$withval" -fi; + withval=$with_regex; WANT_REGEX="$withval" +fi + if test $have_regex = no; then if test $WANT_REGEX = auto -o $WANT_REGEX = posix; then @@ -5079,8 +6948,11 @@ if test "$cross_compiling" = yes; then have_posix_regex=unknown else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include @@ -5095,13 +6967,22 @@ if (rm.rm_sp != text + 1) exit(1); /* check for correct offset */ exit(0); } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 + { (case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then @@ -5109,15 +6990,18 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + ( exit $ac_status ) have_posix_regex=no fi -rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi + + if test $have_posix_regex = yes; then - echo "$as_me:$LINENO: result: using POSIX regcomp" >&5 -echo "${ECHO_T}using POSIX regcomp" >&6 + { echo "$as_me:$LINENO: result: using POSIX regcomp" >&5 +echo "${ECHO_T}using POSIX regcomp" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_POSIX_REGCOMP 1 _ACEOF @@ -5125,8 +7009,11 @@ _ACEOF have_regex=yes elif test $have_posix_regex = unknown; then cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include #include @@ -5139,89 +7026,111 @@ regex_t *r; regfree(r); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: using POSIX regcomp" >&5 -echo "${ECHO_T}using POSIX regcomp" >&6 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: using POSIX regcomp" >&5 +echo "${ECHO_T}using POSIX regcomp" >&6; } cat >>confdefs.h <<\_ACEOF #define HAVE_POSIX_REGCOMP 1 _ACEOF have_regex=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext else - echo "$as_me:$LINENO: result: no" >&5 -echo "${ECHO_T}no" >&6 + { echo "$as_me:$LINENO: result: no" >&5 +echo "${ECHO_T}no" >&6; } fi fi fi if test $have_regex = no; then if test $WANT_REGEX = auto -o $WANT_REGEX = pcre; then -echo "$as_me:$LINENO: checking for pcre_compile in -lpcre" >&5 -echo $ECHO_N "checking for pcre_compile in -lpcre... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for pcre_compile in -lpcre" >&5 +echo $ECHO_N "checking for pcre_compile in -lpcre... $ECHO_C" >&6; } if test "${ac_cv_lib_pcre_pcre_compile+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpcre $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ -/* Override any gcc2 internal prototype to avoid an error. */ +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 pcre_compile (); int main () { -pcre_compile (); +return pcre_compile (); ; 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_lib_pcre_pcre_compile=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_lib_pcre_pcre_compile=no +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_lib_pcre_pcre_compile=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:$LINENO: result: $ac_cv_lib_pcre_pcre_compile" >&5 -echo "${ECHO_T}$ac_cv_lib_pcre_pcre_compile" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_lib_pcre_pcre_compile" >&5 +echo "${ECHO_T}$ac_cv_lib_pcre_pcre_compile" >&6; } if test $ac_cv_lib_pcre_pcre_compile = yes; then - echo "$as_me:$LINENO: result: using pcre" >&5 -echo "${ECHO_T}using pcre" >&6; cat >>confdefs.h <<\_ACEOF + { echo "$as_me:$LINENO: result: using pcre" >&5 +echo "${ECHO_T}using pcre" >&6; }; cat >>confdefs.h <<\_ACEOF #define HAVE_PCRE 1 _ACEOF LIBS="$LIBS -lpcre" have_regex=yes @@ -5232,67 +7141,90 @@ fi if test $have_regex = no; then if test $WANT_REGEX = auto -o $WANT_REGEX = regcmp; then -echo "$as_me:$LINENO: checking for regcmp" >&5 -echo $ECHO_N "checking for regcmp... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: checking for regcmp" >&5 +echo $ECHO_N "checking for regcmp... $ECHO_C" >&6; } if test "${ac_cv_func_regcmp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define regcmp to an innocuous variant, in case declares regcmp. + For example, HP-UX 11i declares gettimeofday. */ +#define regcmp innocuous_regcmp + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char regcmp (); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ + which can conflict with char regcmp (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef regcmp + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 (); -char (*f) (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_regcmp || defined __stub___regcmp +choke me +#endif int main () { -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_regcmp) || defined (__stub___regcmp) -choke me -#else -f = regcmp; -#endif - +return 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_func_regcmp=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_func_regcmp=no +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_regcmp=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_func_regcmp" >&5 -echo "${ECHO_T}$ac_cv_func_regcmp" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_func_regcmp" >&5 +echo "${ECHO_T}$ac_cv_func_regcmp" >&6; } if test $ac_cv_func_regcmp = yes; then - echo "$as_me:$LINENO: result: using regcmp" >&5 -echo "${ECHO_T}using regcmp" >&6; cat >>confdefs.h <<\_ACEOF + { echo "$as_me:$LINENO: result: using regcmp" >&5 +echo "${ECHO_T}using regcmp" >&6; }; cat >>confdefs.h <<\_ACEOF #define HAVE_REGCMP 1 _ACEOF have_regex=yes @@ -5304,8 +7236,11 @@ fi if test $have_regex = no; then if test $WANT_REGEX = auto -o $WANT_REGEX = regcomp; then cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ #include "regexp.h" int @@ -5317,34 +7252,44 @@ regcomp(""); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - echo "$as_me:$LINENO: result: using V8 regcomp" >&5 -echo "${ECHO_T}using V8 regcomp" >&6; cat >>confdefs.h <<\_ACEOF + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + { echo "$as_me:$LINENO: result: using V8 regcomp" >&5 +echo "${ECHO_T}using V8 regcomp" >&6; }; cat >>confdefs.h <<\_ACEOF #define HAVE_V8_REGCOMP 1 _ACEOF have_regex=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext fi fi if test $have_regex = no && test -f ${srcdir}/regexp.c; then if test $WANT_REGEX = auto -o $WANT_REGEX = regcomp-local; then -echo "$as_me:$LINENO: result: using V8 regcomp -- local source" >&5 -echo "${ECHO_T}using V8 regcomp -- local source" >&6; cat >>confdefs.h <<\_ACEOF +{ echo "$as_me:$LINENO: result: using V8 regcomp -- local source" >&5 +echo "${ECHO_T}using V8 regcomp -- local source" >&6; }; cat >>confdefs.h <<\_ACEOF #define HAVE_V8_REGCOMP 1 _ACEOF cat >>confdefs.h <<\_ACEOF @@ -5356,65 +7301,88 @@ fi if test $have_regex = no; then if test $WANT_REGEX = auto -o $WANT_REGEX = re_comp; then -echo "$as_me:$LINENO: result: using re_comp" >&5 -echo "${ECHO_T}using re_comp" >&6; echo "$as_me:$LINENO: checking for re_comp" >&5 -echo $ECHO_N "checking for re_comp... $ECHO_C" >&6 +{ echo "$as_me:$LINENO: result: using re_comp" >&5 +echo "${ECHO_T}using re_comp" >&6; }; { echo "$as_me:$LINENO: checking for re_comp" >&5 +echo $ECHO_N "checking for re_comp... $ECHO_C" >&6; } if test "${ac_cv_func_re_comp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line $LINENO "configure" -#include "confdefs.h" +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +/* Define re_comp to an innocuous variant, in case declares re_comp. + For example, HP-UX 11i declares gettimeofday. */ +#define re_comp innocuous_re_comp + /* System header to define __stub macros and hopefully few prototypes, - which can conflict with char re_comp (); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ + which can conflict with char re_comp (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef re_comp + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ #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 re_comp (); -char (*f) (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_re_comp || defined __stub___re_comp +choke me +#endif int main () { -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_re_comp) || defined (__stub___re_comp) -choke me -#else -f = re_comp; -#endif - +return re_comp (); ; 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 +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 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); } && - { 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 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then ac_cv_func_re_comp=yes else echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -ac_cv_func_re_comp=no +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_func_re_comp=no fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:$LINENO: result: $ac_cv_func_re_comp" >&5 -echo "${ECHO_T}$ac_cv_func_re_comp" >&6 +{ echo "$as_me:$LINENO: result: $ac_cv_func_re_comp" >&5 +echo "${ECHO_T}$ac_cv_func_re_comp" >&6; } if test $ac_cv_func_re_comp = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_RE_COMP 1 @@ -5426,18 +7394,17 @@ fi fi if test $have_regex = no; then -echo "$as_me:$LINENO: result: cannot find regular expression library" >&5 -echo "${ECHO_T}cannot find regular expression library" >&6; cat >>confdefs.h <<\_ACEOF +{ echo "$as_me:$LINENO: result: cannot find regular expression library" >&5 +echo "${ECHO_T}cannot find regular expression library" >&6; }; cat >>confdefs.h <<\_ACEOF #define NO_REGEX 1 _ACEOF fi -# Check whether --with-editor or --without-editor was given. +# Check whether --with-editor was given. if test "${with_editor+set}" = set; then - withval="$with_editor" - cat >>confdefs.h <<_ACEOF + withval=$with_editor; cat >>confdefs.h <<_ACEOF #define EDIT_PGM "$withval" _ACEOF @@ -5446,12 +7413,13 @@ else #define EDIT_PGM "vi" _ACEOF -fi; +fi - ac_config_files="$ac_config_files Makefile" + +ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -5471,39 +7439,58 @@ _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. -# So, don't put newlines in cache variables' values. +# So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. -{ +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 +echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + *) $as_unset $ac_var ;; + esac ;; + esac + done + (set) 2>&1 | - case `(ac_space=' '; set | grep ac_space) 2>&1` in - *ac_space=\ *) + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n \ - "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; - esac; -} | + esac | + sort +) | sed ' + /^ac_cv_env_/b end t clear - : clear + :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end - /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - : end' >>confcache -if cmp -s $cache_file confcache; then :; else - if test -w $cache_file; then - test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { echo "$as_me:$LINENO: updating cache $cache_file" >&5 +echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else - echo "not updating unwritable cache $cache_file" + { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 +echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache @@ -5512,32 +7499,18 @@ test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' -# VPATH may cause trouble with some makes, so we remove $(srcdir), -# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=/{ -s/:*\$(srcdir):*/:/; -s/:*\${srcdir}:*/:/; -s/:*@srcdir@:*/:/; -s/^\([^=]*=[ ]*\):*/\1/; -s/:*$//; -s/^[^=]*=[ ]*$//; -}' -fi - DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. - ac_i=`echo "$ac_i" | - sed 's/\$U\././;s/\.o$//;s/\.obj$//'` - # 2. Add them. - ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" - ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" + ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs @@ -5558,6 +7531,8 @@ cat >$CONFIG_STATUS <<_ACEOF # configure, is in config.log if it exists. debug=false +ac_cs_recheck=false +ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF @@ -5566,69 +7541,26 @@ cat >>$CONFIG_STATUS <<\_ACEOF ## M4sh Initialization. ## ## --------------------- ## -# Be Bourne compatible +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh 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 + setopt NO_GLOB_SUBST else - as_unset=false + case `(set -o) 2>/dev/null` in + *posix*) set -o posix ;; +esac + 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. +# PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' @@ -5638,178 +7570,255 @@ 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 + echo "#! /bin/sh" >conf$$.sh + echo "exit 0" >>conf$$.sh + chmod +x conf$$.sh + if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi - rm -f conftest.sh + rm -f conf$$.sh +fi + +# Support unset when possible. +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false 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 +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +as_nl=' +' +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +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 +IFS=$as_save_IFS - ;; - esac - # We did not find ourselves, most probably we were run as `sh COMMAND' - # in which case we are not to be found in the path. - if test "x$as_myself" = x; then - as_myself=$0 - fi - if test ! -f "$as_myself"; then - { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 -echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} - { (exit 1); exit 1; }; } - fi - case $CONFIG_SHELL in - '') - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH + ;; +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_myself: error: cannot find myself; rerun with an absolute file name" >&2 + { (exit 1); exit 1; } +fi + +# Work around bugs in pre-3.0 UWIN ksh. +for as_var in ENV MAIL MAILPATH +do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +for as_var in \ + LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ + LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ + LC_TELEPHONE LC_TIME do - 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 ' + if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then + eval $as_var=C; export $as_var + else + ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var + fi +done + +# Required to use basename. +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; 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'` + +# CDPATH. +$as_unset CDPATH + + + 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 + test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # 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. + # line-number line after each line using $LINENO; the second 'sed' + # does the real work. The second script uses 'N' to pair each + # line-number line with the line containing $LINENO, 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 | + # scripts with optimization help from Paolo Bonzini. Blame Lee + # E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno N - s,$,-, - : loop - s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop - s,-$,, - s,^['$as_cr_digits']*\n,, + s/-\n.*// ' >$as_me.lineno && - chmod +x $as_me.lineno || - { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 -echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} + 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 + # original and so on. Autoconf is especially sensitive 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= ;; +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in +-n*) + case `echo 'x\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + *) ECHO_C='\c';; + esac;; +*) + ECHO_N='-n';; esac -if expr a : '\(a\)' >/dev/null 2>&1; then +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir +fi 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='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || 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 +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else + test -d ./-p && rmdir ./-p as_mkdir_p=false fi -as_executable_p="test -f" +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # 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" +as_tr_cpp="eval 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" +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" -# IFS -# We need space, tab and new line, in precisely that order. -as_nl=' -' -IFS=" $as_nl" - -# CDPATH. -$as_unset CDPATH - exec 6>&1 -# Open the log real soon, to keep \$[0] and so on meaningful, and to +# Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. Logging --version etc. is OK. -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX -} >&5 -cat >&5 <<_CSEOF - +# values after options handling. +ac_log=" This file was extended by less $as_me 1, which was -generated by GNU Autoconf 2.54. Invocation command line was +generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -5817,30 +7826,19 @@ generated by GNU Autoconf 2.54. Invocation command line was CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ -_CSEOF -echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 -echo >&5 +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + _ACEOF +cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. -if test -n "$ac_config_files"; then - echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS -fi +config_files="$ac_config_files" +config_headers="$ac_config_headers" -if test -n "$ac_config_headers"; then - echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_links"; then - echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS -fi - -if test -n "$ac_config_commands"; then - echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS -fi +_ACEOF cat >>$CONFIG_STATUS <<\_ACEOF - ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. @@ -5848,13 +7846,14 @@ current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit - -V, --version print version number, then exit + -V, --version print version number and configuration settings, then exit + -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] - instantiate the configuration file FILE + instantiate the configuration file FILE --header=FILE[:TEMPLATE] - instantiate the configuration header FILE + instantiate the configuration header FILE Configuration files: $config_files @@ -5863,20 +7862,21 @@ Configuration headers: $config_headers Report bugs to ." -_ACEOF +_ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ less config.status 1 -configured by $0, generated by GNU Autoconf 2.54, - with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" +configured by $0, generated by GNU Autoconf 2.61, + with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" -Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 -Free Software Foundation, Inc. +Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." -srcdir=$srcdir -INSTALL="$INSTALL" + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF @@ -5887,42 +7887,24 @@ while test $# != 0 do case $1 in --*=*) - ac_option=`expr "x$1" : 'x\([^=]*\)='` - ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; - -*) + *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; - *) # This is not an option, so the user has probably given explicit - # arguments. - ac_option=$1 - ac_need_defaults=false;; esac case $ac_option in # Handling of the options. -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion" - exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;; -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF - --version | --vers* | -V ) - echo "$ac_cs_version"; exit 0 ;; - --he | --h) - # Conflict between --help and --header - { { echo "$as_me:$LINENO: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: ambiguous option: $1 -Try \`$0 --help' for more information." >&2;} - { (exit 1); exit 1; }; };; - --help | --hel | -h ) - echo "$ac_cs_usage"; exit 0 ;; - --debug | --d* | -d ) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + echo "$ac_cs_version"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift @@ -5932,39 +7914,76 @@ Try \`$0 --help' for more information." >&2;} $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + { echo "$as_me: error: ambiguous option: $1 +Try \`$0 --help' for more information." >&2 + { (exit 1); exit 1; }; };; + --help | --hel | -h ) + echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; # This is an error. - -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&5 -echo "$as_me: error: unrecognized option: $1 -Try \`$0 --help' for more information." >&2;} + -*) { echo "$as_me: error: unrecognized option: $1 +Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; - *) ac_config_targets="$ac_config_targets $1" ;; + *) ac_config_targets="$ac_config_targets $1" + ac_need_defaults=false ;; esac shift done +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF +if \$ac_cs_recheck; then + echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 + CONFIG_SHELL=$SHELL + export CONFIG_SHELL + exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF _ACEOF - - - - cat >>$CONFIG_STATUS <<\_ACEOF + +# Handling of arguments. for ac_config_target in $ac_config_targets do - case "$ac_config_target" in - # Handling of arguments. - "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "defines.h" ) CONFIG_HEADERS="$CONFIG_HEADERS defines.h" ;; + case $ac_config_target in + "defines.h") CONFIG_HEADERS="$CONFIG_HEADERS defines.h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done + # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely @@ -5974,264 +7993,368 @@ if $ac_need_defaults; then test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi -# Create a temporary directory, and hook for its removal unless debugging. +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. $debug || { - trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } - # Create a (secure) tmp directory for tmp files. -: ${TMPDIR=/tmp} + { - tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { - tmp=$TMPDIR/cs$$-$RANDOM - (umask 077 && mkdir $tmp) + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") } || { - echo "$me: cannot create a temporary directory in $TMPDIR" >&2 + echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } -_ACEOF - -cat >>$CONFIG_STATUS <<_ACEOF - # -# CONFIG_FILES section. +# Set up the sed scripts for CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h -if test -n "\$CONFIG_FILES"; then - # Protect against being on the right side of a sed subst in config.status. - sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; - s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF -s,@SHELL@,$SHELL,;t t -s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t -s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t -s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t -s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t -s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t -s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t -s,@exec_prefix@,$exec_prefix,;t t -s,@prefix@,$prefix,;t t -s,@program_transform_name@,$program_transform_name,;t t -s,@bindir@,$bindir,;t t -s,@sbindir@,$sbindir,;t t -s,@libexecdir@,$libexecdir,;t t -s,@datadir@,$datadir,;t t -s,@sysconfdir@,$sysconfdir,;t t -s,@sharedstatedir@,$sharedstatedir,;t t -s,@localstatedir@,$localstatedir,;t t -s,@libdir@,$libdir,;t t -s,@includedir@,$includedir,;t t -s,@oldincludedir@,$oldincludedir,;t t -s,@infodir@,$infodir,;t t -s,@mandir@,$mandir,;t t -s,@build_alias@,$build_alias,;t t -s,@host_alias@,$host_alias,;t t -s,@target_alias@,$target_alias,;t t -s,@DEFS@,$DEFS,;t t -s,@ECHO_C@,$ECHO_C,;t t -s,@ECHO_N@,$ECHO_N,;t t -s,@ECHO_T@,$ECHO_T,;t t -s,@LIBS@,$LIBS,;t t -s,@CC@,$CC,;t t -s,@CFLAGS@,$CFLAGS,;t t -s,@LDFLAGS@,$LDFLAGS,;t t -s,@CPPFLAGS@,$CPPFLAGS,;t t -s,@ac_ct_CC@,$ac_ct_CC,;t t -s,@EXEEXT@,$EXEEXT,;t t -s,@OBJEXT@,$OBJEXT,;t t -s,@CPP@,$CPP,;t t -s,@EGREP@,$EGREP,;t t -s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t -s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t -s,@INSTALL_DATA@,$INSTALL_DATA,;t t -s,@REGEX_O@,$REGEX_O,;t t -s,@LIBOBJS@,$LIBOBJS,;t t -s,@LTLIBOBJS@,$LTLIBOBJS,;t t -CEOF +if test -n "$CONFIG_FILES"; then _ACEOF - cat >>$CONFIG_STATUS <<\_ACEOF - # Split the substitutions into bite-sized pieces for seds with - # small command number limits, like on Digital OSF/1 and HP-UX. - ac_max_sed_lines=48 - ac_sed_frag=1 # Number of current file. - ac_beg=1 # First line for current file. - ac_end=$ac_max_sed_lines # Line after last line for current file. - ac_more_lines=: - ac_sed_cmds= - while $ac_more_lines; do - if test $ac_beg -gt 1; then - sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - else - sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag - fi - if test ! -s $tmp/subs.frag; then - ac_more_lines=false - else - # The purpose of the label and of the branching condition is to - # speed up the sed processing (if there are no `@' at all, there - # is no need to browse any of the substitutions). - # These are the two extra sed commands mentioned above. - (echo ':t - /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed - if test -z "$ac_sed_cmds"; then - ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" - else - ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" - fi - ac_sed_frag=`expr $ac_sed_frag + 1` - ac_beg=$ac_end - ac_end=`expr $ac_end + $ac_max_sed_lines` - fi - done - if test -z "$ac_sed_cmds"; then - ac_sed_cmds=cat - fi -fi # test -n "$CONFIG_FILES" + +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + cat >conf$$subs.sed <<_ACEOF +SHELL!$SHELL$ac_delim +PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim +PACKAGE_NAME!$PACKAGE_NAME$ac_delim +PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim +PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim +PACKAGE_STRING!$PACKAGE_STRING$ac_delim +PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim +exec_prefix!$exec_prefix$ac_delim +prefix!$prefix$ac_delim +program_transform_name!$program_transform_name$ac_delim +bindir!$bindir$ac_delim +sbindir!$sbindir$ac_delim +libexecdir!$libexecdir$ac_delim +datarootdir!$datarootdir$ac_delim +datadir!$datadir$ac_delim +sysconfdir!$sysconfdir$ac_delim +sharedstatedir!$sharedstatedir$ac_delim +localstatedir!$localstatedir$ac_delim +includedir!$includedir$ac_delim +oldincludedir!$oldincludedir$ac_delim +docdir!$docdir$ac_delim +infodir!$infodir$ac_delim +htmldir!$htmldir$ac_delim +dvidir!$dvidir$ac_delim +pdfdir!$pdfdir$ac_delim +psdir!$psdir$ac_delim +libdir!$libdir$ac_delim +localedir!$localedir$ac_delim +mandir!$mandir$ac_delim +DEFS!$DEFS$ac_delim +ECHO_C!$ECHO_C$ac_delim +ECHO_N!$ECHO_N$ac_delim +ECHO_T!$ECHO_T$ac_delim +LIBS!$LIBS$ac_delim +build_alias!$build_alias$ac_delim +host_alias!$host_alias$ac_delim +target_alias!$target_alias$ac_delim +CC!$CC$ac_delim +CFLAGS!$CFLAGS$ac_delim +LDFLAGS!$LDFLAGS$ac_delim +CPPFLAGS!$CPPFLAGS$ac_delim +ac_ct_CC!$ac_ct_CC$ac_delim +EXEEXT!$EXEEXT$ac_delim +OBJEXT!$OBJEXT$ac_delim +CPP!$CPP$ac_delim +GREP!$GREP$ac_delim +EGREP!$EGREP$ac_delim +INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim +INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim +INSTALL_DATA!$INSTALL_DATA$ac_delim +REGEX_O!$REGEX_O$ac_delim +LIBOBJS!$LIBOBJS$ac_delim +LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF -for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". - case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; - esac - # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 53; then + break + elif $ac_last_try; then + { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 +echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} + { (exit 1); exit 1; }; } else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done - 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= +ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` +if test -n "$ac_eof"; then + ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` + ac_eof=`expr $ac_eof + 1` 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` +cat >>$CONFIG_STATUS <<_ACEOF +cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end +_ACEOF +sed ' +s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g +s/^/s,@/; s/!/@,|#_!!_#|/ +:n +t n +s/'"$ac_delim"'$/,g/; t +s/$/\\/; p +N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n +' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF +:end +s/|#_!!_#|//g +CEOF$ac_eof +_ACEOF +# VPATH may cause trouble with some makes, so we remove $(srcdir), +# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=/{ +s/:*\$(srcdir):*/:/ +s/:*\${srcdir}:*/:/ +s/:*@srcdir@:*/:/ +s/^\([^=]*=[ ]*\):*/\1/ +s/:*$// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF +fi # test -n "$CONFIG_FILES" + + +for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 +echo "$as_me: error: Invalid tag $ac_tag." >&2;} + { (exit 1); exit 1; }; };; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 +echo "$as_me: error: cannot find input file: $ac_f" >&2;} + { (exit 1); exit 1; }; };; + esac + ac_file_inputs="$ac_file_inputs $ac_f" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input="Generated from "`IFS=: + echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { echo "$as_me:$LINENO: creating $ac_file" >&5 +echo "$as_me: creating $ac_file" >&6;} + fi + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin";; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + { as_dir="$ac_dir" + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 +echo "$as_me: error: cannot create directory $as_dir" >&2;} + { (exit 1); exit 1; }; }; } + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_builddir$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac - - if test x"$ac_file" != x-; then - { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - rm -f "$ac_file" - fi - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - configure_input= - else - configure_input="$ac_file. " - fi - configure_input=$configure_input"Generated from `echo $ac_file_in | - sed 's,.*/,,'` by configure." - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo $f;; - *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } _ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= + +case `sed -n '/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p +' $ac_file_inputs` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub @@ -6239,251 +8362,137 @@ _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s,@configure_input@,$configure_input,;t t -s,@srcdir@,$ac_srcdir,;t t -s,@abs_srcdir@,$ac_abs_srcdir,;t t -s,@top_srcdir@,$ac_top_srcdir,;t t -s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t -s,@builddir@,$ac_builddir,;t t -s,@abs_builddir@,$ac_abs_builddir,;t t -s,@top_builddir@,$ac_top_builddir,;t t -s,@abs_top_builddir@,$ac_abs_top_builddir,;t t -s,@INSTALL@,$ac_INSTALL,;t t -" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out - rm -f $tmp/stdin - if test x"$ac_file" != x-; then - mv $tmp/out $ac_file - else - cat $tmp/out - rm -f $tmp/out - fi +s&@configure_input@&$configure_input&;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" $ac_file_inputs | sed -f "$tmp/subs-1.sed" >$tmp/out -done -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&5 +echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined." >&2;} -# -# CONFIG_HEADER section. -# - -# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where -# NAME is the cpp macro being defined and VALUE is the value it is being given. -# -# ac_d sets the value in "#define NAME VALUE" lines. -ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' -ac_dB='[ ].*$,\1#\2' -ac_dC=' ' -ac_dD=',;t' -# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". -ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' -ac_uB='$,\1#\2define\3' -ac_uC=' ' -ac_uD=',;t' - -for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue - # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + rm -f "$tmp/stdin" case $ac_file in - - | *:- | *:-:* ) # input from stdin - cat >$tmp/stdin - ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` - ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; - * ) ac_file_in=$ac_file.in ;; + -) cat "$tmp/out"; rm -f "$tmp/out";; + *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac - - test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 -echo "$as_me: creating $ac_file" >&6;} - - # First look for the input files in the build tree, otherwise in the - # src tree. - ac_file_inputs=`IFS=: - for f in $ac_file_in; do - case $f in - -) echo $tmp/stdin ;; - [\\/$]*) - # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - echo $f;; - *) # Relative - if test -f "$f"; then - # Build tree - echo $f - elif test -f "$srcdir/$f"; then - # Source tree - echo $srcdir/$f - else - # /dev/null tree - { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 -echo "$as_me: error: cannot find input file: $f" >&2;} - { (exit 1); exit 1; }; } - fi;; - esac - done` || { (exit 1); exit 1; } - # Remove the trailing spaces. - sed 's/[ ]*$//' $ac_file_inputs >$tmp/in - + ;; + :H) + # + # CONFIG_HEADER + # _ACEOF -# Transform confdefs.h into two sed scripts, `conftest.defines' and -# `conftest.undefs', that substitutes the proper values into -# config.h.in to produce config.h. The first handles `#define' -# templates, and the second `#undef' templates. -# And first: Protect against being on the right side of a sed subst in -# config.status. Protect against being in an unquoted here document -# in config.status. -rm -f conftest.defines conftest.undefs -# Using a here document instead of a string reduces the quoting nightmare. -# Putting comments in sed scripts is not portable. -# -# `end' is used to avoid that the second main sed command (meant for -# 0-ary CPP macros) applies to n-ary macro definitions. -# See the Autoconf documentation for `clear'. -cat >confdef2sed.sed <<\_ACEOF -s/[\\&,]/\\&/g -s,[\\$`],\\&,g -t clear -: clear -s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp -t end -s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp -: end -_ACEOF -# If some macros were called several times there might be several times -# the same #defines, which is useless. Nevertheless, we may not want to -# sort them, since we want the *last* AC-DEFINE to be honored. -uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines -sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs -rm -f confdef2sed.sed +# Transform confdefs.h into a sed script `conftest.defines', that +# substitutes the proper values into config.h.in to produce config.h. +rm -f conftest.defines conftest.tail +# First, append a space to every undef/define line, to ease matching. +echo 's/$/ /' >conftest.defines +# Then, protect against being on the right side of a sed subst, or in +# an unquoted here document, in config.status. If some macros were +# called several times there might be several #defines for the same +# symbol, which is useless. But do not sort them, since the last +# AC_DEFINE must be honored. +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where +# NAME is the cpp macro being defined, VALUE is the value it is being given. +# PARAMS is the parameter list in the macro definition--in most cases, it's +# just an empty string. +ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*' +ac_dB='\\)[ (].*,\\1define\\2' +ac_dC=' ' +ac_dD=' ,' -# This sed command replaces #undef with comments. This is necessary, for +uniq confdefs.h | + sed -n ' + t rset + :rset + s/^[ ]*#[ ]*define[ ][ ]*// + t ok + d + :ok + s/[\\&,]/\\&/g + s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p + s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p + ' >>conftest.defines + +# Remove the space that was appended to ease matching. +# Then replace #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. -cat >>conftest.undefs <<\_ACEOF -s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, -_ACEOF +# (The regexp can be short, since the line contains either #define or #undef.) +echo 's/ $// +s,^[ #]*u.*,/* & */,' >>conftest.defines -# Break up conftest.defines because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS -echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS -echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS -echo ' :' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.defines >/dev/null +# Break up conftest.defines: +ac_max_sed_lines=50 + +# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1" +# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2" +# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1" +# et cetera. +ac_in='$ac_file_inputs' +ac_out='"$tmp/out1"' +ac_nxt='"$tmp/out2"' + +while : do - # Write a limited-size here document to $tmp/defines.sed. - echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#define' lines. - echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS + # Write a here document: + cat >>$CONFIG_STATUS <<_ACEOF + # First, check the format of the line: + cat >"\$tmp/defines.sed" <<\\CEOF +/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def +/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def +b +:def +_ACEOF + sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF - sed -f $tmp/defines.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail + sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS + ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in + sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail + grep . conftest.tail >/dev/null || break rm -f conftest.defines mv conftest.tail conftest.defines done -rm -f conftest.defines -echo ' fi # grep' >>$CONFIG_STATUS -echo >>$CONFIG_STATUS - -# Break up conftest.undefs because some shells have a limit on the size -# of here documents, and old seds have small limits too (100 cmds). -echo ' # Handle all the #undef templates' >>$CONFIG_STATUS -rm -f conftest.tail -while grep . conftest.undefs >/dev/null -do - # Write a limited-size here document to $tmp/undefs.sed. - echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS - # Speed up: don't consider the non `#undef' - echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS - # Work around the forget-to-reset-the-flag bug. - echo 't clr' >>$CONFIG_STATUS - echo ': clr' >>$CONFIG_STATUS - sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS - echo 'CEOF - sed -f $tmp/undefs.sed $tmp/in >$tmp/out - rm -f $tmp/in - mv $tmp/out $tmp/in -' >>$CONFIG_STATUS - sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail - rm -f conftest.undefs - mv conftest.tail conftest.undefs -done -rm -f conftest.undefs +rm -f conftest.defines conftest.tail +echo "ac_result=$ac_in" >>$CONFIG_STATUS cat >>$CONFIG_STATUS <<\_ACEOF - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - if test x"$ac_file" = x-; then - echo "/* Generated by configure. */" >$tmp/config.h - else - echo "/* $ac_file. Generated by configure. */" >$tmp/config.h - fi - cat $tmp/in >>$tmp/config.h - rm -f $tmp/in if test x"$ac_file" != x-; then - if cmp -s $ac_file $tmp/config.h 2>/dev/null; then + echo "/* $configure_input */" >"$tmp/config.h" + cat "$ac_result" >>"$tmp/config.h" + if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else - ac_dir=`(dirname "$ac_file") 2>/dev/null || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - { if $as_mkdir_p; then - mkdir -p "$ac_dir" - else - as_dir="$ac_dir" - as_dirs= - while test ! -d "$as_dir"; do - as_dirs="$as_dir $as_dirs" - as_dir=`(dirname "$as_dir") 2>/dev/null || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| \ - . : '\(.\)' 2>/dev/null || -echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } - /^X\(\/\/\)[^/].*/{ s//\1/; q; } - /^X\(\/\/\)$/{ s//\1/; q; } - /^X\(\/\).*/{ s//\1/; q; } - s/.*/./; q'` - done - test ! -n "$as_dirs" || mkdir $as_dirs - fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 -echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} - { (exit 1); exit 1; }; }; } - rm -f $ac_file - mv $tmp/config.h $ac_file + mv "$tmp/config.h" $ac_file fi else - cat $tmp/config.h - rm -f $tmp/config.h + echo "/* $configure_input */" + cat "$ac_result" fi -done -_ACEOF + rm -f "$tmp/out12" + ;; + + + esac + +done # for ac_tag -cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF @@ -6501,8 +8510,11 @@ ac_clean_files=$ac_clean_files_save # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null - $SHELL $CONFIG_STATUS || ac_cs_success=false + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. diff --git a/src/bin/less/configure.ac b/src/bin/less/configure.ac index d9e6ccab6e..72d3407291 100644 --- a/src/bin/less/configure.ac +++ b/src/bin/less/configure.ac @@ -1,6 +1,6 @@ # Process this file with autoconf to produce a configure script. -# Copyright (C) 1984-2002 Mark Nudelman +# Copyright (C) 1984-2007 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. @@ -23,7 +23,9 @@ AC_PROG_INSTALL AC_SYS_LARGEFILE # Checks for general libraries. +AC_CHECK_LIB(tinfo, tgoto, [have_tinfo=yes], [have_tinfo=no]) AC_CHECK_LIB(xcurses, initscr, [have_xcurses=yes], [have_xcurses=no]) +AC_CHECK_LIB(ncursesw, initscr, [have_ncursesw=yes], [have_ncursesw=no]) AC_CHECK_LIB(ncurses, initscr, [have_ncurses=yes], [have_ncurses=no]) AC_CHECK_LIB(curses, initscr, [have_curses=yes], [have_curses=no]) AC_CHECK_LIB(termcap, tgetent, [have_termcap=yes], [have_termcap=no]) @@ -50,6 +52,20 @@ fi fi if test $curses_broken = 0; then + +# -- Try tinfo. +if test "x$TERMLIBS" = x; then + if test $have_tinfo = yes; then + TERMLIBS="-ltinfo" + SAVE_LIBS=$LIBS + LIBS="$LIBS $TERMLIBS" + AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);], + [termok=yes], [termok=no]) + LIBS=$SAVE_LIBS + if test $termok = no; then TERMLIBS=""; fi + fi +fi + # -- Try xcurses. if test "x$TERMLIBS" = x; then if test $have_xcurses = yes; then @@ -63,6 +79,19 @@ if test "x$TERMLIBS" = x; then fi fi +# -- Try ncursesw. +if test "x$TERMLIBS" = x; then + if test $have_ncursesw = yes; then + TERMLIBS="-lncursesw" + SAVE_LIBS=$LIBS + LIBS="$LIBS $TERMLIBS" + AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);], + [termok=yes], [termok=no]) + 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 @@ -140,7 +169,7 @@ LIBS="$LIBS $TERMLIBS" # Checks for header files. AC_HEADER_STDC -AC_CHECK_HEADERS([ctype.h errno.h fcntl.h limits.h stdio.h stdlib.h string.h termcap.h termio.h termios.h time.h unistd.h values.h sys/ioctl.h sys/stream.h sys/ptem.h]) +AC_CHECK_HEADERS([ctype.h errno.h fcntl.h limits.h stdio.h stdlib.h string.h termcap.h termio.h termios.h time.h unistd.h values.h sys/ioctl.h sys/stream.h wctype.h]) # Checks for typedefs, structures, and compiler characteristics. AC_HEADER_STAT @@ -168,6 +197,8 @@ AH_TEMPLATE([HAVE_VOID], [Define HAVE_VOID if your compiler supports the "void" type.]) AH_TEMPLATE([HAVE_CONST], [Define HAVE_CONST if your compiler supports the "const" modifier.]) +AH_TEMPLATE([HAVE_STAT_INO], + [Define HAVE_STAT_INO if your struct stat has st_ino and st_dev.]) AH_TEMPLATE([HAVE_TIME_T], [Define HAVE_TIME_T if your system supports the "time_t" type.]) AH_TEMPLATE([HAVE_STRERROR], @@ -190,12 +221,16 @@ AH_TEMPLATE([HAVE_TERMIOS_FUNCS], [Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr.]) AH_TEMPLATE([HAVE_UPPER_LOWER], [Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower.]) +AH_TEMPLATE([HAVE_WCTYPE], + [Define HAVE_WCTYPE if you have iswupper, iswlower, towupper, towlower.]) AH_TEMPLATE([HAVE_SIGSET_T], [Define HAVE_SIGSET_T you have the sigset_t type.]) AH_TEMPLATE([HAVE_SIGEMPTYSET], [Define HAVE_SIGEMPTYSET if you have the sigemptyset macro.]) AH_TEMPLATE([EDIT_PGM], [Define EDIT_PGM to your editor.]) +AH_TEMPLATE([SECURE_COMPILE], + [Define SECURE_COMPILE=1 to build a secure version of less.]) # Checks for identifiers. AC_TYPE_OFF_T @@ -208,10 +243,37 @@ AC_TRY_COMPILE(, [const int foo = 0;], AC_MSG_CHECKING(for time_t) AC_TRY_COMPILE([#include ], [time_t t = 0;], [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TIME_T)], [AC_MSG_RESULT(no)]) +AC_MSG_CHECKING(for st_ino in struct stat) +AC_TRY_COMPILE([#include +#include ], + [struct stat s; dev_t dev = s.st_dev; ino_t ino = s.st_ino;], + [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STAT_INO)], [AC_MSG_RESULT(no)]) # Checks for library functions. AC_TYPE_SIGNAL -AC_CHECK_FUNCS([fsync memcpy popen _setjmp sigprocmask sigsetmask stat strchr strstr system]) +AC_CHECK_FUNCS([fsync popen _setjmp sigprocmask sigsetmask snprintf stat system fchmod]) + +# AC_CHECK_FUNCS may not work for inline functions, so test these separately. +AC_MSG_CHECKING(for memcpy) +AC_TRY_LINK([ +#if HAVE_STRING_H +#include +#endif], [memcpy(0,0,0);], + [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MEMCPY)], [AC_MSG_RESULT(no)]) + +AC_MSG_CHECKING(for strchr) +AC_TRY_LINK([ +#if HAVE_STRING_H +#include +#endif], [strchr("x",'x');], + [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRCHR)], [AC_MSG_RESULT(no)]) + +AC_MSG_CHECKING(for strstr) +AC_TRY_LINK([ +#if HAVE_STRING_H +#include +#endif], [strstr("x","x");], + [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRSTR)], [AC_MSG_RESULT(no)]) # Some systems have termios.h but not the corresponding functions. AC_CHECK_FUNC(tcgetattr, AC_DEFINE(HAVE_TERMIOS_FUNCS)) @@ -240,11 +302,7 @@ AC_MSG_CHECKING(for sys_errlist) AC_TRY_LINK(, [extern char *sys_errlist[]; static char **x; x = sys_errlist;], [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYS_ERRLIST)], [AC_MSG_RESULT(no)]) -AC_MSG_CHECKING(for sigset_t) -AC_TRY_LINK([ -#include -], [sigset_t s; s = 0;], - [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SIGSET_T)], [AC_MSG_RESULT(no)]) +AC_CHECK_TYPES([sigset_t],,,[#include ]) AC_MSG_CHECKING(for sigemptyset) AC_TRY_LINK([ @@ -270,8 +328,10 @@ fi AC_MSG_CHECKING(for locale) AC_TRY_LINK([#include -#include ], [setlocale(LC_CTYPE,""); isprint(0); iscntrl(0);], +#include +#include ], [setlocale(LC_CTYPE,""); isprint(0); iscntrl(0);], [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_LOCALE)], [AC_MSG_RESULT(no)]) + AC_MSG_CHECKING(for ctype functions) AC_TRY_LINK([ #if HAVE_CTYPE_H @@ -279,6 +339,10 @@ AC_TRY_LINK([ #endif], [static int x; x = isupper(x); x = tolower(x); x = toupper(x);], [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UPPER_LOWER)], [AC_MSG_RESULT(no)]) +AC_MSG_CHECKING(for wctype functions) +AC_TRY_LINK([#include ], [iswlower(0); iswupper(0); towlower(0); towupper(0);], + [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_WCTYPE)], [AC_MSG_RESULT(no)]) + # Checks for external variable ospeed in the termcap library. have_ospeed=no AC_MSG_CHECKING(termcap for ospeed) @@ -297,11 +361,17 @@ AC_TRY_LINK(, [extern short ospeed; ospeed = 0;], [AC_MSG_RESULT(no)]) fi +# Compile in secure mode? +AC_ARG_WITH(secure, + [ --with-secure Compile in secure mode], + AC_DEFINE(SECURE_COMPILE, 1), AC_DEFINE(SECURE_COMPILE, 0)) + # Checks for regular expression functions. have_regex=no have_posix_regex=unknown AC_MSG_CHECKING(for regcomp) +# Select a regular expression library. WANT_REGEX=auto AC_ARG_WITH(regex, [ --with-regex={auto,pcre,posix,regcmp,re_comp,regcomp,regcomp-local} Select a regular expression library [auto]], @@ -401,8 +471,9 @@ AH_TOP([ /* * SECURE is 1 if you wish to disable a bunch of features in order to * be safe to run by unprivileged users. + * SECURE_COMPILE is set by the --with-secure configure option. */ -#define SECURE 0 +#define SECURE SECURE_COMPILE /* * SHELL_ESCAPE is 1 if you wish to allow shell escapes. @@ -488,10 +559,13 @@ AH_TOP([ * LESSKEYFILE_SYS is the filename of the system-wide lesskey output file. * DEF_LESSKEYINFILE is the filename of the default lesskey input * (in the HOME directory). + * LESSHISTFILE is the filename of the history file + * (in the HOME directory). */ #define LESSKEYFILE ".less" #define LESSKEYFILE_SYS SYSDIR "/sysless" #define DEF_LESSKEYINFILE ".lesskey" +#define LESSHISTFILE ".lesshst" /* Settings always true on Unix. */ @@ -506,6 +580,12 @@ AH_TOP([ */ #define PATHNAME_SEP "/" +/* + * The value returned from tgetent on success. + * Some HP-UX systems return 0 on success. + */ +#define TGETENT_OK 1 + /* * HAVE_SYS_TYPES_H is 1 if your system has . */ @@ -535,7 +615,7 @@ AH_TOP([ /* * Default shell metacharacters and meta-escape character. */ -#define DEF_METACHARS "; *?\t\n'\"()<>|&^`#\\" +#define DEF_METACHARS "; *?\t\n'\"()<>[]|&^`#\\$%=~" #define DEF_METAESCAPE "\\" /* @@ -543,6 +623,15 @@ AH_TOP([ */ #define HAVE_DUP 1 +/* Define to 1 if you have the memcpy() function. */ +#define HAVE_MEMCPY 1 + +/* Define to 1 if you have the strchr() function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the strstr() function. */ +#define HAVE_STRSTR 1 + /* * Sizes of various buffers. */ diff --git a/src/bin/less/decode.c b/src/bin/less/decode.c index 1737327855..ac1668fa5a 100644 --- a/src/bin/less/decode.c +++ b/src/bin/less/decode.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -34,7 +34,7 @@ #include "cmd.h" #include "lesskey.h" -extern int erase_char, kill_char; +extern int erase_char, erase2_char, kill_char; extern int secure; #define SK(k) \ @@ -120,6 +120,7 @@ static unsigned char cmdtable[] = '7',0, A_DIGIT, '8',0, A_DIGIT, '9',0, A_DIGIT, + '.',0, A_DIGIT, '=',0, A_STAT, CONTROL('G'),0, A_STAT, @@ -681,7 +682,7 @@ lesskey(filename, sysvar) close(f); return (-1); } - if (lseek(f, (off_t)0, 0) == BAD_LSEEK) + if (lseek(f, (off_t)0, SEEK_SET) == BAD_LSEEK) { free(buf); close(f); @@ -754,7 +755,7 @@ editchar(c, flags) * but give it the edit-commands command table * This table is constructed to match the user's keyboard. */ - if (c == erase_char) + if (c == erase_char || c == erase2_char) return (EC_BACKSPACE); if (c == kill_char) return (EC_LINEKILL); diff --git a/src/bin/less/defines.ds b/src/bin/less/defines.ds index 9445398328..c98dcffc35 100644 --- a/src/bin/less/defines.ds +++ b/src/bin/less/defines.ds @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2000 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -117,10 +117,13 @@ * LESSKEYFILE_SYS is the filename of the system-wide lesskey output file. * DEF_LESSKEYINFILE is the filename of the default lesskey input * (in the HOME directory). + * LESSHISTFILE is the filename of the history file + * (in the HOME directory). */ #define LESSKEYFILE "_less" #define LESSKEYFILE_SYS "c:\\_sysless" #define DEF_LESSKEYINFILE "_lesskey" +#define LESSHISTFILE "_lesshst" /* Settings always true for MS-DOS systems. */ @@ -304,9 +307,15 @@ /* Define if you have the system function. */ #define HAVE_SYSTEM 1 +/* Define if you have the snprintf function. */ +#define HAVE_SNPRINTF 0 + /* Define if you have the header file. */ #define HAVE_CTYPE_H 1 +/* Define if you have the header file. */ +#define HAVE_WCTYPE_H 0 + /* Define if you have the header file. */ #define HAVE_ERRNO_H 1 diff --git a/src/bin/less/defines.h b/src/bin/less/defines.h index 19cec6c631..592fe64efa 100644 --- a/src/bin/less/defines.h +++ b/src/bin/less/defines.h @@ -1,4 +1,4 @@ -/* defines.h. Generated by configure. */ +/* defines.h. Generated from defines.h.in by configure. */ /* defines.h.in. Generated from configure.ac by autoheader. */ @@ -19,8 +19,9 @@ /* * SECURE is 1 if you wish to disable a bunch of features in order to * be safe to run by unprivileged users. + * SECURE_COMPILE is set by the --with-secure configure option. */ -#define SECURE 0 +#define SECURE SECURE_COMPILE /* * SHELL_ESCAPE is 1 if you wish to allow shell escapes. @@ -46,7 +47,7 @@ #define CMD_HISTORY 1 /* - * HILITE_SEARCH is 1 if you wish to have search targets to be + * HILITE_SEARCH is 1 if you wish to have search targets to be * displayed in standout mode. */ #define HILITE_SEARCH 1 @@ -64,7 +65,7 @@ #define TAGS (!SECURE) /* - * USERFILE is 1 if you wish to allow a .less file to specify + * USERFILE is 1 if you wish to allow a .less file to specify * user-defined key bindings. */ #define USERFILE (!SECURE) @@ -101,15 +102,18 @@ #define ONLY_RETURN 0 /* - * LESSKEYFILE is the filename of the default lesskey output file + * LESSKEYFILE is the filename of the default lesskey output file * (in the HOME directory). * LESSKEYFILE_SYS is the filename of the system-wide lesskey output file. - * DEF_LESSKEYINFILE is the filename of the default lesskey input + * DEF_LESSKEYINFILE is the filename of the default lesskey input + * (in the HOME directory). + * LESSHISTFILE is the filename of the history file * (in the HOME directory). */ #define LESSKEYFILE ".less" #define LESSKEYFILE_SYS SYSDIR "/sysless" #define DEF_LESSKEYINFILE ".lesskey" +#define LESSHISTFILE ".lesshst" /* Settings always true on Unix. */ @@ -124,6 +128,12 @@ */ #define PATHNAME_SEP "/" +/* + * The value returned from tgetent on success. + * Some HP-UX systems return 0 on success. + */ +#define TGETENT_OK 1 + /* * HAVE_SYS_TYPES_H is 1 if your system has . */ @@ -153,14 +163,23 @@ /* * Default shell metacharacters and meta-escape character. */ -#define DEF_METACHARS "; *?\t\n'\"()<>|&^`#\\" +#define DEF_METACHARS "; *?\t\n'\"()<>[]|&^`#\\$%=~" #define DEF_METAESCAPE "\\" -/* +/* * HAVE_DUP is 1 if your system has the dup() call. */ #define HAVE_DUP 1 +/* Define to 1 if you have the memcpy() function. */ +#define HAVE_MEMCPY 1 + +/* Define to 1 if you have the strchr() function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the strstr() function. */ +#define HAVE_STRSTR 1 + /* * Sizes of various buffers. */ @@ -192,6 +211,9 @@ /* Define to 1 if you have the header file. */ #define HAVE_ERRNO_H 1 +/* Define to 1 if you have the `fchmod' function. */ +#define HAVE_FCHMOD 1 + /* Define to 1 if you have the header file. */ #define HAVE_FCNTL_H 1 @@ -217,10 +239,7 @@ #define HAVE_LIMITS_H 1 /* Define HAVE_LOCALE if you have locale.h and setlocale. */ -#define HAVE_LOCALE 1 - -/* Define to 1 if you have the `memcpy' function. */ -#define HAVE_MEMCPY 1 +/* #undef HAVE_LOCALE */ /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 @@ -255,12 +274,18 @@ /* Define to 1 if you have the `sigsetmask' function. */ /* #undef HAVE_SIGSETMASK */ -/* Define HAVE_SIGSET_T you have the sigset_t type. */ +/* Define to 1 if the system has the type `sigset_t'. */ #define HAVE_SIGSET_T 1 +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 + /* Define to 1 if you have the `stat' function. */ #define HAVE_STAT 1 +/* Define HAVE_STAT_INO if your struct stat has st_ino and st_dev. */ +#define HAVE_STAT_INO 1 + /* Define to 1 if you have the header file. */ #define HAVE_STDINT_H 1 @@ -270,9 +295,6 @@ /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 -/* Define to 1 if you have the `strchr' function. */ -#define HAVE_STRCHR 1 - /* Define HAVE_STRERROR if you have the strerror() function. */ #define HAVE_STRERROR 1 @@ -282,9 +304,6 @@ /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 -/* Define to 1 if you have the `strstr' function. */ -#define HAVE_STRSTR 1 - /* Define to 1 if you have the `system' function. */ #define HAVE_SYSTEM 1 @@ -294,9 +313,6 @@ /* Define to 1 if you have the header file. */ #define HAVE_SYS_IOCTL_H 1 -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_PTEM_H */ - /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 @@ -339,8 +355,14 @@ /* Define HAVE_VOID if your compiler supports the "void" type. */ #define HAVE_VOID 1 +/* Define HAVE_WCTYPE if you have iswupper, iswlower, towupper, towlower. */ +#define HAVE_WCTYPE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WCTYPE_H 1 + /* Define to 1 if you have the `_setjmp' function. */ -#define HAVE__SETJMP 1 +/* #undef HAVE__SETJMP */ /* Define MUST_DEFINE_ERRNO if you have errno but it is not define in errno.h. */ @@ -371,6 +393,9 @@ /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void +/* Define SECURE_COMPILE=1 to build a secure version of less. */ +#define SECURE_COMPILE 0 + /* Define to 1 if the `S_IS*' macros in do not work properly. */ /* #undef STAT_MACROS_BROKEN */ @@ -389,8 +414,8 @@ /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ -/* Define to `long' if does not define. */ +/* Define to `long int' if does not define. */ /* #undef off_t */ -/* Define to `unsigned' if does not define. */ +/* Define to `unsigned int' if does not define. */ /* #undef size_t */ diff --git a/src/bin/less/defines.o2 b/src/bin/less/defines.o2 index ee1313b6cb..544003809a 100644 --- a/src/bin/less/defines.o2 +++ b/src/bin/less/defines.o2 @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2000 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -110,10 +110,13 @@ * LESSKEYFILE_SYS is the filename of the system-wide lesskey output file. * DEF_LESSKEYINFILE is the filename of the default lesskey input * (in the HOME directory). + * LESSHISTFILE is the filename of the history file + * (in the HOME directory). */ #define LESSKEYFILE "less.ini" #define LESSKEYFILE_SYS "C:\\sysless.ini" #define DEF_LESSKEYINFILE "lesskey.ini" +#define LESSHISTFILE "lesshst.ini" /* Settings always true for the emx compiler for OS/2 systems. */ @@ -270,9 +273,15 @@ /* Define if you have the system function. */ #define HAVE_SYSTEM 1 +/* Define if you have the snprintf function. */ +#define HAVE_SNPRINTF 0 + /* Define if you have the header file. */ #define HAVE_CTYPE_H 1 +/* Define if you have the header file. */ +#define HAVE_WCTYPE_H 0 + /* Define if you have the header file. */ #define HAVE_ERRNO_H 1 diff --git a/src/bin/less/defines.o9 b/src/bin/less/defines.o9 index 553a005e4e..50955ba104 100644 --- a/src/bin/less/defines.o9 +++ b/src/bin/less/defines.o9 @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2000 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -109,10 +109,13 @@ * LESSKEYFILE_SYS is the filename of the system-wide lesskey output file. * DEF_LESSKEYINFILE is the filename of the default lesskey input * (in the HOME directory). + * LESSHISTFILE is the filename of the history file + * (in the HOME directory). */ #define LESSKEYFILE ".less" #define LESSKEYFILE_SYS "/.sysless" #define DEF_LESSKEYINFILE ".lesskey" +#define LESSHISTFILE ".lesshst" /* Settings always true for OS-9. */ @@ -278,9 +281,15 @@ /* Define if you have the system function. */ #define HAVE_SYSTEM 1 +/* Define if you have the snprintf function. */ +#define HAVE_SNPRINTF 0 + /* Define if you have the header file. */ #define HAVE_CTYPE_H 1 +/* Define if you have the header file. */ +#define HAVE_WCTYPE_H 0 + /* Define if you have the header file. */ #define HAVE_ERRNO_H 1 diff --git a/src/bin/less/defines.wn b/src/bin/less/defines.wn index 737af5de07..7c3194c832 100644 --- a/src/bin/less/defines.wn +++ b/src/bin/less/defines.wn @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2000 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -110,10 +110,13 @@ * LESSKEYFILE_SYS is the filename of the system-wide lesskey output file. * DEF_LESSKEYINFILE is the filename of the default lesskey input * (in the HOME directory). + * LESSHISTFILE is the filename of the history file + * (in the HOME directory). */ #define LESSKEYFILE "_less" #define LESSKEYFILE_SYS "c:\\_sysless" #define DEF_LESSKEYINFILE "_lesskey" +#define LESSHISTFILE "_lesshst" /* Settings always true for Windows systems. */ @@ -268,9 +271,15 @@ /* Define if you have the system function. */ #define HAVE_SYSTEM 1 +/* Define if you have the snprintf function. */ +#define HAVE_SNPRINTF 0 + /* Define if you have the header file. */ #define HAVE_CTYPE_H 1 +/* Define if you have the header file. */ +#define HAVE_WCTYPE_H 1 + /* Define if you have the header file. */ #define HAVE_ERRNO_H 1 diff --git a/src/bin/less/edit.c b/src/bin/less/edit.c index 4873c1f212..e2e30f2d7a 100644 --- a/src/bin/less/edit.c +++ b/src/bin/less/edit.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -10,6 +10,9 @@ #include "less.h" +#if HAVE_STAT +#include +#endif public int fd0 = 0; @@ -36,6 +39,11 @@ extern int force_logfile; extern char *namelogfile; #endif +#if HAVE_STAT_INO +public dev_t curr_dev; +public ino_t curr_ino; +#endif + char *curr_altfilename = NULL; static void *curr_altpipe; @@ -178,6 +186,9 @@ close_file() curr_altfilename = NULL; } curr_ifile = NULL_IFILE; +#if HAVE_STAT_INO + curr_ino = curr_dev = 0; +#endif } /* @@ -322,6 +333,14 @@ edit_ifile(ifile) /* * Re-open the current file. */ + if (was_curr_ifile == ifile) + { + /* + * Whoops. The "current" ifile is the one we just deleted. + * Just give up. + */ + quit(QUIT_ERROR); + } reedit_ifile(was_curr_ifile); return (1); } else if ((f = open(qopen_filename, OPEN_READ)) < 0) @@ -352,7 +371,6 @@ edit_ifile(ifile) } } } - free(qopen_filename); /* * Get the new ifile. @@ -376,11 +394,24 @@ edit_ifile(ifile) #if LOGFILE if (namelogfile != NULL && is_tty) use_logfile(namelogfile); +#endif +#if HAVE_STAT_INO + /* Remember the i-number and device of the opened file. */ + { + struct stat statbuf; + int r = stat(qopen_filename, &statbuf); + if (r == 0) + { + curr_ino = statbuf.st_ino; + curr_dev = statbuf.st_dev; + } + } #endif if (every_first_cmd != NULL) ungetsc(every_first_cmd); } + free(qopen_filename); no_display = !any_display; flush(); any_display = TRUE; @@ -498,7 +529,7 @@ edit_last() /* - * Edit the next or previous file in the command line (ifile) list. + * Edit the n-th next or previous file in the command line (ifile) list. */ static int edit_istep(h, n, dir) @@ -547,14 +578,14 @@ edit_inext(h, n) IFILE h; int n; { - return (edit_istep(h, n, 1)); + return (edit_istep(h, n, +1)); } public int edit_next(n) int n; { - return edit_istep(curr_ifile, n, 1); + return edit_istep(curr_ifile, n, +1); } static int @@ -649,6 +680,14 @@ reedit_ifile(save_ifile) quit(QUIT_ERROR); } + public void +reopen_curr_ifile() +{ + IFILE save_ifile = save_curr_ifile(); + close_file(); + reedit_ifile(save_ifile); +} + /* * Edit standard input. */ @@ -739,7 +778,7 @@ loop: * Append: open the file and seek to the end. */ logfile = open(filename, OPEN_APPEND); - if (lseek(logfile, (off_t)0, 2) == BAD_LSEEK) + if (lseek(logfile, (off_t)0, SEEK_END) == BAD_LSEEK) { close(logfile); logfile = -1; diff --git a/src/bin/less/filename.c b/src/bin/less/filename.c index 0b56bdc13d..b1351fd65d 100644 --- a/src/bin/less/filename.c +++ b/src/bin/less/filename.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -51,6 +51,8 @@ extern int force_open; extern int secure; extern int use_lessopen; +extern int ctldisp; +extern int utf_mode; extern IFILE curr_ifile; extern IFILE old_ifile; #if SPACES_IN_FILENAMES @@ -195,7 +197,7 @@ shell_quote(s) newstr = p = (char *) ecalloc(len, sizeof(char)); if (use_quotes) { - sprintf(newstr, "%c%s%c", openquote, s, closequote); + SNPRINTF3(newstr, len, "%c%s%c", openquote, s, closequote); } else { while (*s != '\0') @@ -226,6 +228,7 @@ dirfile(dirname, filename) { char *pathname; char *qpathname; + int len; int f; if (dirname == NULL || *dirname == '\0') @@ -233,11 +236,11 @@ dirfile(dirname, filename) /* * Construct the full pathname. */ - pathname = (char *) calloc(strlen(dirname) + strlen(filename) + 2, - sizeof(char)); + len= strlen(dirname) + strlen(filename) + 2; + pathname = (char *) calloc(len, sizeof(char)); if (pathname == NULL) return (NULL); - sprintf(pathname, "%s%s%s", dirname, PATHNAME_SEP, filename); + SNPRINTF3(pathname, len, "%s%s%s", dirname, PATHNAME_SEP, filename); /* * Make sure the file exists. */ @@ -425,18 +428,23 @@ fcomplete(s) */ { char *slash; + int len; for (slash = s+strlen(s)-1; slash > s; slash--) if (*slash == *PATHNAME_SEP || *slash == '/') break; - fpat = (char *) ecalloc(strlen(s)+4, sizeof(char)); + len = strlen(s) + 4; + fpat = (char *) ecalloc(len, sizeof(char)); if (strchr(slash, '.') == NULL) - sprintf(fpat, "%s*.*", s); + SNPRINTF1(fpat, len, "%s*.*", s); else - sprintf(fpat, "%s*", s); + SNPRINTF1(fpat, len, "%s*", s); } #else - fpat = (char *) ecalloc(strlen(s)+2, sizeof(char)); - sprintf(fpat, "%s*", s); + { + int len = strlen(s) + 2; + fpat = (char *) ecalloc(len, sizeof(char)); + SNPRINTF1(fpat, len, "%s*", s); + } #endif qs = lglob(fpat); s = shell_unquote(qs); @@ -464,17 +472,29 @@ bin_file(f) { int i; int n; - unsigned char data[64]; + int bin_count = 0; + unsigned char data[256]; if (!seekable(f)) return (0); - if (lseek(f, (off_t)0, 0) == BAD_LSEEK) + if (lseek(f, (off_t)0, SEEK_SET) == BAD_LSEEK) return (0); n = read(f, data, sizeof(data)); for (i = 0; i < n; i++) - if (binary_char(data[i])) - return (1); - return (0); + { + char c = data[i]; + if (ctldisp == OPT_ONPLUS && IS_CSI_START(c)) + { + while (++i < n && is_ansi_middle(data[i])) + continue; + } else if (binary_char(c)) + bin_count++; + } + /* + * Call it a binary file if there are more than 5 binary characters + * in the first 256 bytes of the file. + */ + return (bin_count > 5); } /* @@ -486,7 +506,7 @@ seek_filesize(f) { off_t spos; - spos = lseek(f, (off_t)0, 2); + spos = lseek(f, (off_t)0, SEEK_END); if (spos == BAD_LSEEK) return (NULL_POSITION); return ((POSITION) spos); @@ -570,9 +590,9 @@ shellcmd(cmd) fd = popen(cmd, "r"); } else { - scmd = (char *) ecalloc(strlen(shell) + strlen(esccmd) + 5, - sizeof(char)); - sprintf(scmd, "%s %s %s", shell, shell_coption(), esccmd); + int len = strlen(shell) + strlen(esccmd) + 5; + scmd = (char *) ecalloc(len, sizeof(char)); + SNPRINTF3(scmd, len, "%s %s %s", shell, shell_coption(), esccmd); free(esccmd); fd = popen(scmd, "r"); free(scmd); @@ -680,7 +700,7 @@ lglob(filename) do { n = strlen(drive) + strlen(dir) + strlen(fnd.GLOB_NAME) + 1; pathname = (char *) ecalloc(n, sizeof(char)); - sprintf(pathname, "%s%s%s", drive, dir, fnd.GLOB_NAME); + SNPRINTF3(pathname, n, "%s%s%s", drive, dir, fnd.GLOB_NAME); qpathname = shell_quote(pathname); free(pathname); if (qpathname != NULL) @@ -725,6 +745,7 @@ lglob(filename) char *lessecho; char *cmd; char *esc; + int len; esc = get_meta_escape(); if (strlen(esc) == 0) @@ -741,8 +762,9 @@ lglob(filename) /* * Invoke lessecho, and read its output (a globbed list of filenames). */ - cmd = (char *) ecalloc(strlen(lessecho) + strlen(ofilename) + (7*strlen(metachars())) + 24, sizeof(char)); - sprintf(cmd, "%s -p0x%x -d0x%x -e%s ", lessecho, openquote, closequote, esc); + len = strlen(lessecho) + strlen(ofilename) + (7*strlen(metachars())) + 24; + cmd = (char *) ecalloc(len, sizeof(char)); + SNPRINTF4(cmd, len, "%s -p0x%x -d0x%x -e%s ", lessecho, openquote, closequote, esc); free(esc); for (s = metachars(); *s != '\0'; s++) sprintf(cmd + strlen(cmd), "-n0x%x ", *s); @@ -795,6 +817,7 @@ open_altfile(filename, pf, pfd) #else char *lessopen; char *cmd; + int len; FILE *fd; #if HAVE_FILENO int returnfd = 0; @@ -822,9 +845,9 @@ open_altfile(filename, pf, pfd) #endif } - cmd = (char *) ecalloc(strlen(lessopen) + strlen(filename) + 2, - sizeof(char)); - sprintf(cmd, lessopen, filename); + len = strlen(lessopen) + strlen(filename) + 2; + cmd = (char *) ecalloc(len, sizeof(char)); + SNPRINTF1(cmd, len, lessopen, filename); fd = shellcmd(cmd); free(cmd); if (fd == NULL) @@ -884,6 +907,7 @@ close_altfile(altfilename, filename, pipefd) char *lessclose; FILE *fd; char *cmd; + int len; if (secure) return; @@ -900,9 +924,9 @@ close_altfile(altfilename, filename, pipefd) } if ((lessclose = lgetenv("LESSCLOSE")) == NULL) return; - cmd = (char *) ecalloc(strlen(lessclose) + strlen(filename) + - strlen(altfilename) + 2, sizeof(char)); - sprintf(cmd, lessclose, filename, altfilename); + len = strlen(lessclose) + strlen(filename) + strlen(altfilename) + 2; + cmd = (char *) ecalloc(len, sizeof(char)); + SNPRINTF2(cmd, len, lessclose, filename, altfilename); fd = shellcmd(cmd); free(cmd); if (fd != NULL) @@ -956,7 +980,7 @@ bad_file(filename) register char *m = NULL; filename = shell_unquote(filename); - if (is_dir(filename)) + if (!force_open && is_dir(filename)) { static char is_a_dir[] = " is a directory"; diff --git a/src/bin/less/forwback.c b/src/bin/less/forwback.c index 29a52bff90..7b5bb2d260 100644 --- a/src/bin/less/forwback.c +++ b/src/bin/less/forwback.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -21,18 +21,19 @@ public int hit_eof; /* Keeps track of how many times we hit end of file */ public int screen_trashed; public int squished; public int no_back_scroll = 0; +public int forw_prompt; extern int sigs; extern int top_scroll; extern int quiet; extern int sc_width, sc_height; -extern int quit_at_eof; extern int plusoption; extern int forw_scroll; extern int back_scroll; extern int ignore_eoi; extern int clear_bg; extern int final_attr; +extern int oldbot; #if TAGS extern char *tagoption; #endif @@ -77,7 +78,7 @@ eof_check() * of the screen; this can happen when we display a short file * for the first time. */ - static void + public void squish_check() { if (!squished) @@ -124,13 +125,6 @@ forw(n, pos, force, only_last, nblank) if (!do_repaint) { - /* - * Forget any current line shift we might have - * (from the last line of the previous screenful). - */ - extern int cshift; - cshift = 0; - if (top_scroll && n >= sc_height - 1 && pos != ch_length()) { /* @@ -142,12 +136,8 @@ forw(n, pos, force, only_last, nblank) pos_clear(); add_forw_pos(pos); force = 1; - if (top_scroll == OPT_ONPLUS || first_time) - clear(); + clear(); home(); - } else - { - clear_bot(); } if (pos != position(BOTTOM_PLUS_ONE) || empty_screen()) @@ -162,8 +152,7 @@ forw(n, pos, force, only_last, nblank) force = 1; if (top_scroll) { - if (top_scroll == OPT_ONPLUS) - clear(); + clear(); home(); } else if (!first_time) { @@ -237,10 +226,17 @@ forw(n, pos, force, only_last, nblank) squished = 1; continue; } - if (top_scroll == OPT_ON) - clear_eol(); put_line(); - if (clear_bg && final_attr != AT_NORMAL) +#if 0 + /* {{ + * Can't call clear_eol here. The cursor might be at end of line + * on an ignaw terminal, so clear_eol would clear the last char + * of the current line instead of all of the next line. + * If we really need to do this on clear_bg terminals, we need + * to find a better way. + * }} + */ + if (clear_bg && apply_at_specials(final_attr) != AT_NORMAL) { /* * Writing the last character on the last line @@ -251,6 +247,8 @@ forw(n, pos, force, only_last, nblank) */ clear_eol(); } +#endif + forw_prompt = 1; } if (ignore_eoi) @@ -316,6 +314,8 @@ back(n, pos, force, only_last) eof_bell(); else if (do_repaint) repaint(); + else if (!oldbot) + lower_left(); (void) currline(BOTTOM); } @@ -331,7 +331,7 @@ forward(n, force, only_last) { POSITION pos; - if (quit_at_eof && hit_eof && !(ch_getflags() & CH_HELPFILE)) + if (get_quit_at_eof() && hit_eof && !(ch_getflags() & CH_HELPFILE)) { /* * If the -e flag is set and we're trying to go diff --git a/src/bin/less/funcs.h b/src/bin/less/funcs.h index 01b6c12a87..473fb23b95 100644 --- a/src/bin/less/funcs.h +++ b/src/bin/less/funcs.h @@ -14,6 +14,7 @@ public void remove_top (); public void win32_scroll_up (); public void lower_left (); + public void line_left (); public void check_winch (); public void goto_line (); public void vbell (); @@ -21,17 +22,16 @@ public void clear (); public void clear_eol (); public void clear_bot (); - public void so_enter (); - public void so_exit (); - public void ul_enter (); - public void ul_exit (); - public void bo_enter (); - public void bo_exit (); - public void bl_enter (); - public void bl_exit (); + public void at_enter (); + public void at_exit (); + public void at_switch (); + public int is_at_equiv (); + public int apply_at_specials (); public void backspace (); public void putbs (); public char WIN32getch (); + public void WIN32setcolors (); + public void WIN32textout (); public void match_brac (); public void ch_ungetchar (); public void end_logfile (); @@ -54,6 +54,16 @@ public int binary_char (); public int control_char (); public char * prchar (); + public char * prutfchar (); + public int utf_len (); + public int is_utf8_well_formed (); + public LWCHAR get_wchar (); + public void put_wchar (); + public LWCHAR step_char (); + public int is_composing_char (); + public int is_ubin_char (); + public int is_wide_char (); + public int is_combining_char (); public void cmd_reset (); public void clear_cmd (); public void cmd_putstr (); @@ -64,6 +74,9 @@ public int cmd_char (); public LINENUM cmd_int (); public char * get_cmdbuf (); + public char * cmd_lastpattern (); + public void init_cmdhist (); + public void save_cmdhist (); public int in_mca (); public void dispversion (); public int getcc (); @@ -93,6 +106,7 @@ public IFILE save_curr_ifile (); public void unsave_ifile (); public void reedit_ifile (); + public void reopen_curr_ifile (); public int edit_stdin (); public void cat_file (); public void use_logfile (); @@ -110,6 +124,7 @@ public char * bad_file (); public POSITION filesize (); public char * shell_coption (); + public void squish_check (); public void forw (); public void back (); public void forward (); @@ -142,10 +157,14 @@ public void jump_line_loc (); public void jump_loc (); public void init_line (); + public int is_ascii_char (); public void prewind (); public void plinenum (); + public void pshift_all (); public int is_ansi_end (); + public int is_ansi_middle (); public int pappend (); + public int pflushmbc (); public void pdone (); public int gline (); public void null_line (); @@ -169,6 +188,8 @@ public void opt_o (); public void opt__O (); public void opt_l (); + public void opt_j (); + public void calc_jump_sline (); public void opt_k (); public void opt_t (); public void opt__T (); @@ -189,6 +210,8 @@ public int isoptpending (); public void nopendopt (); public int getnum (); + public long getfraction (); + public int get_quit_at_eof (); public void init_option (); public struct loption * findopt (); public struct loption * findopt_name (); diff --git a/src/bin/less/help.c b/src/bin/less/help.c index 2d62913289..5f7b1290e8 100644 --- a/src/bin/less/help.c +++ b/src/bin/less/help.c @@ -118,8 +118,8 @@ constant char helpdata[] = { ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','N','u','m','b','e','r',' ','o','f',' ','b','u','f','f','e','r','s','.','\n', ' ',' ','-','B',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','a','u','t','o','-','b','u','f','f','e','r','s','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','a','u','t','o','m','a','t','i','c','a','l','l','y',' ','a','l','l','o','c','a','t','e',' ','b','u','f','f','e','r','s',' ','f','o','r',' ','p','i','p','e','s','.','\n', -' ',' ','-','c',' ',' ','-','C',' ',' ','.','.','.','.',' ',' ','-','-','c','l','e','a','r','-','s','c','r','e','e','n',' ',' ','-','-','C','L','E','A','R','-','S','C','R','E','E','N','\n', -' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','R','e','p','a','i','n','t',' ','b','y',' ','s','c','r','o','l','l','i','n','g','/','c','l','e','a','r','i','n','g','.','\n', +' ',' ','-','c',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','c','l','e','a','r','-','s','c','r','e','e','n','\n', +' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','R','e','p','a','i','n','t',' ','b','y',' ','c','l','e','a','r','i','n','g',' ','r','a','t','h','e','r',' ','t','h','a','n',' ','s','c','r','o','l','l','i','n','g','.','\n', ' ',' ','-','d',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','d','u','m','b','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','u','m','b',' ','t','e','r','m','i','n','a','l','.','\n', ' ',' ','-','D',' ','[','_','\b','x','_','\b','n','_','\b','.','_','\b','n',']',' ',' ','.',' ',' ','-','-','c','o','l','o','r','=','_','\b','x','_','\b','n','_','\b','.','_','\b','n','\n', @@ -151,7 +151,7 @@ constant char helpdata[] = { ' ',' ','-','m',' ',' ','-','M',' ',' ','.','.','.','.',' ',' ','-','-','l','o','n','g','-','p','r','o','m','p','t',' ',' ','-','-','L','O','N','G','-','P','R','O','M','P','T','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','e','t',' ','p','r','o','m','p','t',' ','s','t','y','l','e','.','\n', ' ',' ','-','n',' ',' ','-','N',' ',' ','.','.','.','.',' ',' ','-','-','l','i','n','e','-','n','u','m','b','e','r','s',' ',' ','-','-','L','I','N','E','-','N','U','M','B','E','R','S','\n', -' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','U','s','e',' ','l','i','n','e',' ','n','u','m','b','e','r','s','.','\n', +' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','u','s','e',' ','l','i','n','e',' ','n','u','m','b','e','r','s','.','\n', ' ',' ','-','o',' ','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']',' ',' ','.',' ',' ','-','-','l','o','g','-','f','i','l','e','=','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','C','o','p','y',' ','t','o',' ','l','o','g',' ','f','i','l','e',' ','(','s','t','a','n','d','a','r','d',' ','i','n','p','u','t',' ','o','n','l','y',')','.','\n', ' ',' ','-','O',' ','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']',' ',' ','.',' ',' ','-','-','L','O','G','-','F','I','L','E','=','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']','\n', @@ -220,6 +220,7 @@ constant char helpdata[] = { ' ','T','A','B',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','C','o','m','p','l','e','t','e',' ','f','i','l','e','n','a','m','e',' ','&',' ','c','y','c','l','e','.','\n', ' ','S','H','I','F','T','-','T','A','B',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C','-','T','A','B',' ',' ',' ','C','o','m','p','l','e','t','e',' ','f','i','l','e','n','a','m','e',' ','&',' ','r','e','v','e','r','s','e',' ','c','y','c','l','e','.','\n', ' ','C','N','T','L','-','L',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','C','o','m','p','l','e','t','e',' ','f','i','l','e','n','a','m','e',',',' ','l','i','s','t',' ','a','l','l','.','\n', +'\n', '\n', 0 }; constant int size_helpdata = sizeof(helpdata) - 1; diff --git a/src/bin/less/ifile.c b/src/bin/less/ifile.c index 694621eaf4..96e8e603ec 100644 --- a/src/bin/less/ifile.c +++ b/src/bin/less/ifile.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. diff --git a/src/bin/less/input.c b/src/bin/less/input.c index a20ce051e0..1129a7b055 100644 --- a/src/bin/less/input.c +++ b/src/bin/less/input.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -27,6 +27,7 @@ extern int hshift; extern int quit_if_one_screen; extern int sigs; extern int ignore_eoi; +extern int status_col; extern POSITION start_attnpos; extern POSITION end_attnpos; #if HILITE_SEARCH @@ -45,10 +46,12 @@ extern int size_linebuf; forw_line(curr_pos) POSITION curr_pos; { + POSITION base_pos; POSITION new_pos; register int c; int blankline; int endline; + int backchars; if (curr_pos == NULL_POSITION) { @@ -56,7 +59,7 @@ forw_line(curr_pos) return (NULL_POSITION); } #if HILITE_SEARCH - if (hilite_search == OPT_ONPLUS) + if (hilite_search == OPT_ONPLUS || status_col) /* * If we are ignoring EOI (command F), only prepare * one line ahead, to avoid getting stuck waiting for @@ -73,9 +76,48 @@ forw_line(curr_pos) return (NULL_POSITION); } - prewind(); - plinenum(curr_pos); - (void) ch_seek(curr_pos); + base_pos = curr_pos; + for (;;) + { + if (ABORT_SIGS()) + { + null_line(); + return (NULL_POSITION); + } + c = ch_back_get(); + if (c == EOI) + break; + if (c == '\n') + { + (void) ch_forw_get(); + break; + } + --base_pos; + } + + prewind(); + plinenum(base_pos); + (void) ch_seek(base_pos); + while (base_pos < curr_pos) + { + if (ABORT_SIGS()) + { + null_line(); + return (NULL_POSITION); + } + c = ch_forw_get(); + backchars = pappend(c, base_pos); + base_pos++; + if (backchars > 0) + { + pshift_all(); + base_pos -= backchars; + while (--backchars >= 0) + (void) ch_back_get(); + } + } + (void) pflushmbc(); + pshift_all(); c = ch_forw_get(); if (c == EOI) @@ -97,15 +139,24 @@ forw_line(curr_pos) /* * End of the line. */ + backchars = pflushmbc(); new_pos = ch_tell(); - endline = TRUE; + if (backchars > 0 && !chopline && hshift == 0) + { + new_pos -= backchars + 1; + endline = FALSE; + } else + endline = TRUE; break; } + if (c != '\r') + blankline = 0; /* * Append the char to the line and get the next char. */ - if (pappend(c, ch_tell()-1)) + backchars = pappend(c, ch_tell()-1); + if (backchars > 0) { /* * The char won't fit in the line; the line @@ -123,7 +174,7 @@ forw_line(curr_pos) quit_if_one_screen = FALSE; } else { - new_pos = ch_tell() - 1; + new_pos = ch_tell() - backchars; endline = FALSE; } break; @@ -167,6 +218,7 @@ back_line(curr_pos) POSITION new_pos, begin_new_pos; int c; int endline; + int backchars; if (curr_pos == NULL_POSITION || curr_pos <= ch_zero()) { @@ -174,7 +226,7 @@ back_line(curr_pos) return (NULL_POSITION); } #if HILITE_SEARCH - if (hilite_search == OPT_ONPLUS) + if (hilite_search == OPT_ONPLUS || status_col) prep_hilite((curr_pos < 3*size_linebuf) ? 0 : curr_pos - 3*size_linebuf, curr_pos, -1); #endif @@ -263,10 +315,10 @@ back_line(curr_pos) return (NULL_POSITION); } endline = FALSE; - loop: - begin_new_pos = new_pos; prewind(); plinenum(new_pos); + loop: + begin_new_pos = new_pos; (void) ch_seek(new_pos); do @@ -280,10 +332,17 @@ back_line(curr_pos) new_pos++; if (c == '\n') { + backchars = pflushmbc(); + if (backchars > 0 && !chopline && hshift == 0) + { + backchars++; + goto shift; + } endline = TRUE; break; } - if (pappend(c, ch_tell()-1)) + backchars = pappend(c, ch_tell()-1); + if (backchars > 0) { /* * Got a full printable line, but we haven't @@ -296,9 +355,13 @@ back_line(curr_pos) quit_if_one_screen = FALSE; break; } - pdone(0); - (void) ch_back_get(); - new_pos--; + shift: + pshift_all(); + while (backchars-- > 0) + { + (void) ch_back_get(); + new_pos--; + } goto loop; } } while (new_pos < curr_pos); diff --git a/src/bin/less/install.sh b/src/bin/less/install.sh index 0ff4b6a08e..41ea84f9e5 100755 --- a/src/bin/less/install.sh +++ b/src/bin/less/install.sh @@ -97,7 +97,7 @@ fi # Make a temp file name in the proper directory. dstdir=`dirname $dst` -dsttmp=$dstdir/#inst.$$# +dsttmp=$dstdir/_inst.$$_ # Move or copy the file name to the temp name diff --git a/src/bin/less/jump.c b/src/bin/less/jump.c index b919b2549f..585d9b209e 100644 --- a/src/bin/less/jump.c +++ b/src/bin/less/jump.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -22,6 +22,7 @@ extern int squished; extern int screen_trashed; extern int sc_width, sc_height; extern int show_attn; +extern int top_scroll; /* * Jump to the end of the file. @@ -30,6 +31,7 @@ extern int show_attn; jump_forw() { POSITION pos; + POSITION end_pos; if (ch_end_seek()) { @@ -41,11 +43,17 @@ jump_forw() * Go back one line from the end of the file * to get to the beginning of the last line. */ - pos = back_line(ch_tell()); + pos_clear(); + end_pos = ch_tell(); + pos = back_line(end_pos); if (pos == NULL_POSITION) jump_loc((POSITION)0, sc_height-1); else + { jump_loc(pos, sc_height-1); + if (position(sc_height-1) != end_pos) + repaint(); + } } /* @@ -101,8 +109,9 @@ repaint() * Jump to a specified percentage into the file. */ public void -jump_percent(percent) +jump_percent(percent, fraction) int percent; + long fraction; { POSITION pos, len; @@ -120,7 +129,7 @@ jump_percent(percent) error("Don't know length of file", NULL_PARG); return; } - pos = percent_pos(len, percent); + pos = percent_pos(len, percent, fraction); if (pos >= len) pos = len-1; @@ -279,7 +288,10 @@ jump_loc(pos, sline) } } lastmark(); - clear(); + if (!top_scroll) + clear(); + else + home(); screen_trashed = 0; add_back_pos(pos); back(sc_height-1, pos, 1, 0); diff --git a/src/bin/less/less.h b/src/bin/less/less.h index 059a6dab55..4dd922aadf 100644 --- a/src/bin/less/less.h +++ b/src/bin/less/less.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -8,6 +8,7 @@ * contact the author, see the README file. */ +#define NEWBOT 1 /* * Standard include file for "less". @@ -70,6 +71,9 @@ #if HAVE_CTYPE_H #include #endif +#if HAVE_WCTYPE_H +#include +#endif #if HAVE_LIMITS_H #include #endif @@ -79,13 +83,21 @@ #if HAVE_STRING_H #include #endif + +/* OS-specific includes */ #ifdef _OSK #include #include #endif + +#ifdef __TANDEM +#include +#endif + #if MSDOS_COMPILER==WIN32C || OS2 #include #endif + #if MSDOS_COMPILER==DJGPPC #include #include @@ -104,17 +116,50 @@ void free(); * Simple lowercase test which can be used during option processing * (before options are parsed which might tell us what charset to use). */ -#define SIMPLE_IS_UPPER(c) ((c) >= 'A' && (c) <= 'Z') -#define SIMPLE_IS_LOWER(c) ((c) >= 'a' && (c) <= 'z') -#define SIMPLE_TO_UPPER(c) ((c) - 'a' + 'A') -#define SIMPLE_TO_LOWER(c) ((c) - 'A' + 'a') +#define ASCII_IS_UPPER(c) ((c) >= 'A' && (c) <= 'Z') +#define ASCII_IS_LOWER(c) ((c) >= 'a' && (c) <= 'z') +#define ASCII_TO_UPPER(c) ((c) - 'a' + 'A') +#define ASCII_TO_LOWER(c) ((c) - 'A' + 'a') -#if !HAVE_UPPER_LOWER -#define isupper(c) SIMPLE_IS_UPPER(c) -#define islower(c) SIMPLE_IS_LOWER(c) -#define toupper(c) SIMPLE_TO_UPPER(c) -#define tolower(c) SIMPLE_TO_LOWER(c) +#undef IS_UPPER +#undef IS_LOWER +#undef TO_UPPER +#undef TO_LOWER +#undef IS_SPACE +#undef IS_DIGIT + +#if HAVE_WCTYPE +#define IS_UPPER(c) iswupper(c) +#define IS_LOWER(c) iswlower(c) +#define TO_UPPER(c) towupper(c) +#define TO_LOWER(c) towlower(c) +#else +#if HAVE_UPPER_LOWER +#define IS_UPPER(c) isupper((unsigned char) (c)) +#define IS_LOWER(c) islower((unsigned char) (c)) +#define TO_UPPER(c) toupper((unsigned char) (c)) +#define TO_LOWER(c) tolower((unsigned char) (c)) +#else +#define IS_UPPER(c) ASCII_IS_UPPER(c) +#define IS_LOWER(c) ASCII_IS_LOWER(c) +#define TO_UPPER(c) ASCII_TO_UPPER(c) +#define TO_LOWER(c) ASCII_TO_LOWER(c) #endif +#endif + +#ifdef isspace +#define IS_SPACE(c) isspace((unsigned char)(c)) +#else +#define IS_SPACE(c) ((c) == ' ' || (c) == '\t' || (c) == '\n' || (c) == '\r' || (c) == '\f') +#endif + +#ifdef isdigit +#define IS_DIGIT(c) isdigit((unsigned char)(c)) +#else +#define IS_DIGIT(c) ((c) >= '0' && (c) <= '9') +#endif + +#define IS_CSI_START(c) ((c) == ESC || (!utf_mode && ((unsigned char)(c)) == CSI)) #ifndef NULL #define NULL 0 @@ -137,8 +182,28 @@ void free(); #endif #endif +#if HAVE_SNPRINTF +#define SNPRINTF1(str, size, fmt, v1) snprintf((str), (size), (fmt), (v1)) +#define SNPRINTF2(str, size, fmt, v1, v2) snprintf((str), (size), (fmt), (v1), (v2)) +#define SNPRINTF3(str, size, fmt, v1, v2, v3) snprintf((str), (size), (fmt), (v1), (v2), (v3)) +#define SNPRINTF4(str, size, fmt, v1, v2, v3, v4) snprintf((str), (size), (fmt), (v1), (v2), (v3), (v4)) +#else +/* Use unsafe sprintf if we don't have snprintf. */ +#define SNPRINTF1(str, size, fmt, v1) sprintf((str), (fmt), (v1)) +#define SNPRINTF2(str, size, fmt, v1, v2) sprintf((str), (fmt), (v1), (v2)) +#define SNPRINTF3(str, size, fmt, v1, v2, v3) sprintf((str), (fmt), (v1), (v2), (v3)) +#define SNPRINTF4(str, size, fmt, v1, v2, v3, v4) sprintf((str), (fmt), (v1), (v2), (v3), (v4)) +#endif + #define BAD_LSEEK ((off_t)-1) +#ifndef SEEK_SET +#define SEEK_SET 0 +#endif +#ifndef SEEK_END +#define SEEK_END 2 +#endif + #ifndef CHAR_BIT #define CHAR_BIT 8 #endif @@ -153,9 +218,11 @@ void free(); /* * Special types and constants. */ +typedef unsigned long LWCHAR; typedef off_t POSITION; typedef off_t LINENUM; #define MIN_LINENUM_WIDTH 7 /* Min printing width of a line number */ +#define MAX_UTF_CHAR_LEN 6 /* Max bytes in one UTF-8 char */ #define NULL_POSITION ((POSITION)(-1)) @@ -248,6 +315,10 @@ struct textlist #define READ_INTR (-2) +/* A fraction is represented by an int n; the fraction is n/NUM_FRAC_DENOM */ +#define NUM_FRAC_DENOM 1000000 +#define NUM_LOG_FRAC_DENOM 6 + /* How quiet should we be? */ #define NOT_QUIET 0 /* Ring bell at eof and for errors */ #define LITTLE_QUIET 1 /* Ring bell only for errors */ @@ -264,14 +335,14 @@ struct textlist #define BS_CONTROL 2 /* \b treated as control char; prints as ^H */ /* How should we search? */ -#define SRCH_FORW 000001 /* Search forward from current position */ -#define SRCH_BACK 000002 /* Search backward from current position */ -#define SRCH_NO_MOVE 000004 /* Highlight, but don't move */ -#define SRCH_FIND_ALL 000010 /* Find and highlight all matches */ -#define SRCH_NO_MATCH 000100 /* Search for non-matching lines */ -#define SRCH_PAST_EOF 000200 /* Search past end-of-file, into next file */ -#define SRCH_FIRST_FILE 000400 /* Search starting at the first file */ -#define SRCH_NO_REGEX 001000 /* Don't use regular expressions */ +#define SRCH_FORW (1 << 0) /* Search forward from current position */ +#define SRCH_BACK (1 << 1) /* Search backward from current position */ +#define SRCH_NO_MOVE (1 << 2) /* Highlight, but don't move */ +#define SRCH_FIND_ALL (1 << 4) /* Find and highlight all matches */ +#define SRCH_NO_MATCH (1 << 8) /* Search for non-matching lines */ +#define SRCH_PAST_EOF (1 << 9) /* Search past end-of-file, into next file */ +#define SRCH_FIRST_FILE (1 << 10) /* Search starting at the first file */ +#define SRCH_NO_REGEX (1 << 12) /* Don't use regular expressions */ #define SRCH_REVERSE(t) (((t) & SRCH_FORW) ? \ (((t) & ~SRCH_FORW) | SRCH_BACK) : \ @@ -289,13 +360,15 @@ struct textlist #define CF_QUIT_ON_ERASE 0001 /* Abort cmd if its entirely erased */ -/* Special chars used to tell put_line() to do something special */ +/* Special char bit-flags used to tell put_line() to do something special */ #define AT_NORMAL (0) -#define AT_UNDERLINE (1) -#define AT_BOLD (2) -#define AT_BLINK (3) -#define AT_INVIS (4) -#define AT_STANDOUT (5) +#define AT_UNDERLINE (1 << 0) +#define AT_BOLD (1 << 1) +#define AT_BLINK (1 << 2) +#define AT_STANDOUT (1 << 3) +#define AT_ANSI (1 << 4) /* Content-supplied "ANSI" escape sequence */ +#define AT_BINARY (1 << 5) /* LESS*BINFMT representation */ +#define AT_HILITE (1 << 6) /* Internal highlights (e.g., for search) */ #if '0' == 240 #define IS_EBCDIC_HOST 1 @@ -370,6 +443,7 @@ struct textlist #endif /* IS_EBCDIC_HOST */ #define ESC CONTROL('[') +#define CSI ((unsigned char)'\233') #if _OSK_MWC32 #define LSIGNAL(sig,func) os9_signal(sig,func) @@ -400,6 +474,9 @@ struct textlist #define QUIT_ERROR 1 #define QUIT_SAVED_STATUS (-1) +#define FOLLOW_DESC 0 +#define FOLLOW_NAME 1 + /* filestate flags */ #define CH_CANSEEK 001 #define CH_KEEPOPEN 002 diff --git a/src/bin/less/less.hlp b/src/bin/less/less.hlp index 1c60d5e569..18c9968e99 100644 --- a/src/bin/less/less.hlp +++ b/src/bin/less/less.hlp @@ -115,8 +115,8 @@ Number of buffers. -B ........ --auto-buffers Don't automatically allocate buffers for pipes. - -c -C .... --clear-screen --CLEAR-SCREEN - Repaint by scrolling/clearing. + -c ........ --clear-screen + Repaint by clearing rather than scrolling. -d ........ --dumb Dumb terminal. -D [_x_n_._n] . --color=_x_n_._n @@ -148,7 +148,7 @@ -m -M .... --long-prompt --LONG-PROMPT Set prompt style. -n -N .... --line-numbers --LINE-NUMBERS - Use line numbers. + Don't use line numbers. -o [_f_i_l_e] . --log-file=[_f_i_l_e] Copy to log file (standard input only). -O [_f_i_l_e] . --LOG-FILE=[_f_i_l_e] @@ -218,3 +218,4 @@ SHIFT-TAB ESC-TAB Complete filename & reverse cycle. CNTL-L Complete filename, list all. + diff --git a/src/bin/less/less.man b/src/bin/less/less.man index 92d83f486a..a0daa2a88b 100644 --- a/src/bin/less/less.man +++ b/src/bin/less/less.man @@ -1,298 +1,226 @@ +LESS(1) LESS(1) -LESS(1) LESS(1) - - -NNAAMMEE +NAME less - opposite of more -SSYYNNOOPPSSIISS - lleessss --?? - lleessss ----hheellpp - lleessss --VV - lleessss ----vveerrssiioonn - lleessss [[--[[++]]aaBBccCCddeeEEffFFggGGiiIIJJLLmmMMnnNNqqQQrrRRssSSuuUUVVwwWWXX~~]] - [[--bb _s_p_a_c_e]] [[--hh _l_i_n_e_s]] [[--jj _l_i_n_e]] [[--kk _k_e_y_f_i_l_e]] - [[--{{ooOO}} _l_o_g_f_i_l_e]] [[--pp _p_a_t_t_e_r_n]] [[--PP _p_r_o_m_p_t]] [[--tt _t_a_g]] - [[--TT _t_a_g_s_f_i_l_e]] [[--xx _t_a_b,,......]] [[--yy _l_i_n_e_s]] [[--[[zz]] _l_i_n_e_s]] - [[--## _s_h_i_f_t]] [[++[[++]]_c_m_d]] [[----]] [[_f_i_l_e_n_a_m_e]]...... - (See the OPTIONS section for alternate option syntax with - long option names.) +SYNOPSIS + less -? + less --help + less -V + less --version + less [-[+]aBcCdeEfFgGiIJKLmMnNqQrRsSuUVwWX~] + [-b space] [-h lines] [-j line] [-k keyfile] + [-{oO} logfile] [-p pattern] [-P prompt] [-t tag] + [-T tagsfile] [-x tab,...] [-y lines] [-[z] lines] + [-# shift] [+[+]cmd] [--] [filename]... + (See the OPTIONS section for alternate option syntax with long option + names.) -DDEESSCCRRIIPPTTIIOONN - _L_e_s_s is a program similar to _m_o_r_e (1), but which allows - backward movement in the file as well as forward movement. - Also, _l_e_s_s does not have to read the entire input file - before starting, so with large input files it starts up - faster than text editors like _v_i (1). _L_e_s_s uses termcap - (or terminfo on some systems), so it can run on a variety - of terminals. There is even limited support for hardcopy - terminals. (On a hardcopy terminal, lines which should be - printed at the top of the screen are prefixed with a - caret.) +DESCRIPTION + Less is a program similar to more (1), but which allows backward move- + ment in the file as well as forward movement. Also, less does not have + to read the entire input file before starting, so with large input + files it starts up faster than text editors like vi (1). Less uses + termcap (or terminfo on some systems), so it can run on a variety of + terminals. There is even limited support for hardcopy terminals. (On + a hardcopy terminal, lines which should be printed at the top of the + screen are prefixed with a caret.) - Commands are based on both _m_o_r_e and _v_i_. Commands may be - preceded by a decimal number, called N in the descriptions - below. The number is used by some commands, as indicated. + Commands are based on both more and vi. Commands may be preceded by a + decimal number, called N in the descriptions below. The number is used + by some commands, as indicated. -CCOOMMMMAANNDDSS - In the following descriptions, ^X means control-X. ESC - stands for the ESCAPE key; for example ESC-v means the two - character sequence "ESCAPE", then "v". +COMMANDS + In the following descriptions, ^X means control-X. ESC stands for the + ESCAPE key; for example ESC-v means the two character sequence + "ESCAPE", then "v". - h or H Help: display a summary of these commands. If you - forget all the other commands, remember this one. + h or H Help: display a summary of these commands. If you forget all + the other commands, remember this one. SPACE or ^V or f or ^F - Scroll forward N lines, default one window (see - option -z below). If N is more than the screen - size, only the final screenful is displayed. Warn­ - ing: some systems use ^V as a special literaliza­ - tion character. + Scroll forward N lines, default one window (see option -z + below). If N is more than the screen size, only the final + screenful is displayed. Warning: some systems use ^V as a spe- + cial literalization character. - z Like SPACE, but if N is specified, it becomes the - new window size. + z Like SPACE, but if N is specified, it becomes the new window + size. ESC-SPACE - Like SPACE, but scrolls a full screenful, even if - - - - Version 382: 03 Feb 2004 1 - - - - - -LESS(1) LESS(1) - - - it reaches end-of-file in the process. + Like SPACE, but scrolls a full screenful, even if it reaches + end-of-file in the process. RETURN or ^N or e or ^E or j or ^J - Scroll forward N lines, default 1. The entire N - lines are displayed, even if N is more than the - screen size. + Scroll forward N lines, default 1. The entire N lines are dis- + played, even if N is more than the screen size. d or ^D - Scroll forward N lines, default one half of the - screen size. If N is specified, it becomes the new - default for subsequent d and u commands. + Scroll forward N lines, default one half of the screen size. If + N is specified, it becomes the new default for subsequent d and + u commands. b or ^B or ESC-v - Scroll backward N lines, default one window (see - option -z below). If N is more than the screen - size, only the final screenful is displayed. + Scroll backward N lines, default one window (see option -z + below). If N is more than the screen size, only the final + screenful is displayed. - w Like ESC-v, but if N is specified, it becomes the - new window size. + w Like ESC-v, but if N is specified, it becomes the new window + size. y or ^Y or ^P or k or ^K - Scroll backward N lines, default 1. The entire N - lines are displayed, even if N is more than the - screen size. Warning: some systems use ^Y as a - special job control character. + Scroll backward N lines, default 1. The entire N lines are dis- + played, even if N is more than the screen size. Warning: some + systems use ^Y as a special job control character. u or ^U - Scroll backward N lines, default one half of the - screen size. If N is specified, it becomes the new - default for subsequent d and u commands. + Scroll backward N lines, default one half of the screen size. + If N is specified, it becomes the new default for subsequent d + and u commands. ESC-) or RIGHTARROW - Scroll horizontally right N characters, default - half the screen width (see the -# option). If a - number N is specified, it becomes the default for - future RIGHTARROW and LEFTARROW commands. While - the text is scrolled, it acts as though the -S + Scroll horizontally right N characters, default half the screen + width (see the -# option). If a number N is specified, it + becomes the default for future RIGHTARROW and LEFTARROW com- + mands. While the text is scrolled, it acts as though the -S option (chop lines) were in effect. ESC-( or LEFTARROW - Scroll horizontally left N characters, default half - the screen width (see the -# option). If a number - N is specified, it becomes the default for future - RIGHTARROW and LEFTARROW commands. + Scroll horizontally left N characters, default half the screen + width (see the -# option). If a number N is specified, it + becomes the default for future RIGHTARROW and LEFTARROW com- + mands. r or ^R or ^L Repaint the screen. - R Repaint the screen, discarding any buffered input. - Useful if the file is changing while it is being - viewed. + R Repaint the screen, discarding any buffered input. Useful if + the file is changing while it is being viewed. - F Scroll forward, and keep trying to read when the - end of file is reached. Normally this command - - - - Version 382: 03 Feb 2004 2 - - - - - -LESS(1) LESS(1) - - - would be used when already at the end of the file. - It is a way to monitor the tail of a file which is - growing while it is being viewed. (The behavior is + F Scroll forward, and keep trying to read when the end of file is + reached. Normally this command would be used when already at + the end of the file. It is a way to monitor the tail of a file + which is growing while it is being viewed. (The behavior is similar to the "tail -f" command.) g or < or ESC-< - Go to line N in the file, default 1 (beginning of - file). (Warning: this may be slow if N is large.) + Go to line N in the file, default 1 (beginning of file). (Warn- + ing: this may be slow if N is large.) G or > or ESC-> - Go to line N in the file, default the end of the - file. (Warning: this may be slow if N is large, or - if N is not specified and standard input, rather - than a file, is being read.) + Go to line N in the file, default the end of the file. (Warn- + ing: this may be slow if N is large, or if N is not specified + and standard input, rather than a file, is being read.) - p or % Go to a position N percent into the file. N should - be between 0 and 100. + p or % Go to a position N percent into the file. N should be between 0 + and 100, and may contain a decimal point. - { If a left curly bracket appears in the top line - displayed on the screen, the { command will go to - the matching right curly bracket. The matching - right curly bracket is positioned on the bottom - line of the screen. If there is more than one left - curly bracket on the top line, a number N may be - used to specify the N-th bracket on the line. + P Go to the line containing byte offset N in the file. - } If a right curly bracket appears in the bottom line - displayed on the screen, the } command will go to - the matching left curly bracket. The matching left - curly bracket is positioned on the top line of the - screen. If there is more than one right curly - bracket on the top line, a number N may be used to - specify the N-th bracket on the line. + { If a left curly bracket appears in the top line displayed on the + screen, the { command will go to the matching right curly + bracket. The matching right curly bracket is positioned on the + bottom line of the screen. If there is more than one left curly + bracket on the top line, a number N may be used to specify the + N-th bracket on the line. - ( Like {, but applies to parentheses rather than - curly brackets. + } If a right curly bracket appears in the bottom line displayed on + the screen, the } command will go to the matching left curly + bracket. The matching left curly bracket is positioned on the + top line of the screen. If there is more than one right curly + bracket on the top line, a number N may be used to specify the + N-th bracket on the line. - ) Like }, but applies to parentheses rather than - curly brackets. + ( Like {, but applies to parentheses rather than curly brackets. - [ Like {, but applies to square brackets rather than - curly brackets. + ) Like }, but applies to parentheses rather than curly brackets. - ] Like }, but applies to square brackets rather than - curly brackets. + [ Like {, but applies to square brackets rather than curly brack- + ets. - ESC-^F Followed by two characters, acts like {, but uses - the two characters as open and close brackets, - respectively. For example, "ESC ^F < >" could be - used to go forward to the > which matches the < in - the top displayed line. + ] Like }, but applies to square brackets rather than curly brack- + ets. - ESC-^B Followed by two characters, acts like }, but uses - the two characters as open and close brackets, + ESC-^F Followed by two characters, acts like {, but uses the two char- + acters as open and close brackets, respectively. For example, + "ESC ^F < >" could be used to go forward to the > which matches + the < in the top displayed line. + ESC-^B Followed by two characters, acts like }, but uses the two char- + acters as open and close brackets, respectively. For example, + "ESC ^B < >" could be used to go backward to the < which matches + the > in the bottom displayed line. + m Followed by any lowercase letter, marks the current position + with that letter. - Version 382: 03 Feb 2004 3 - - - - - -LESS(1) LESS(1) - - - respectively. For example, "ESC ^B < >" could be - used to go backward to the < which matches the > in - the bottom displayed line. - - m Followed by any lowercase letter, marks the current - position with that letter. - - ' (Single quote.) Followed by any lowercase letter, - returns to the position which was previously marked - with that letter. Followed by another single - quote, returns to the position at which the last - "large" movement command was executed. Followed by - a ^ or $, jumps to the beginning or end of the file - respectively. Marks are preserved when a new file - is examined, so the ' command can be used to switch - between input files. + ' (Single quote.) Followed by any lowercase letter, returns to + the position which was previously marked with that letter. Fol- + lowed by another single quote, returns to the position at which + the last "large" movement command was executed. Followed by a ^ + or $, jumps to the beginning or end of the file respectively. + Marks are preserved when a new file is examined, so the ' com- + mand can be used to switch between input files. ^X^X Same as single quote. /pattern - Search forward in the file for the N-th line con­ - taining the pattern. N defaults to 1. The pattern - is a regular expression, as recognized by _e_d_. The - search starts at the second line displayed (but see + Search forward in the file for the N-th line containing the pat- + tern. N defaults to 1. The pattern is a regular expression, as + recognized by the regular expression library supplied by your + system. The search starts at the second line displayed (but see the -a and -j options, which change this). - Certain characters are special if entered at the - beginning of the pattern; they modify the type of - search rather than become part of the pattern: + Certain characters are special if entered at the beginning of + the pattern; they modify the type of search rather than become + part of the pattern: ^N or ! - Search for lines which do NOT match the pat­ - tern. + Search for lines which do NOT match the pattern. ^E or * - Search multiple files. That is, if the - search reaches the END of the current file - without finding a match, the search contin­ - ues in the next file in the command line + Search multiple files. That is, if the search reaches + the END of the current file without finding a match, the + search continues in the next file in the command line list. ^F or @ - Begin the search at the first line of the - FIRST file in the command line list, regard­ - less of what is currently displayed on the - screen or the settings of the -a or -j + Begin the search at the first line of the FIRST file in + the command line list, regardless of what is currently + displayed on the screen or the settings of the -a or -j options. - ^K Highlight any text which matches the pattern - on the current screen, but don't move to the - first match (KEEP current position). + ^K Highlight any text which matches the pattern on the cur- + rent screen, but don't move to the first match (KEEP + current position). - ^R Don't interpret regular expression metachar­ - acters; that is, do a simple textual - - - - Version 382: 03 Feb 2004 4 - - - - - -LESS(1) LESS(1) - - - comparison. + ^R Don't interpret regular expression metacharacters; that + is, do a simple textual comparison. ?pattern - Search backward in the file for the N-th line con­ - taining the pattern. The search starts at the line - immediately before the top line displayed. + Search backward in the file for the N-th line containing the + pattern. The search starts at the line immediately before the + top line displayed. Certain characters are special as in the / command: ^N or ! - Search for lines which do NOT match the pat­ - tern. + Search for lines which do NOT match the pattern. ^E or * - Search multiple files. That is, if the - search reaches the beginning of the current - file without finding a match, the search - continues in the previous file in the com­ - mand line list. + Search multiple files. That is, if the search reaches + the beginning of the current file without finding a + match, the search continues in the previous file in the + command line list. ^F or @ - Begin the search at the last line of the - last file in the command line list, regard­ - less of what is currently displayed on the - screen or the settings of the -a or -j + Begin the search at the last line of the last file in the + command line list, regardless of what is currently dis- + played on the screen or the settings of the -a or -j options. ^K As in forward searches. @@ -305,837 +233,625 @@ LESS(1) LESS(1) ESC-?pattern Same as "?*". - n Repeat previous search, for N-th line containing - the last pattern. If the previous search was modi­ - fied by ^N, the search is made for the N-th line - NOT containing the pattern. If the previous search - was modified by ^E, the search continues in the - next (or previous) file if not satisfied in the - current file. If the previous search was modified - by ^R, the search is done without using regular - expressions. There is no effect if the previous - search was modified by ^F or ^K. + n Repeat previous search, for N-th line containing the last pat- + tern. If the previous search was modified by ^N, the search is + made for the N-th line NOT containing the pattern. If the pre- + vious search was modified by ^E, the search continues in the + next (or previous) file if not satisfied in the current file. + If the previous search was modified by ^R, the search is done + without using regular expressions. There is no effect if the + previous search was modified by ^F or ^K. - N Repeat previous search, but in the reverse direc­ - tion. + N Repeat previous search, but in the reverse direction. - ESC-n Repeat previous search, but crossing file bound­ - aries. The effect is as if the previous search - were modified by *. + ESC-n Repeat previous search, but crossing file boundaries. The + effect is as if the previous search were modified by *. + ESC-N Repeat previous search, but in the reverse direction and cross- + ing file boundaries. - - Version 382: 03 Feb 2004 5 - - - - - -LESS(1) LESS(1) - - - ESC-N Repeat previous search, but in the reverse direc­ - tion and crossing file boundaries. - - ESC-u Undo search highlighting. Turn off highlighting of - strings matching the current search pattern. If - highlighting is already off because of a previous - ESC-u command, turn highlighting back on. Any - search command will also turn highlighting back on. - (Highlighting can also be disabled by toggling the - -G option; in that case search commands do not turn - highlighting back on.) + ESC-u Undo search highlighting. Turn off highlighting of strings + matching the current search pattern. If highlighting is already + off because of a previous ESC-u command, turn highlighting back + on. Any search command will also turn highlighting back on. + (Highlighting can also be disabled by toggling the -G option; in + that case search commands do not turn highlighting back on.) :e [filename] - Examine a new file. If the filename is missing, - the "current" file (see the :n and :p commands - below) from the list of files in the command line - is re-examined. A percent sign (%) in the filename - is replaced by the name of the current file. A - pound sign (#) is replaced by the name of the pre­ - viously examined file. However, two consecutive - percent signs are simply replaced with a single - percent sign. This allows you to enter a filename - that contains a percent sign in the name. Simi­ - larly, two consecutive pound signs are replaced - with a single pound sign. The filename is inserted - into the command line list of files so that it can - be seen by subsequent :n and :p commands. If the - filename consists of several files, they are all - inserted into the list of files and the first one - is examined. If the filename contains one or more - spaces, the entire filename should be enclosed in - double quotes (also see the -" option). + Examine a new file. If the filename is missing, the "current" + file (see the :n and :p commands below) from the list of files + in the command line is re-examined. A percent sign (%) in the + filename is replaced by the name of the current file. A pound + sign (#) is replaced by the name of the previously examined + file. However, two consecutive percent signs are simply + replaced with a single percent sign. This allows you to enter a + filename that contains a percent sign in the name. Similarly, + two consecutive pound signs are replaced with a single pound + sign. The filename is inserted into the command line list of + files so that it can be seen by subsequent :n and :p commands. + If the filename consists of several files, they are all inserted + into the list of files and the first one is examined. If the + filename contains one or more spaces, the entire filename should + be enclosed in double quotes (also see the -" option). ^X^V or E - Same as :e. Warning: some systems use ^V as a spe­ - cial literalization character. On such systems, - you may not be able to use ^V. + Same as :e. Warning: some systems use ^V as a special literal- + ization character. On such systems, you may not be able to use + ^V. - :n Examine the next file (from the list of files given - in the command line). If a number N is specified, - the N-th next file is examined. + :n Examine the next file (from the list of files given in the com- + mand line). If a number N is specified, the N-th next file is + examined. - :p Examine the previous file in the command line list. - If a number N is specified, the N-th previous file - is examined. + :p Examine the previous file in the command line list. If a number + N is specified, the N-th previous file is examined. - :x Examine the first file in the command line list. - If a number N is specified, the N-th file in the - list is examined. + :x Examine the first file in the command line list. If a number N + is specified, the N-th file in the list is examined. :d Remove the current file from the list of files. - t Go to the next tag, if there were more than one - matches for the current tag. See the -t option for + t Go to the next tag, if there were more than one matches for the + current tag. See the -t option for more details about tags. - - - Version 382: 03 Feb 2004 6 - - - - - -LESS(1) LESS(1) - - - more details about tags. - - T Go to the previous tag, if there were more than one - matches for the current tag. + T Go to the previous tag, if there were more than one matches for + the current tag. = or ^G or :f - Prints some information about the file being - viewed, including its name and the line number and - byte offset of the bottom line being displayed. If - possible, it also prints the length of the file, - the number of lines in the file and the percent of - the file above the last displayed line. + Prints some information about the file being viewed, including + its name and the line number and byte offset of the bottom line + being displayed. If possible, it also prints the length of the + file, the number of lines in the file and the percent of the + file above the last displayed line. - - Followed by one of the command line option letters - (see OPTIONS below), this will change the setting - of that option and print a message describing the - new setting. If a ^P (CONTROL-P) is entered imme­ - diately after the dash, the setting of the option - is changed but no message is printed. If the - option letter has a numeric value (such as -b or - -h), or a string value (such as -P or -t), a new - value may be entered after the option letter. If - no new value is entered, a message describing the - current setting is printed and nothing is changed. + - Followed by one of the command line option letters (see OPTIONS + below), this will change the setting of that option and print a + message describing the new setting. If a ^P (CONTROL-P) is + entered immediately after the dash, the setting of the option is + changed but no message is printed. If the option letter has a + numeric value (such as -b or -h), or a string value (such as -P + or -t), a new value may be entered after the option letter. If + no new value is entered, a message describing the current set- + ting is printed and nothing is changed. - -- Like the - command, but takes a long option name - (see OPTIONS below) rather than a single option - letter. You must press RETURN after typing the - option name. A ^P immediately after the second - dash suppresses printing of a message describing - the new setting, as in the - command. + -- Like the - command, but takes a long option name (see OPTIONS + below) rather than a single option letter. You must press + RETURN after typing the option name. A ^P immediately after the + second dash suppresses printing of a message describing the new + setting, as in the - command. - -+ Followed by one of the command line option letters - this will reset the option to its default setting - and print a message describing the new setting. - (The "-+_X" command does the same thing as "-+_X" on - the command line.) This does not work for string- - valued options. - - --+ Like the -+ command, but takes a long option name - rather than a single option letter. - - -! Followed by one of the command line option letters, - this will reset the option to the "opposite" of its - default setting and print a message describing the - new setting. This does not work for numeric or + -+ Followed by one of the command line option letters this will + reset the option to its default setting and print a message + describing the new setting. (The "-+X" command does the same + thing as "-+X" on the command line.) This does not work for string-valued options. - --! Like the -! command, but takes a long option name - rather than a single option letter. + --+ Like the -+ command, but takes a long option name rather than a + single option letter. - _ (Underscore.) Followed by one of the command line - option letters, this will print a message describ­ - ing the current setting of that option. The + -! Followed by one of the command line option letters, this will + reset the option to the "opposite" of its default setting and + print a message describing the new setting. This does not work + for numeric or string-valued options. + --! Like the -! command, but takes a long option name rather than a + single option letter. + _ (Underscore.) Followed by one of the command line option let- + ters, this will print a message describing the current setting + of that option. The setting of the option is not changed. - Version 382: 03 Feb 2004 7 + __ (Double underscore.) Like the _ (underscore) command, but takes + a long option name rather than a single option letter. You must + press RETURN after typing the option name. + +cmd Causes the specified cmd to be executed each time a new file is + examined. For example, +G causes less to initially display each + file starting at the end rather than the beginning. - - - -LESS(1) LESS(1) - - - setting of the option is not changed. - - __ (Double underscore.) Like the _ (underscore) com­ - mand, but takes a long option name rather than a - single option letter. You must press RETURN after - typing the option name. - - +cmd Causes the specified cmd to be executed each time a - new file is examined. For example, +G causes _l_e_s_s - to initially display each file starting at the end - rather than the beginning. - - V Prints the version number of _l_e_s_s being run. + V Prints the version number of less being run. q or Q or :q or :Q or ZZ - Exits _l_e_s_s_. + Exits less. - The following four commands may or may not be valid, - depending on your particular installation. + The following four commands may or may not be valid, depending on your + particular installation. - v Invokes an editor to edit the current file being - viewed. The editor is taken from the environment - variable VISUAL if defined, or EDITOR if VISUAL is - not defined, or defaults to "vi" if neither VISUAL - nor EDITOR is defined. See also the discussion of + v Invokes an editor to edit the current file being viewed. The + editor is taken from the environment variable VISUAL if defined, + or EDITOR if VISUAL is not defined, or defaults to "vi" if nei- + ther VISUAL nor EDITOR is defined. See also the discussion of LESSEDIT under the section on PROMPTS below. ! shell-command - Invokes a shell to run the shell-command given. A - percent sign (%) in the command is replaced by the - name of the current file. A pound sign (#) is - replaced by the name of the previously examined - file. "!!" repeats the last shell command. "!" - with no shell command simply invokes a shell. On - Unix systems, the shell is taken from the environ­ - ment variable SHELL, or defaults to "sh". On MS- - DOS and OS/2 systems, the shell is the normal com­ - mand processor. + Invokes a shell to run the shell-command given. A percent sign + (%) in the command is replaced by the name of the current file. + A pound sign (#) is replaced by the name of the previously exam- + ined file. "!!" repeats the last shell command. "!" with no + shell command simply invokes a shell. On Unix systems, the + shell is taken from the environment variable SHELL, or defaults + to "sh". On MS-DOS and OS/2 systems, the shell is the normal + command processor. | shell-command - represents any mark letter. Pipes a section of - the input file to the given shell command. The - section of the file to be piped is between the - first line on the current screen and the position - marked by the letter. may also be ^ or $ to - indicate beginning or end of file respectively. If - is . or newline, the current screen is piped. + represents any mark letter. Pipes a section of the input + file to the given shell command. The section of the file to be + piped is between the first line on the current screen and the + position marked by the letter. may also be ^ or $ to indi- + cate beginning or end of file respectively. If is . or new- + line, the current screen is piped. s filename - Save the input to a file. This only works if the - input is a pipe, not an ordinary file. + Save the input to a file. This only works if the input is a + pipe, not an ordinary file. +OPTIONS + Command line options are described below. Most options may be changed + while less is running, via the "-" command. + Most options may be given in one of two forms: either a dash followed + by a single letter, or two dashes followed by a long option name. A + long option name may be abbreviated as long as the abbreviation is + unambiguous. For example, --quit-at-eof may be abbreviated --quit, but + not --qui, since both --quit-at-eof and --quiet begin with --qui. Some + long option names are in uppercase, such as --QUIT-AT-EOF, as distinct + from --quit-at-eof. Such option names need only have their first let- + ter capitalized; the remainder of the name may be in either case. For + example, --Quit-at-eof is equivalent to --QUIT-AT-EOF. - - Version 382: 03 Feb 2004 8 - - - - - -LESS(1) LESS(1) - - -OOPPTTIIOONNSS - Command line options are described below. Most options - may be changed while _l_e_s_s is running, via the "-" command. - - Most options may be given in one of two forms: either a - dash followed by a single letter, or two dashes followed - by a long option name. A long option name may be abbrevi­ - ated as long as the abbreviation is unambiguous. For - example, --quit-at-eof may be abbreviated --quit, but not - --qui, since both --quit-at-eof and --quiet begin with - --qui. Some long option names are in uppercase, such as - --QUIT-AT-EOF, as distinct from --quit-at-eof. Such - option names need only have their first letter capital­ - ized; the remainder of the name may be in either case. - For example, --Quit-at-eof is equivalent to --QUIT-AT-EOF. - - Options are also taken from the environment variable - "LESS". For example, to avoid typing "less -options ..." - each time _l_e_s_s is invoked, you might tell _c_s_h_: + Options are also taken from the environment variable "LESS". For exam- + ple, to avoid typing "less -options ..." each time less is invoked, you + might tell csh: setenv LESS "-options" - or if you use _s_h_: + or if you use sh: LESS="-options"; export LESS - On MS-DOS, you don't need the quotes, but you should - replace any percent signs in the options string by double - percent signs. + On MS-DOS, you don't need the quotes, but you should replace any per- + cent signs in the options string by double percent signs. - The environment variable is parsed before the command - line, so command line options override the LESS environ­ - ment variable. If an option appears in the LESS variable, - it can be reset to its default value on the command line - by beginning the command line option with "-+". + The environment variable is parsed before the command line, so command + line options override the LESS environment variable. If an option + appears in the LESS variable, it can be reset to its default value on + the command line by beginning the command line option with "-+". - For options like -P or -D which take a following string, a - dollar sign ($) must be used to signal the end of the - string. For example, to set two -D options on MS-DOS, you - must have a dollar sign between them, like this: + For options like -P or -D which take a following string, a dollar sign + ($) must be used to signal the end of the string. For example, to set + two -D options on MS-DOS, you must have a dollar sign between them, + like this: LESS="-Dn9.1$-Ds4.1" -? or --help - This option displays a summary of the commands - accepted by _l_e_s_s (the same as the h command). - (Depending on how your shell interprets the ques­ - tion mark, it may be necessary to quote the ques­ - tion mark, thus: "-\?".) + This option displays a summary of the commands accepted by less + (the same as the h command). (Depending on how your shell + interprets the question mark, it may be necessary to quote the + question mark, thus: "-\?".) -a or --search-skip-screen - Causes searches to start after the last line dis­ - played on the screen, thus skipping all lines + Causes searches to start after the last line displayed on the + screen, thus skipping all lines displayed on the screen. By + default, searches start at the second line on the screen (or + after the last found line; see the -j option). - - - Version 382: 03 Feb 2004 9 - - - - - -LESS(1) LESS(1) - - - displayed on the screen. By default, searches - start at the second line on the screen (or after - the last found line; see the -j option). - - -b_n or --buffers=_n - Specifies the amount of buffer space _l_e_s_s will use - for each file, in units of kilobytes (1024 bytes). - By default 64K of buffer space is used for each - file (unless the file is a pipe; see the -B - option). The -b option specifies instead that _n - kilobytes of buffer space should be used for each - file. If _n is -1, buffer space is unlimited; that - is, the entire file is read into memory. + -bn or --buffers=n + Specifies the amount of buffer space less will use for each + file, in units of kilobytes (1024 bytes). By default 64K of + buffer space is used for each file (unless the file is a pipe; + see the -B option). The -b option specifies instead that n + kilobytes of buffer space should be used for each file. If n is + -1, buffer space is unlimited; that is, the entire file can be + read into memory. -B or --auto-buffers - By default, when data is read from a pipe, buffers - are allocated automatically as needed. If a large - amount of data is read from the pipe, this can - cause a large amount of memory to be allocated. - The -B option disables this automatic allocation of - buffers for pipes, so that only 64K (or the amount - of space specified by the -b option) is used for - the pipe. Warning: use of -B can result in erro­ - neous display, since only the most recently viewed - part of the file is kept in memory; any earlier - data is lost. + By default, when data is read from a pipe, buffers are allocated + automatically as needed. If a large amount of data is read from + the pipe, this can cause a large amount of memory to be allo- + cated. The -B option disables this automatic allocation of + buffers for pipes, so that only 64K (or the amount of space + specified by the -b option) is used for the pipe. Warning: use + of -B can result in erroneous display, since only the most + recently viewed part of the piped data is kept in memory; any + earlier data is lost. -c or --clear-screen - Causes full screen repaints to be painted from the - top line down. By default, full screen repaints - are done by scrolling from the bottom of the - screen. + Causes full screen repaints to be painted from the top line + down. By default, full screen repaints are done by scrolling + from the bottom of the screen. -C or --CLEAR-SCREEN - The -C option is like -c, but the screen is cleared - before it is repainted. + Same as -c, for compatibility with older versions of less. -d or --dumb - The -d option suppresses the error message normally - displayed if the terminal is dumb; that is, lacks - some important capability, such as the ability to - clear the screen or scroll backward. The -d option - does not otherwise change the behavior of _l_e_s_s on a + The -d option suppresses the error message normally displayed if + the terminal is dumb; that is, lacks some important capability, + such as the ability to clear the screen or scroll backward. The + -d option does not otherwise change the behavior of less on a dumb terminal. - -Dxx_c_o_l_o_r or --color=xx_c_o_l_o_r - [MS-DOS only] Sets the color of the text displayed. - xx is a single character which selects the type of - text whose color is being set: n=normal, s=stand­ - out, d=bold, u=underlined, k=blink. _c_o_l_o_r is a - pair of numbers separated by a period. The first - number selects the foreground color and the second - selects the background color of the text. A single - number _N is the same as _N_._0. - - - - Version 382: 03 Feb 2004 10 - - - - - -LESS(1) LESS(1) - + -Dxcolor or --color=xcolor + [MS-DOS only] Sets the color of the text displayed. x is a sin- + gle character which selects the type of text whose color is + being set: n=normal, s=standout, d=bold, u=underlined, k=blink. + color is a pair of numbers separated by a period. The first + number selects the foreground color and the second selects the + background color of the text. A single number N is the same as + N.0. -e or --quit-at-eof - Causes _l_e_s_s to automatically exit the second time - it reaches end-of-file. By default, the only way - to exit _l_e_s_s is via the "q" command. + Causes less to automatically exit the second time it reaches + end-of-file. By default, the only way to exit less is via the + "q" command. -E or --QUIT-AT-EOF - Causes _l_e_s_s to automatically exit the first time it - reaches end-of-file. + Causes less to automatically exit the first time it reaches end- + of-file. -f or --force - Forces non-regular files to be opened. (A non-reg­ - ular file is a directory or a device special file.) - Also suppresses the warning message when a binary - file is opened. By default, _l_e_s_s will refuse to - open non-regular files. + Forces non-regular files to be opened. (A non-regular file is a + directory or a device special file.) Also suppresses the warn- + ing message when a binary file is opened. By default, less will + refuse to open non-regular files. Note that some operating sys- + tems will not allow directories to be read, even if -f is set. -F or --quit-if-one-screen - Causes _l_e_s_s to automatically exit if the entire - file can be displayed on the first screen. + Causes less to automatically exit if the entire file can be dis- + played on the first screen. -g or --hilite-search - Normally, _l_e_s_s will highlight ALL strings which - match the last search command. The -g option - changes this behavior to highlight only the partic­ - ular string which was found by the last search com­ - mand. This can cause _l_e_s_s to run somewhat faster - than the default. + Normally, less will highlight ALL strings which match the last + search command. The -g option changes this behavior to high- + light only the particular string which was found by the last + search command. This can cause less to run somewhat faster than + the default. -G or --HILITE-SEARCH - The -G option suppresses all highlighting of - strings found by search commands. + The -G option suppresses all highlighting of strings found by + search commands. - -h_n or ---max-back-scroll=_n - Specifies a maximum number of lines to scroll back­ - ward. If it is necessary to scroll backward more - than _n lines, the screen is repainted in a forward - direction instead. (If the terminal does not have - the ability to scroll backward, -h0 is implied.) + -hn or --max-back-scroll=n + Specifies a maximum number of lines to scroll backward. If it + is necessary to scroll backward more than n lines, the screen is + repainted in a forward direction instead. (If the terminal does + not have the ability to scroll backward, -h0 is implied.) -i or --ignore-case - Causes searches to ignore case; that is, uppercase - and lowercase are considered identical. This - option is ignored if any uppercase letters appear - in the search pattern; in other words, if a pattern - contains uppercase letters, then that search does - not ignore case. + Causes searches to ignore case; that is, uppercase and lowercase + are considered identical. This option is ignored if any upper- + case letters appear in the search pattern; in other words, if a + pattern contains uppercase letters, then that search does not + ignore case. -I or --IGNORE-CASE - Like -i, but searches ignore case even if the pat­ - tern contains uppercase letters. + Like -i, but searches ignore case even if the pattern contains + uppercase letters. - -j_n or --jump-target=_n - Specifies a line on the screen where the "target" - line is to be positioned. A target line is the - - - - Version 382: 03 Feb 2004 11 - - - - - -LESS(1) LESS(1) - - - object of a text search, tag search, jump to a line - number, jump to a file percentage, or jump to a - marked position. The screen line is specified by a - number: the top line on the screen is 1, the next - is 2, and so on. The number may be negative to - specify a line relative to the bottom of the - screen: the bottom line on the screen is -1, the - second to the bottom is -2, and so on. If the -j - option is used, searches begin at the line immedi­ - ately after the target line. For example, if "-j4" - is used, the target line is the fourth line on the - screen, so searches begin at the fifth line on the - screen. + -jn or --jump-target=n + Specifies a line on the screen where the "target" line is to be + positioned. The target line is the line specified by any com- + mand to search for a pattern, jump to a line number, jump to a + file percentage or jump to a tag. The screen line may be speci- + fied by a number: the top line on the screen is 1, the next is + 2, and so on. The number may be negative to specify a line rel- + ative to the bottom of the screen: the bottom line on the screen + is -1, the second to the bottom is -2, and so on. Alternately, + the screen line may be specified as a fraction of the height of + the screen, starting with a decimal point: .5 is in the middle + of the screen, .3 is three tenths down from the first line, and + so on. If the line is specified as a fraction, the actual line + number is recalculated if the terminal window is resized, so + that the target line remains at the specified fraction of the + screen height. If any form of the -j option is used, forward + searches begin at the line immediately after the target line, + and backward searches begin at the target line. For example, if + "-j4" is used, the target line is the fourth line on the screen, + so forward searches begin at the fifth line on the screen. -J or --status-column - Displays a status column at the left edge of the - screen. The status column shows the lines that - matched the current search. The status column is - also used if the -w or -W option is in effect. + Displays a status column at the left edge of the screen. The + status column shows the lines that matched the current search. + The status column is also used if the -w or -W option is in + effect. - -k_f_i_l_e_n_a_m_e or --lesskey-file=_f_i_l_e_n_a_m_e - Causes _l_e_s_s to open and interpret the named file as - a _l_e_s_s_k_e_y (1) file. Multiple -k options may be - specified. If the LESSKEY or LESSKEY_SYSTEM envi­ - ronment variable is set, or if a lesskey file is - found in a standard place (see KEY BINDINGS), it is - also used as a _l_e_s_s_k_e_y file. + -kfilename or --lesskey-file=filename + Causes less to open and interpret the named file as a lesskey + (1) file. Multiple -k options may be specified. If the LESSKEY + or LESSKEY_SYSTEM environment variable is set, or if a lesskey + file is found in a standard place (see KEY BINDINGS), it is also + used as a lesskey file. + + -K or --quit-on-intr + Causes less to exit immediately when an interrupt character + (usually ^C) is typed. Normally, an interrupt character causes + less to stop whatever it is doing and return to its command + prompt. Note that use of this option makes it impossible to + return to the command prompt from the "F" command. -L or --no-lessopen - Ignore the LESSOPEN environment variable (see the - INPUT PREPROCESSOR section below). This option can - be set from within _l_e_s_s, but it will apply only to - files opened subsequently, not to the file which is - currently open. + Ignore the LESSOPEN environment variable (see the INPUT PREPRO- + CESSOR section below). This option can be set from within less, + but it will apply only to files opened subsequently, not to the + file which is currently open. -m or --long-prompt - Causes _l_e_s_s to prompt verbosely (like _m_o_r_e), with - the percent into the file. By default, _l_e_s_s - prompts with a colon. + Causes less to prompt verbosely (like more), with the percent + into the file. By default, less prompts with a colon. -M or --LONG-PROMPT - Causes _l_e_s_s to prompt even more verbosely than - _m_o_r_e_. + Causes less to prompt even more verbosely than more. -n or --line-numbers - Suppresses line numbers. The default (to use line - numbers) may cause _l_e_s_s to run more slowly in some - cases, especially with a very large input file. - Suppressing line numbers with the -n option will - avoid this problem. Using line numbers means: the - line number will be displayed in the verbose prompt - and in the = command, and the v command will pass - the current line number to the editor (see also the - discussion of LESSEDIT in PROMPTS below). - - - - Version 382: 03 Feb 2004 12 - - - - - -LESS(1) LESS(1) - + Suppresses line numbers. The default (to use line numbers) may + cause less to run more slowly in some cases, especially with a + very large input file. Suppressing line numbers with the -n + option will avoid this problem. Using line numbers means: the + line number will be displayed in the verbose prompt and in the = + command, and the v command will pass the current line number to + the editor (see also the discussion of LESSEDIT in PROMPTS + below). -N or --LINE-NUMBERS - Causes a line number to be displayed at the begin­ - ning of each line in the display. + Causes a line number to be displayed at the beginning of each + line in the display. - -o_f_i_l_e_n_a_m_e or --log-file=_f_i_l_e_n_a_m_e - Causes _l_e_s_s to copy its input to the named file as - it is being viewed. This applies only when the - input file is a pipe, not an ordinary file. If the - file already exists, _l_e_s_s will ask for confirmation - before overwriting it. + -ofilename or --log-file=filename + Causes less to copy its input to the named file as it is being + viewed. This applies only when the input file is a pipe, not an + ordinary file. If the file already exists, less will ask for + confirmation before overwriting it. - -O_f_i_l_e_n_a_m_e or --LOG-FILE=_f_i_l_e_n_a_m_e - The -O option is like -o, but it will overwrite an - existing file without asking for confirmation. + -Ofilename or --LOG-FILE=filename + The -O option is like -o, but it will overwrite an existing file + without asking for confirmation. - If no log file has been specified, the -o and -O - options can be used from within _l_e_s_s to specify a - log file. Without a file name, they will simply - report the name of the log file. The "s" command - is equivalent to specifying -o from within _l_e_s_s_. + If no log file has been specified, the -o and -O options can be + used from within less to specify a log file. Without a file + name, they will simply report the name of the log file. The "s" + command is equivalent to specifying -o from within less. - -p_p_a_t_t_e_r_n or --pattern=_p_a_t_t_e_r_n - The -p option on the command line is equivalent to - specifying +/_p_a_t_t_e_r_n; that is, it tells _l_e_s_s to - start at the first occurrence of _p_a_t_t_e_r_n in the - file. + -ppattern or --pattern=pattern + The -p option on the command line is equivalent to specifying + +/pattern; that is, it tells less to start at the first occur- + rence of pattern in the file. - -P_p_r_o_m_p_t or --prompt=_p_r_o_m_p_t - Provides a way to tailor the three prompt styles to - your own preference. This option would normally be - put in the LESS environment variable, rather than - being typed in with each _l_e_s_s command. Such an - option must either be the last option in the LESS - variable, or be terminated by a dollar sign. -Ps - followed by a string changes the default (short) - prompt to that string. -Pm changes the medium (-m) - prompt. -PM changes the long (-M) prompt. -Ph - changes the prompt for the help screen. -P= - changes the message printed by the = command. -Pw - changes the message printed while waiting for data - (in the F command). All prompt strings consist of - a sequence of letters and special escape sequences. - See the section on PROMPTS for more details. + -Pprompt or --prompt=prompt + Provides a way to tailor the three prompt styles to your own + preference. This option would normally be put in the LESS envi- + ronment variable, rather than being typed in with each less com- + mand. Such an option must either be the last option in the LESS + variable, or be terminated by a dollar sign. -Ps followed by a + string changes the default (short) prompt to that string. -Pm + changes the medium (-m) prompt. -PM changes the long (-M) + prompt. -Ph changes the prompt for the help screen. -P= + changes the message printed by the = command. -Pw changes the + message printed while waiting for data (in the F command). All + prompt strings consist of a sequence of letters and special + escape sequences. See the section on PROMPTS for more details. -q or --quiet or --silent - Causes moderately "quiet" operation: the terminal - bell is not rung if an attempt is made to scroll - past the end of the file or before the beginning of - the file. If the terminal has a "visual bell", it - is used instead. The bell will be rung on certain - other errors, such as typing an invalid character. - The default is to ring the terminal bell in all - such cases. - - - - - Version 382: 03 Feb 2004 13 - - - - - -LESS(1) LESS(1) - + Causes moderately "quiet" operation: the terminal bell is not + rung if an attempt is made to scroll past the end of the file or + before the beginning of the file. If the terminal has a "visual + bell", it is used instead. The bell will be rung on certain + other errors, such as typing an invalid character. The default + is to ring the terminal bell in all such cases. -Q or --QUIET or --SILENT - Causes totally "quiet" operation: the terminal bell - is never rung. + Causes totally "quiet" operation: the terminal bell is never + rung. -r or --raw-control-chars - Causes "raw" control characters to be displayed. - The default is to display control characters using - the caret notation; for example, a control-A (octal - 001) is displayed as "^A". Warning: when the -r - option is used, _l_e_s_s cannot keep track of the - actual appearance of the screen (since this depends - on how the screen responds to each type of control - character). Thus, various display problems may - result, such as long lines being split in the wrong - place. + Causes "raw" control characters to be displayed. The default is + to display control characters using the caret notation; for + example, a control-A (octal 001) is displayed as "^A". Warning: + when the -r option is used, less cannot keep track of the actual + appearance of the screen (since this depends on how the screen + responds to each type of control character). Thus, various dis- + play problems may result, such as long lines being split in the + wrong place. -R or --RAW-CONTROL-CHARS - Like -r, but tries to keep track of the screen - appearance where possible. This works only if the - input consists of normal text and possibly some - ANSI "color" escape sequences, which are sequences - of the form: + Like -r, but only ANSI "color" escape sequences are output in + "raw" form. Unlike -r, the screen appearance is maintained cor- + rectly in most cases. ANSI "color" escape sequences are + sequences of the form: ESC [ ... m - where the "..." is zero or more characters other - than "m". For the purpose of keeping track of - screen appearance, all control characters and all - ANSI color escape sequences are assumed to not move - the cursor. You can make _l_e_s_s think that charac­ - ters other than "m" can end ANSI color escape - sequences by setting the environment variable - LESSANSIENDCHARS to the list of characters which - can end a color escape sequence. + where the "..." is zero or more color specification characters + For the purpose of keeping track of screen appearance, ANSI + color escape sequences are assumed to not move the cursor. You + can make less think that characters other than "m" can end ANSI + color escape sequences by setting the environment variable + LESSANSIENDCHARS to the list of characters which can end a color + escape sequence. And you can make less think that characters + other than the standard ones may appear between the ESC and the + m by setting the environment variable LESSANSIMIDCHARS to the + list of characters which can appear. -s or --squeeze-blank-lines - Causes consecutive blank lines to be squeezed into - a single blank line. This is useful when viewing - _n_r_o_f_f output. + Causes consecutive blank lines to be squeezed into a single + blank line. This is useful when viewing nroff output. -S or --chop-long-lines - Causes lines longer than the screen width to be - chopped rather than folded. That is, the portion - of a long line that does not fit in the screen - width is not shown. The default is to fold long - lines; that is, display the remainder on the next - line. + Causes lines longer than the screen width to be chopped rather + than folded. That is, the portion of a long line that does not + fit in the screen width is not shown. The default is to fold + long lines; that is, display the remainder on the next line. - -t_t_a_g or --tag=_t_a_g - The -t option, followed immediately by a TAG, will - edit the file containing that tag. For this to - work, tag information must be available; for exam­ - ple, there may be a file in the current directory - called "tags", which was previously built by _c_t_a_g_s + -ttag or --tag=tag + The -t option, followed immediately by a TAG, will edit the file + containing that tag. For this to work, tag information must be + available; for example, there may be a file in the current + directory called "tags", which was previously built by ctags (1) + or an equivalent command. If the environment variable LESSGLOB- + ALTAGS is set, it is taken to be the name of a command compati- + ble with global (1), and that command is executed to find the + tag. (See http://www.gnu.org/software/global/global.html). The + -t option may also be specified from within less (using the - + command) as a way of examining a new file. The command ":t" is + equivalent to specifying -t from within less. - - - Version 382: 03 Feb 2004 14 - - - - - -LESS(1) LESS(1) - - - (1) or an equivalent command. If the environment - variable LESSGLOBALTAGS is set, it is taken to be - the name of a command compatible with _g_l_o_b_a_l (1), - and that command is executed to find the tag. (See - http://www.gnu.org/software/global/global.html). - The -t option may also be specified from within - _l_e_s_s (using the - command) as a way of examining a - new file. The command ":t" is equivalent to speci­ - fying -t from within _l_e_s_s_. - - -T_t_a_g_s_f_i_l_e or --tag-file=_t_a_g_s_f_i_l_e + -Ttagsfile or --tag-file=tagsfile Specifies a tags file to be used instead of "tags". -u or --underline-special - Causes backspaces and carriage returns to be - treated as printable characters; that is, they are - sent to the terminal when they appear in the input. + Causes backspaces and carriage returns to be treated as print- + able characters; that is, they are sent to the terminal when + they appear in the input. -U or --UNDERLINE-SPECIAL - Causes backspaces, tabs and carriage returns to be - treated as control characters; that is, they are - handled as specified by the -r option. + Causes backspaces, tabs and carriage returns to be treated as + control characters; that is, they are handled as specified by + the -r option. - By default, if neither -u nor -U is given, - backspaces which appear adjacent to an underscore - character are treated specially: the underlined - text is displayed using the terminal's hardware - underlining capability. Also, backspaces which - appear between two identical characters are treated - specially: the overstruck text is printed using the - terminal's hardware boldface capability. Other - backspaces are deleted, along with the preceding - character. Carriage returns immediately followed - by a newline are deleted. other carriage returns - are handled as specified by the -r option. Text - which is overstruck or underlined can be searched - for if neither -u nor -U is in effect. + By default, if neither -u nor -U is given, backspaces which + appear adjacent to an underscore character are treated spe- + cially: the underlined text is displayed using the terminal's + hardware underlining capability. Also, backspaces which appear + between two identical characters are treated specially: the + overstruck text is printed using the terminal's hardware bold- + face capability. Other backspaces are deleted, along with the + preceding character. Carriage returns immediately followed by a + newline are deleted. other carriage returns are handled as + specified by the -r option. Text which is overstruck or under- + lined can be searched for if neither -u nor -U is in effect. -V or --version - Displays the version number of _l_e_s_s_. + Displays the version number of less. -w or --hilite-unread - Temporarily highlights the first "new" line after a - forward movement of a full page. The first "new" - line is the line immediately following the line - previously at the bottom of the screen. Also high­ - lights the target line after a g or p command. The - highlight is removed at the next command which - causes movement. The entire line is highlighted, - unless the -J option is in effect, in which case - only the status column is highlighted. + Temporarily highlights the first "new" line after a forward + movement of a full page. The first "new" line is the line imme- + diately following the line previously at the bottom of the + screen. Also highlights the target line after a g or p command. + The highlight is removed at the next command which causes move- + ment. The entire line is highlighted, unless the -J option is + in effect, in which case only the status column is highlighted. -W or --HILITE-UNREAD - Like -w, but temporarily highlights the first new + Like -w, but temporarily highlights the first new line after any + forward movement command larger than one line. - - - Version 382: 03 Feb 2004 15 - - - - - -LESS(1) LESS(1) - - - line after any forward movement command larger than - one line. - - -x_n,... or --tabs=_n,... - Sets tab stops. If only one _n is specified, tab - stops are set at multiples of _n. If multiple val­ - ues separated by commas are specified, tab stops - are set at those positions, and then continue with - the same spacing as the last two. For example, - _-_x_9_,_1_7 will set tabs at positions 9, 17, 25, 33, - etc. The default for _n is 8. + -xn,... or --tabs=n,... + Sets tab stops. If only one n is specified, tab stops are set + at multiples of n. If multiple values separated by commas are + specified, tab stops are set at those positions, and then con- + tinue with the same spacing as the last two. For example, + -x9,17 will set tabs at positions 9, 17, 25, 33, etc. The + default for n is 8. -X or --no-init - Disables sending the termcap initialization and - deinitialization strings to the terminal. This is - sometimes desirable if the deinitialization string - does something unnecessary, like clearing the - screen. + Disables sending the termcap initialization and deinitialization + strings to the terminal. This is sometimes desirable if the + deinitialization string does something unnecessary, like clear- + ing the screen. - --no-keypad - Disables sending the keypad initialization and - deinitialization strings to the terminal. This is - sometimes useful if the keypad strings make the - numeric keypad behave in an undesirable manner. - - -y_n or --max-forw-scroll=_n - Specifies a maximum number of lines to scroll for­ - ward. If it is necessary to scroll forward more - than _n lines, the screen is repainted instead. The - -c or -C option may be used to repaint from the top - of the screen if desired. By default, any forward + -yn or --max-forw-scroll=n + Specifies a maximum number of lines to scroll forward. If it is + necessary to scroll forward more than n lines, the screen is + repainted instead. The -c or -C option may be used to repaint + from the top of the screen if desired. By default, any forward movement causes scrolling. - -[z]_n or --window=_n - Changes the default scrolling window size to _n - lines. The default is one screenful. The z and w - commands can also be used to change the window - size. The "z" may be omitted for compatibility - with _m_o_r_e_. If the number _n is negative, it indi­ - cates _n lines less than the current screen size. - For example, if the screen is 24 lines, _-_z_-_4 sets - the scrolling window to 20 lines. If the screen is - resized to 40 lines, the scrolling window automati­ - cally changes to 36 lines. + -[z]n or --window=n + Changes the default scrolling window size to n lines. The + default is one screenful. The z and w commands can also be used + to change the window size. The "z" may be omitted for compati- + bility with some versions of more. If the number n is negative, + it indicates n lines less than the current screen size. For + example, if the screen is 24 lines, -z-4 sets the scrolling win- + dow to 20 lines. If the screen is resized to 40 lines, the + scrolling window automatically changes to 36 lines. - -_"_c_c or --quotes=_c_c - Changes the filename quoting character. This may - be necessary if you are trying to name a file which - contains both spaces and quote characters. Fol­ - lowed by a single character, this changes the quote - character to that character. Filenames containing - a space should then be surrounded by that character - rather than by double quotes. Followed by two - characters, changes the open quote to the first - - - - Version 382: 03 Feb 2004 16 - - - - - -LESS(1) LESS(1) - - - character, and the close quote to the second char­ - acter. Filenames containing a space should then be - preceded by the open quote character and followed - by the close quote character. Note that even after - the quote characters are changed, this option - remains -" (a dash followed by a double quote). + -"cc or --quotes=cc + Changes the filename quoting character. This may be necessary + if you are trying to name a file which contains both spaces and + quote characters. Followed by a single character, this changes + the quote character to that character. Filenames containing a + space should then be surrounded by that character rather than by + double quotes. Followed by two characters, changes the open + quote to the first character, and the close quote to the second + character. Filenames containing a space should then be preceded + by the open quote character and followed by the close quote + character. Note that even after the quote characters are + changed, this option remains -" (a dash followed by a double + quote). -~ or --tilde - Normally lines after end of file are displayed as a - single tilde (~). This option causes lines after - end of file to be displayed as blank lines. + Normally lines after end of file are displayed as a single tilde + (~). This option causes lines after end of file to be displayed + as blank lines. -# or --shift - Specifies the default number of positions to scroll - horizontally in the RIGHTARROW and LEFTARROW com­ - mands. If the number specified is zero, it sets - the default number of positions to one half of the - screen width. + Specifies the default number of positions to scroll horizontally + in the RIGHTARROW and LEFTARROW commands. If the number speci- + fied is zero, it sets the default number of positions to one + half of the screen width. - -- A command line argument of "--" marks the end of - option arguments. Any arguments following this are - interpreted as filenames. This can be useful when - viewing a file whose name begins with a "-" or "+". + --no-keypad + Disables sending the keypad initialization and deinitialization + strings to the terminal. This is sometimes useful if the keypad + strings make the numeric keypad behave in an undesirable manner. - + If a command line option begins with ++, the remain­ - der of that option is taken to be an initial com­ - mand to _l_e_s_s_. For example, +G tells _l_e_s_s to start - at the end of the file rather than the beginning, - and +/xyz tells it to start at the first occurrence - of "xyz" in the file. As a special case, + - acts like +g; that is, it starts the dis­ - play at the specified line number (however, see the - caveat under the "g" command above). If the option - starts with ++, the initial command applies to - every file being viewed, not just the first one. - The + command described previously may also be used - to set (or change) an initial command for every - file. + --follow-name + Normally, if the input file is renamed while an F command is + executing, less will continue to display the contents of the + original file despite its name change. If --follow-name is + specified, during an F command less will periodically attempt to + reopen the file by name. If the reopen succeeds and the file is + a different file from the original (which means that a new file + has been created with the same name as the original (now + renamed) file), less will display the contents of that new file. + + -- A command line argument of "--" marks the end of option argu- + ments. Any arguments following this are interpreted as file- + names. This can be useful when viewing a file whose name begins + with a "-" or "+". + + + If a command line option begins with +, the remainder of that + option is taken to be an initial command to less. For example, + +G tells less to start at the end of the file rather than the + beginning, and +/xyz tells it to start at the first occurrence + of "xyz" in the file. As a special case, + acts like + +g; that is, it starts the display at the specified line + number (however, see the caveat under the "g" command above). + If the option starts with ++, the initial command applies to + every file being viewed, not just the first one. The + command + described previously may also be used to set (or change) an ini- + tial command for every file. -LLIINNEE EEDDIITTIINNGG - When entering command line at the bottom of the screen - (for example, a filename for the :e command, or the pat­ - tern for a search command), certain keys can be used to - manipulate the command line. Most commands have an alter­ - nate form in [ brackets ] which can be used if a key does - not exist on a particular keyboard. (The bracketed forms - do not work in the MS-DOS version.) Any of these special - keys may be entered literally by preceding it with the - "literal" character, either ^V or ^A. A backslash itself - may also be entered literally by entering two backslashes. +LINE EDITING + When entering command line at the bottom of the screen (for example, a + filename for the :e command, or the pattern for a search command), cer- + tain keys can be used to manipulate the command line. Most commands + have an alternate form in [ brackets ] which can be used if a key does + not exist on a particular keyboard. (Note that the forms beginning + with ESC do not work in some MS-DOS and Windows systems because ESC is + the line erase character.) Any of these special keys may be entered + literally by preceding it with the "literal" character, either ^V or + ^A. A backslash itself may also be entered literally by entering two + backslashes. LEFTARROW [ ESC-h ] Move the cursor one space to the left. - - - Version 382: 03 Feb 2004 17 - - - - - -LESS(1) LESS(1) - - RIGHTARROW [ ESC-l ] Move the cursor one space to the right. ^LEFTARROW [ ESC-b or ESC-LEFTARROW ] - (That is, CONTROL and LEFTARROW simultaneously.) - Move the cursor one word to the left. + (That is, CONTROL and LEFTARROW simultaneously.) Move the cur- + sor one word to the left. ^RIGHTARROW [ ESC-w or ESC-RIGHTARROW ] - (That is, CONTROL and RIGHTARROW simultaneously.) - Move the cursor one word to the right. + (That is, CONTROL and RIGHTARROW simultaneously.) Move the cur- + sor one word to the right. HOME [ ESC-0 ] Move the cursor to the beginning of the line. @@ -1144,19 +860,19 @@ LESS(1) LESS(1) Move the cursor to the end of the line. BACKSPACE - Delete the character to the left of the cursor, or - cancel the command if the command line is empty. + Delete the character to the left of the cursor, or cancel the + command if the command line is empty. DELETE or [ ESC-x ] Delete the character under the cursor. ^BACKSPACE [ ESC-BACKSPACE ] - (That is, CONTROL and BACKSPACE simultaneously.) - Delete the word to the left of the cursor. + (That is, CONTROL and BACKSPACE simultaneously.) Delete the + word to the left of the cursor. ^DELETE [ ESC-X or ESC-DELETE ] - (That is, CONTROL and DELETE simultaneously.) - Delete the word under the cursor. + (That is, CONTROL and DELETE simultaneously.) Delete the word + under the cursor. UPARROW [ ESC-k ] Retrieve the previous command line. @@ -1164,143 +880,102 @@ LESS(1) LESS(1) DOWNARROW [ ESC-j ] Retrieve the next command line. - TAB Complete the partial filename to the left of the - cursor. If it matches more than one filename, the - first match is entered into the command line. - Repeated TABs will cycle thru the other matching - filenames. If the completed filename is a direc­ - tory, a "/" is appended to the filename. (On MS- - DOS systems, a "\" is appended.) The environment - variable LESSSEPARATOR can be used to specify a - different character to append to a directory name. + TAB Complete the partial filename to the left of the cursor. If it + matches more than one filename, the first match is entered into + the command line. Repeated TABs will cycle thru the other + matching filenames. If the completed filename is a directory, a + "/" is appended to the filename. (On MS-DOS systems, a "\" is + appended.) The environment variable LESSSEPARATOR can be used + to specify a different character to append to a directory name. BACKTAB [ ESC-TAB ] - Like, TAB, but cycles in the reverse direction thru - the matching filenames. + Like, TAB, but cycles in the reverse direction thru the matching + filenames. - ^L Complete the partial filename to the left of the - cursor. If it matches more than one filename, all - - - - Version 382: 03 Feb 2004 18 - - - - - -LESS(1) LESS(1) - - - matches are entered into the command line (if they - fit). + ^L Complete the partial filename to the left of the cursor. If it + matches more than one filename, all matches are entered into the + command line (if they fit). ^U (Unix and OS/2) or ESC (MS-DOS) - Delete the entire command line, or cancel the com­ - mand if the command line is empty. If you have - changed your line-kill character in Unix to some­ - thing other than ^U, that character is used instead - of ^U. + Delete the entire command line, or cancel the command if the + command line is empty. If you have changed your line-kill char- + acter in Unix to something other than ^U, that character is used + instead of ^U. -KKEEYY BBIINNDDIINNGGSS - You may define your own _l_e_s_s commands by using the program - _l_e_s_s_k_e_y (1) to create a lesskey file. This file specifies - a set of command keys and an action associated with each - key. You may also use _l_e_s_s_k_e_y to change the line-editing - keys (see LINE EDITING), and to set environment variables. - If the environment variable LESSKEY is set, _l_e_s_s uses that - as the name of the lesskey file. Otherwise, _l_e_s_s looks in - a standard place for the lesskey file: On Unix systems, - _l_e_s_s looks for a lesskey file called "$HOME/.less". On - MS-DOS and Windows systems, _l_e_s_s looks for a lesskey file - called "$HOME/_less", and if it is not found there, then - looks for a lesskey file called "_less" in any directory - specified in the PATH environment variable. On OS/2 sys­ - tems, _l_e_s_s looks for a lesskey file called - "$HOME/less.ini", and if it is not found, then looks for a - lesskey file called "less.ini" in any directory specified - in the INIT environment variable, and if it not found - there, then looks for a lesskey file called "less.ini" in - any directory specified in the PATH environment variable. - See the _l_e_s_s_k_e_y manual page for more details. +KEY BINDINGS + You may define your own less commands by using the program lesskey (1) + to create a lesskey file. This file specifies a set of command keys + and an action associated with each key. You may also use lesskey to + change the line-editing keys (see LINE EDITING), and to set environment + variables. If the environment variable LESSKEY is set, less uses that + as the name of the lesskey file. Otherwise, less looks in a standard + place for the lesskey file: On Unix systems, less looks for a lesskey + file called "$HOME/.less". On MS-DOS and Windows systems, less looks + for a lesskey file called "$HOME/_less", and if it is not found there, + then looks for a lesskey file called "_less" in any directory specified + in the PATH environment variable. On OS/2 systems, less looks for a + lesskey file called "$HOME/less.ini", and if it is not found, then + looks for a lesskey file called "less.ini" in any directory specified + in the INIT environment variable, and if it not found there, then looks + for a lesskey file called "less.ini" in any directory specified in the + PATH environment variable. See the lesskey manual page for more + details. - A system-wide lesskey file may also be set up to provide - key bindings. If a key is defined in both a local lesskey - file and in the system-wide file, key bindings in the - local file take precedence over those in the system-wide - file. If the environment variable LESSKEY_SYSTEM is set, - _l_e_s_s uses that as the name of the system-wide lesskey - file. Otherwise, _l_e_s_s looks in a standard place for the - system-wide lesskey file: On Unix systems, the system-wide - lesskey file is /usr/local/etc/sysless. (However, if _l_e_s_s - was built with a different sysconf directory than - /usr/local/etc, that directory is where the sysless file - is found.) On MS-DOS and Windows systems, the system-wide - lesskey file is c:\_sysless. On OS/2 systems, the system- - wide lesskey file is c:\sysless.ini. + A system-wide lesskey file may also be set up to provide key bindings. + If a key is defined in both a local lesskey file and in the system-wide + file, key bindings in the local file take precedence over those in the + system-wide file. If the environment variable LESSKEY_SYSTEM is set, + less uses that as the name of the system-wide lesskey file. Otherwise, + less looks in a standard place for the system-wide lesskey file: On + Unix systems, the system-wide lesskey file is /usr/local/etc/sysless. + (However, if less was built with a different sysconf directory than + /usr/local/etc, that directory is where the sysless file is found.) On + MS-DOS and Windows systems, the system-wide lesskey file is c:\_sys- + less. On OS/2 systems, the system-wide lesskey file is c:\sysless.ini. -IINNPPUUTT PPRREEPPRROOCCEESSSSOORR - You may define an "input preprocessor" for _l_e_s_s_. Before - _l_e_s_s opens a file, it first gives your input preprocessor - a chance to modify the way the contents of the file are - displayed. An input preprocessor is simply an executable +INPUT PREPROCESSOR + You may define an "input preprocessor" for less. Before less opens a + file, it first gives your input preprocessor a chance to modify the way + the contents of the file are displayed. An input preprocessor is sim- + ply an executable program (or shell script), which writes the contents + of the file to a different file, called the replacement file. The con- + tents of the replacement file are then displayed in place of the con- + tents of the original file. However, it will appear to the user as if + the original file is opened; that is, less will display the original + filename as the name of the current file. - - - Version 382: 03 Feb 2004 19 - - - - - -LESS(1) LESS(1) - - - program (or shell script), which writes the contents of - the file to a different file, called the replacement file. - The contents of the replacement file are then displayed in - place of the contents of the original file. However, it - will appear to the user as if the original file is opened; - that is, _l_e_s_s will display the original filename as the - name of the current file. - - An input preprocessor receives one command line argument, - the original filename, as entered by the user. It should - create the replacement file, and when finished, print the - name of the replacement file to its standard output. If - the input preprocessor does not output a replacement file­ - name, _l_e_s_s uses the original file, as normal. The input - preprocessor is not called when viewing standard input. - To set up an input preprocessor, set the LESSOPEN environ­ - ment variable to a command line which will invoke your - input preprocessor. This command line should include one - occurrence of the string "%s", which will be replaced by - the filename when the input preprocessor command is + An input preprocessor receives one command line argument, the original + filename, as entered by the user. It should create the replacement + file, and when finished, print the name of the replacement file to its + standard output. If the input preprocessor does not output a replace- + ment filename, less uses the original file, as normal. The input pre- + processor is not called when viewing standard input. To set up an + input preprocessor, set the LESSOPEN environment variable to a command + line which will invoke your input preprocessor. This command line + should include one occurrence of the string "%s", which will be + replaced by the filename when the input preprocessor command is invoked. - When _l_e_s_s closes a file opened in such a way, it will call - another program, called the input postprocessor, which may - perform any desired clean-up action (such as deleting the - replacement file created by LESSOPEN). This program - receives two command line arguments, the original filename - as entered by the user, and the name of the replacement - file. To set up an input postprocessor, set the LESSCLOSE - environment variable to a command line which will invoke - your input postprocessor. It may include two occurrences - of the string "%s"; the first is replaced with the origi­ - nal name of the file and the second with the name of the - replacement file, which was output by LESSOPEN. + When less closes a file opened in such a way, it will call another pro- + gram, called the input postprocessor, which may perform any desired + clean-up action (such as deleting the replacement file created by + LESSOPEN). This program receives two command line arguments, the orig- + inal filename as entered by the user, and the name of the replacement + file. To set up an input postprocessor, set the LESSCLOSE environment + variable to a command line which will invoke your input postprocessor. + It may include two occurrences of the string "%s"; the first is + replaced with the original name of the file and the second with the + name of the replacement file, which was output by LESSOPEN. - For example, on many Unix systems, these two scripts will - allow you to keep files in compressed format, but still - let _l_e_s_s view them directly: + For example, on many Unix systems, these two scripts will allow you to + keep files in compressed format, but still let less view them directly: lessopen.sh: #! /bin/sh case "$1" in - *.Z) uncompress -c $1 >/tmp/less.$$ 2>/dev/null + *.Z) uncompress - if [ -s /tmp/less.$$ ]; then echo /tmp/less.$$ else @@ -1313,40 +988,26 @@ LESS(1) LESS(1) #! /bin/sh rm $2 + To use these scripts, put them both where they can be executed and set + LESSOPEN="lessopen.sh %s", and LESSCLOSE="lessclose.sh %s %s". More + complex LESSOPEN and LESSCLOSE scripts may be written to accept other + types of compressed files, and so on. + It is also possible to set up an input preprocessor to pipe the file + data directly to less, rather than putting the data into a replacement + file. This avoids the need to decompress the entire file before start- + ing to view it. An input preprocessor that works this way is called an + input pipe. An input pipe, instead of writing the name of a replace- + ment file on its standard output, writes the entire contents of the + replacement file on its standard output. If the input pipe does not + write any characters on its standard output, then there is no replace- + ment file and less uses the original file, as normal. To use an input + pipe, make the first character in the LESSOPEN environment variable a + vertical bar (|) to signify that the input preprocessor is an input + pipe. - Version 382: 03 Feb 2004 20 - - - - - -LESS(1) LESS(1) - - - To use these scripts, put them both where they can be exe­ - cuted and set LESSOPEN="lessopen.sh %s", and - LESSCLOSE="lessclose.sh %s %s". More complex LESSOPEN and - LESSCLOSE scripts may be written to accept other types of - compressed files, and so on. - - It is also possible to set up an input preprocessor to - pipe the file data directly to _l_e_s_s_, rather than putting - the data into a replacement file. This avoids the need to - decompress the entire file before starting to view it. An - input preprocessor that works this way is called an input - pipe. An input pipe, instead of writing the name of a - replacement file on its standard output, writes the entire - contents of the replacement file on its standard output. - If the input pipe does not write any characters on its - standard output, then there is no replacement file and - _l_e_s_s uses the original file, as normal. To use an input - pipe, make the first character in the LESSOPEN environment - variable a vertical bar (|) to signify that the input pre­ - processor is an input pipe. - - For example, on many Unix systems, this script will work - like the previous example scripts: + For example, on many Unix systems, this script will work like the pre- + vious example scripts: lesspipe.sh: #! /bin/sh @@ -1355,54 +1016,40 @@ LESS(1) LESS(1) ;; esac - To use this script, put it where it can be executed and - set LESSOPEN="|lesspipe.sh %s". When an input pipe is - used, a LESSCLOSE postprocessor can be used, but it is - usually not necessary since there is no replacement file - to clean up. In this case, the replacement file name - passed to the LESSCLOSE postprocessor is "-". + To use this script, put it where it can be executed and set + LESSOPEN="|lesspipe.sh %s". When an input pipe is used, a LESSCLOSE + postprocessor can be used, but it is usually not necessary since there + is no replacement file to clean up. In this case, the replacement file + name passed to the LESSCLOSE postprocessor is "-". -NNAATTIIOONNAALL CCHHAARRAACCTTEERR SSEETTSS +NATIONAL CHARACTER SETS There are three types of characters in the input file: normal characters can be displayed directly to the screen. control characters - should not be displayed directly, but are expected - to be found in ordinary text files (such as - backspace and tab). + should not be displayed directly, but are expected to be found + in ordinary text files (such as backspace and tab). binary characters - should not be displayed directly and are not - expected to be found in text files. + should not be displayed directly and are not expected to be + found in text files. + A "character set" is simply a description of which characters are to be + considered normal, control, and binary. The LESSCHARSET environment + variable may be used to select a character set. Possible values for + LESSCHARSET are: - - - Version 382: 03 Feb 2004 21 - - - - - -LESS(1) LESS(1) - - - A "character set" is simply a description of which charac­ - ters are to be considered normal, control, and binary. - The LESSCHARSET environment variable may be used to select - a character set. Possible values for LESSCHARSET are: - - ascii BS, TAB, NL, CR, and formfeed are control charac­ - ters, all chars with values between 32 and 126 are - normal, and all others are binary. + ascii BS, TAB, NL, CR, and formfeed are control characters, all chars + with values between 32 and 126 are normal, and all others are + binary. iso8859 - Selects an ISO 8859 character set. This is the - same as ASCII, except characters between 160 and - 255 are treated as normal characters. + Selects an ISO 8859 character set. This is the same as ASCII, + except characters between 160 and 255 are treated as normal + characters. latin1 Same as iso8859. @@ -1413,48 +1060,39 @@ LESS(1) LESS(1) ebcdic Selects an EBCDIC character set. IBM-1047 - Selects an EBCDIC character set used by OS/390 Unix - Services. This is the EBCDIC analogue of latin1. - You get similar results by setting either LESS­ - CHARSET=IBM-1047 or LC_CTYPE=en_US in your environ­ - ment. + Selects an EBCDIC character set used by OS/390 Unix Services. + This is the EBCDIC analogue of latin1. You get similar results + by setting either LESSCHARSET=IBM-1047 or LC_CTYPE=en_US in your + environment. koi8-r Selects a Russian character set. - next Selects a character set appropriate for NeXT com­ - puters. + next Selects a character set appropriate for NeXT computers. - utf-8 Selects the UTF-8 encoding of the ISO 10646 charac­ - ter set. + utf-8 Selects the UTF-8 encoding of the ISO 10646 character set. + UTF-8 is special in that it supports multi-byte characters in + the input file. It is the only character set that supports + multi-byte characters. - In special cases, it may be desired to tailor _l_e_s_s to use - a character set other than the ones definable by LESS­ - CHARSET. In this case, the environment variable LESS­ - CHARDEF can be used to define a character set. It should - be set to a string where each character in the string rep­ - resents one character in the character set. The character - "." is used for a normal character, "c" for control, and - "b" for binary. A decimal number may be used for repeti­ - tion. For example, "bccc4b." would mean character 0 is - binary, 1, 2 and 3 are control, 4, 5, 6 and 7 are binary, - and 8 is normal. All characters after the last are taken - to be the same as the last, so characters 9 through 255 - would be normal. (This is an example, and does not neces­ - sarily represent any real character set.) + windows + Selects a character set appropriate for Microsoft Windows (cp + 1251). - This table shows the value of LESSCHARDEF which is equiva­ - lent to each of the possible values for LESSCHARSET: - - - - Version 382: 03 Feb 2004 22 - - - - - -LESS(1) LESS(1) + In rare cases, it may be desired to tailor less to use a character set + other than the ones definable by LESSCHARSET. In this case, the envi- + ronment variable LESSCHARDEF can be used to define a character set. It + should be set to a string where each character in the string represents + one character in the character set. The character "." is used for a + normal character, "c" for control, and "b" for binary. A decimal num- + ber may be used for repetition. For example, "bccc4b." would mean + character 0 is binary, 1, 2 and 3 are control, 4, 5, 6 and 7 are + binary, and 8 is normal. All characters after the last are taken to be + the same as the last, so characters 9 through 255 would be normal. + (This is an example, and does not necessarily represent any real char- + acter set.) + This table shows the value of LESSCHARDEF which is equivalent to each + of the possible values for LESSCHARSET: ascii 8bcccbcc18b95.b dos 8bcccbcc12bc5b95.b. @@ -1467,237 +1105,188 @@ LESS(1) LESS(1) latin1 8bcccbcc18b95.33b. next 8bcccbcc18b95.bb125.bb - If neither LESSCHARSET nor LESSCHARDEF is set, but the - string "UTF-8" is found in the LC_ALL, LC_TYPE or LANG - environment variables, then the default character set is - utf-8. + If neither LESSCHARSET nor LESSCHARDEF is set, but any of the strings + "UTF-8", "UTF8", "utf-8" or "utf8" is found in the LC_ALL, LC_TYPE or + LANG environment variables, then the default character set is utf-8. - If that string is not found, but your system supports the - _s_e_t_l_o_c_a_l_e interface, _l_e_s_s will use setlocale to determine - the character set. setlocale is controlled by setting the - LANG or LC_CTYPE environment variables. + If that string is not found, but your system supports the setlocale + interface, less will use setlocale to determine the character set. + setlocale is controlled by setting the LANG or LC_CTYPE environment + variables. - Finally, if the _s_e_t_l_o_c_a_l_e interface is also not available, - the default character set is latin1. + Finally, if the setlocale interface is also not available, the default + character set is latin1. - Control and binary characters are displayed in standout - (reverse video). Each such character is displayed in - caret notation if possible (e.g. ^A for control-A). Caret - notation is used only if inverting the 0100 bit results in - a normal printable character. Otherwise, the character is - displayed as a hex number in angle brackets. This format - can be changed by setting the LESSBINFMT environment vari­ - able. LESSBINFMT may begin with a "*" and one character - to select the display attribute: "*k" is blinking, "*d" is - bold, "*u" is underlined, "*s" is standout, and "*n" is - normal. If LESSBINFMT does not begin with a "*", normal - attribute is assumed. The remainder of LESSBINFMT is a - string which may include one printf-style escape sequence - (a % followed by x, X, o, d, etc.). For example, if LESS­ - BINFMT is "*u[%x]", binary characters are displayed in - underlined hexadecimal surrounded by brackets. The - default if no LESSBINFMT is specified is "*s<%X>". + Control and binary characters are displayed in standout (reverse + video). Each such character is displayed in caret notation if possible + (e.g. ^A for control-A). Caret notation is used only if inverting the + 0100 bit results in a normal printable character. Otherwise, the char- + acter is displayed as a hex number in angle brackets. This format can + be changed by setting the LESSBINFMT environment variable. LESSBINFMT + may begin with a "*" and one character to select the display attribute: + "*k" is blinking, "*d" is bold, "*u" is underlined, "*s" is standout, + and "*n" is normal. If LESSBINFMT does not begin with a "*", normal + attribute is assumed. The remainder of LESSBINFMT is a string which + may include one printf-style escape sequence (a % followed by x, X, o, + d, etc.). For example, if LESSBINFMT is "*u[%x]", binary characters + are displayed in underlined hexadecimal surrounded by brackets. The + default if no LESSBINFMT is specified is "*s<%X>". The default if no + LESSBINFMT is specified is "*s<%02X>". Warning: the result of expand- + ing the character via LESSBINFMT must be less than 31 characters. + + When the character set is utf-8, the LESSUTFBINFMT environment variable + acts similarly to LESSBINFMT but it applies to Unicode code points that + were successfully decoded but are unsuitable for display (e.g., unas- + signed code points). Its default value is "". Note that + LESSUTFBINFMT and LESSBINFMT share their display attribute setting + ("*x") so specifying one will affect both; LESSUTFBINFMT is read after + LESSBINFMT so its setting, if any, will have priority. Problematic + octets in a UTF-8 file (octets of a truncated sequence, octets of a + complete but non-shortest form sequence, illegal octets, and stray + trailing octets) are displayed individually using LESSBINFMT so as to + facilitate diagnostic of how the UTF-8 file is ill-formed. -PPRROOMMPPTTSS - The -P option allows you to tailor the prompt to your - preference. The string given to the -P option replaces - the specified prompt string. Certain characters in the - string are interpreted specially. The prompt mechanism is - rather complicated to provide flexibility, but the ordi­ - nary user need not understand the details of constructing - personalized prompt strings. +PROMPTS + The -P option allows you to tailor the prompt to your preference. The + string given to the -P option replaces the specified prompt string. + Certain characters in the string are interpreted specially. The prompt + mechanism is rather complicated to provide flexibility, but the ordi- + nary user need not understand the details of constructing personalized + prompt strings. - A percent sign followed by a single character is expanded - according to what the following character is: + A percent sign followed by a single character is expanded according to + what the following character is: - - - Version 382: 03 Feb 2004 23 - - - - - -LESS(1) LESS(1) - - - %b_X Replaced by the byte offset into the current input - file. The b is followed by a single character - (shown as _X above) which specifies the line whose - byte offset is to be used. If the character is a - "t", the byte offset of the top line in the display - is used, an "m" means use the middle line, a "b" - means use the bottom line, a "B" means use the line - just after the bottom line, and a "j" means use the - "target" line, as specified by the -j option. + %bX Replaced by the byte offset into the current input file. The b + is followed by a single character (shown as X above) which spec- + ifies the line whose byte offset is to be used. If the charac- + ter is a "t", the byte offset of the top line in the display is + used, an "m" means use the middle line, a "b" means use the bot- + tom line, a "B" means use the line just after the bottom line, + and a "j" means use the "target" line, as specified by the -j + option. %B Replaced by the size of the current input file. - %c Replaced by the column number of the text appearing - in the first column of the screen. + %c Replaced by the column number of the text appearing in the first + column of the screen. - %d_X Replaced by the page number of a line in the input - file. The line to be used is determined by the _X, - as with the %b option. + %dX Replaced by the page number of a line in the input file. The + line to be used is determined by the X, as with the %b option. - %D Replaced by the number of pages in the input file, - or equivalently, the page number of the last line - in the input file. + %D Replaced by the number of pages in the input file, or equiva- + lently, the page number of the last line in the input file. - %E Replaced by the name of the editor (from the VISUAL - environment variable, or the EDITOR environment - variable if VISUAL is not defined). See the dis­ - cussion of the LESSEDIT feature below. + %E Replaced by the name of the editor (from the VISUAL environment + variable, or the EDITOR environment variable if VISUAL is not + defined). See the discussion of the LESSEDIT feature below. %f Replaced by the name of the current input file. - %i Replaced by the index of the current file in the - list of input files. + %i Replaced by the index of the current file in the list of input + files. - %l_X Replaced by the line number of a line in the input - file. The line to be used is determined by the _X, - as with the %b option. + %lX Replaced by the line number of a line in the input file. The + line to be used is determined by the X, as with the %b option. - %L Replaced by the line number of the last line in the - input file. + %L Replaced by the line number of the last line in the input file. %m Replaced by the total number of input files. - %p_X Replaced by the percent into the current input - file, based on byte offsets. The line used is - determined by the _X as with the %b option. + %pX Replaced by the percent into the current input file, based on + byte offsets. The line used is determined by the X as with the + %b option. - %P_X Replaced by the percent into the current input - file, based on line numbers. The line used is - determined by the _X as with the %b option. + %PX Replaced by the percent into the current input file, based on + line numbers. The line used is determined by the X as with the + %b option. %s Same as %B. - %t Causes any trailing spaces to be removed. Usually - used at the end of the string, but may appear + %t Causes any trailing spaces to be removed. Usually used at the + end of the string, but may appear anywhere. + %x Replaced by the name of the next input file in the list. + If any item is unknown (for example, the file size if input is a pipe), + a question mark is printed instead. - Version 382: 03 Feb 2004 24 + The format of the prompt string can be changed depending on certain + conditions. A question mark followed by a single character acts like + an "IF": depending on the following character, a condition is evalu- + ated. If the condition is true, any characters following the question + mark and condition character, up to a period, are included in the + prompt. If the condition is false, such characters are not included. + A colon appearing between the question mark and the period can be used + to establish an "ELSE": any characters between the colon and the period + are included in the string if and only if the IF condition is false. + Condition characters (which follow a question mark) may be: + ?a True if any characters have been included in the prompt so far. - - - -LESS(1) LESS(1) - - - anywhere. - - %x Replaced by the name of the next input file in the - list. - - If any item is unknown (for example, the file size if - input is a pipe), a question mark is printed instead. - - The format of the prompt string can be changed depending - on certain conditions. A question mark followed by a sin­ - gle character acts like an "IF": depending on the follow­ - ing character, a condition is evaluated. If the condition - is true, any characters following the question mark and - condition character, up to a period, are included in the - prompt. If the condition is false, such characters are - not included. A colon appearing between the question mark - and the period can be used to establish an "ELSE": any - characters between the colon and the period are included - in the string if and only if the IF condition is false. - Condition characters (which follow a question mark) may - be: - - ?a True if any characters have been included in the - prompt so far. - - ?b_X True if the byte offset of the specified line is - known. + ?bX True if the byte offset of the specified line is known. ?B True if the size of current input file is known. - ?c True if the text is horizontally shifted (%c is not - zero). + ?c True if the text is horizontally shifted (%c is not zero). - ?d_X True if the page number of the specified line is - known. + ?dX True if the page number of the specified line is known. ?e True if at end-of-file. - ?f True if there is an input filename (that is, if - input is not a pipe). + ?f True if there is an input filename (that is, if input is not a + pipe). - ?l_X True if the line number of the specified line is - known. + ?lX True if the line number of the specified line is known. - ?L True if the line number of the last line in the - file is known. + ?L True if the line number of the last line in the file is known. ?m True if there is more than one input file. - ?n True if this is the first prompt in a new input - file. + ?n True if this is the first prompt in a new input file. - ?p_X True if the percent into the current input file, - based on byte offsets, of the specified line is + ?pX True if the percent into the current input file, based on byte + offsets, of the specified line is known. - - - Version 382: 03 Feb 2004 25 - - - - - -LESS(1) LESS(1) - - - known. - - ?P_X True if the percent into the current input file, - based on line numbers, of the specified line is - known. + ?PX True if the percent into the current input file, based on line + numbers, of the specified line is known. ?s Same as "?B". - ?x True if there is a next input file (that is, if the - current input file is not the last one). + ?x True if there is a next input file (that is, if the current + input file is not the last one). - Any characters other than the special ones (question mark, - colon, period, percent, and backslash) become literally - part of the prompt. Any of the special characters may be - included in the prompt literally by preceding it with a - backslash. + Any characters other than the special ones (question mark, colon, + period, percent, and backslash) become literally part of the prompt. + Any of the special characters may be included in the prompt literally + by preceding it with a backslash. Some examples: ?f%f:Standard input. - This prompt prints the filename, if known; otherwise the - string "Standard input". + This prompt prints the filename, if known; otherwise the string "Stan- + dard input". ?f%f .?ltLine %lt:?pt%pt\%:?btByte %bt:-... - This prompt would print the filename, if known. The file­ - name is followed by the line number, if known, otherwise - the percent if known, otherwise the byte offset if known. - Otherwise, a dash is printed. Notice how each question - mark has a matching period, and how the % after the %pt is - included literally by escaping it with a backslash. + This prompt would print the filename, if known. The filename is fol- + lowed by the line number, if known, otherwise the percent if known, + otherwise the byte offset if known. Otherwise, a dash is printed. + Notice how each question mark has a matching period, and how the % + after the %pt is included literally by escaping it with a backslash. ?n?f%f .?m(file %i of %m) ..?e(END) ?x- Next\: %x..%t - This prints the filename if this is the first prompt in a - file, followed by the "file N of N" message if there is - more than one input file. Then, if we are at end-of-file, - the string "(END)" is printed followed by the name of the - next file, if there is one. Finally, any trailing spaces - are truncated. This is the default prompt. For refer­ - ence, here are the defaults for the other two prompts (-m - and -M respectively). Each is broken into two lines here - for readability only. + This prints the filename if this is the first prompt in a file, fol- + lowed by the "file N of N" message if there is more than one input + file. Then, if we are at end-of-file, the string "(END)" is printed + followed by the name of the next file, if there is one. Finally, any + trailing spaces are truncated. This is the default prompt. For refer- + ence, here are the defaults for the other two prompts (-m and -M + respectively). Each is broken into two lines here for readability + only. ?n?f%f .?m(file %i of %m) ..?e(END) ?x- Next\: %x.: ?pB%pB\%:byte %bB?s/%s...%t @@ -1708,40 +1297,25 @@ LESS(1) LESS(1) And here is the default message produced by the = command: ?f%f .?m(file %i of %m) .?ltlines %lt-%lb?L/%L. . - - - - Version 382: 03 Feb 2004 26 - - - - - -LESS(1) LESS(1) - - byte %bB?s/%s. ?e(END) :?pB%pB\%..%t - The prompt expansion features are also used for another - purpose: if an environment variable LESSEDIT is defined, - it is used as the command to be executed when the v com­ - mand is invoked. The LESSEDIT string is expanded in the - same way as the prompt strings. The default value for + The prompt expansion features are also used for another purpose: if an + environment variable LESSEDIT is defined, it is used as the command to + be executed when the v command is invoked. The LESSEDIT string is + expanded in the same way as the prompt strings. The default value for LESSEDIT is: %E ?lm+%lm. %f - Note that this expands to the editor name, followed by a + - and the line number, followed by the file name. If your - editor does not accept the "+linenumber" syntax, or has - other differences in invocation syntax, the LESSEDIT vari­ - able can be changed to modify this default. + Note that this expands to the editor name, followed by a + and the line + number, followed by the file name. If your editor does not accept the + "+linenumber" syntax, or has other differences in invocation syntax, + the LESSEDIT variable can be changed to modify this default. -SSEECCUURRIITTYY - When the environment variable LESSSECURE is set to 1, _l_e_s_s - runs in a "secure" mode. This means these features are - disabled: +SECURITY + When the environment variable LESSSECURE is set to 1, less runs in a + "secure" mode. This means these features are disabled: ! the shell command @@ -1761,68 +1335,79 @@ SSEECCUURRIITTYY filename completion (TAB, ^L) - Less can also be compiled to be permanently in "secure" - mode. + Less can also be compiled to be permanently in "secure" mode. -EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS - Environment variables may be specified either in the sys­ - tem environment as usual, or in a _l_e_s_s_k_e_y (1) file. If - environment variables are defined in more than one place, - variables defined in a local lesskey file take precedence - over variables defined in the system environment, which - take precedence over variables defined in the system-wide - lesskey file. +COMPATIBILITY WITH MORE + If the environment variable LESS_IS_MORE is set to 1, or if the program + is invoked via a file link named "more", less behaves (mostly) in con- + formance with the POSIX "more" command specification. In this mode, + less behaves differently in these ways: + + The -e option works differently. If the -e option is not set, less + behaves as if the -E option were set. If the -e option is set, less + behaves as if the -e and -F options were set. + + The -m option works differently. If the -m option is not set, the + medium prompt is used, and it is prefixed with the string "--More--". + If the -m option is set, the short prompt is used. + + The -n option acts like the -z option. The normal behavior of the -n + option is unavailable in this mode. + + The parameter to the -p option is taken to be a less command rather + than a search pattern. + + The LESS environment variable is ignored, and the MORE environment + variable is used in its place. - - - Version 382: 03 Feb 2004 27 - - - - - -LESS(1) LESS(1) - +ENVIRONMENT VARIABLES + Environment variables may be specified either in the system environment + as usual, or in a lesskey (1) file. If environment variables are + defined in more than one place, variables defined in a local lesskey + file take precedence over variables defined in the system environment, + which take precedence over variables defined in the system-wide lesskey + file. COLUMNS - Sets the number of columns on the screen. Takes - precedence over the number of columns specified by - the TERM variable. (But if you have a windowing - system which supports TIOCGWINSZ or WIOCGETD, the - window system's idea of the screen size takes - precedence over the LINES and COLUMNS environment - variables.) + Sets the number of columns on the screen. Takes precedence over + the number of columns specified by the TERM variable. (But if + you have a windowing system which supports TIOCGWINSZ or + WIOCGETD, the window system's idea of the screen size takes + precedence over the LINES and COLUMNS environment variables.) EDITOR The name of the editor (used for the v command). - HOME Name of the user's home directory (used to find a - lesskey file on Unix and OS/2 systems). + HOME Name of the user's home directory (used to find a lesskey file + on Unix and OS/2 systems). HOMEDRIVE, HOMEPATH - Concatenation of the HOMEDRIVE and HOMEPATH envi­ - ronment variables is the name of the user's home - directory if the HOME variable is not set (only in - the Windows version). + Concatenation of the HOMEDRIVE and HOMEPATH environment vari- + ables is the name of the user's home directory if the HOME vari- + able is not set (only in the Windows version). - INIT Name of the user's init directory (used to find a - lesskey file on OS/2 systems). + INIT Name of the user's init directory (used to find a lesskey file + on OS/2 systems). LANG Language for determining the character set. LC_CTYPE Language for determining the character set. - LESS Options which are passed to _l_e_s_s automatically. + LESS Options which are passed to less automatically. LESSANSIENDCHARS - Characters which are assumed to end an ANSI color - escape sequence (default "m"). + Characters which may end an ANSI color escape sequence (default + "m"). + + LESSANSIMIDCHARS + Characters which may appear between the ESC character and the + end character in an ANSI color escape sequence (default + "0123456789;[?!"'#%()*+ ". LESSBINFMT - Format for displaying non-printable, non-control - characters. + Format for displaying non-printable, non-control characters. LESSCHARDEF Defines a character set. @@ -1831,36 +1416,33 @@ LESS(1) LESS(1) Selects a predefined character set. LESSCLOSE - Command line to invoke the (optional) input-post­ - processor. + Command line to invoke the (optional) input-postprocessor. LESSECHO - Name of the lessecho program (default "lessecho"). - The lessecho program is needed to expand metachar­ - acters, such as * and ?, in filenames on Unix sys­ - tems. - - - - - Version 382: 03 Feb 2004 28 - - - - - -LESS(1) LESS(1) - + Name of the lessecho program (default "lessecho"). The lessecho + program is needed to expand metacharacters, such as * and ?, in + filenames on Unix systems. LESSEDIT - Editor prototype string (used for the v command). - See discussion under PROMPTS. + Editor prototype string (used for the v command). See discus- + sion under PROMPTS. LESSGLOBALTAGS - Name of the command used by the -t option to find - global tags. Normally should be set to "global" if - your system has the _g_l_o_b_a_l (1) command. If not - set, global tags are not used. + Name of the command used by the -t option to find global tags. + Normally should be set to "global" if your system has the global + (1) command. If not set, global tags are not used. + + LESSHISTFILE + Name of the history file used to remember search commands and + shell commands between invocations of less. If set to "-" or + "/dev/null", a history file is not used. The default is + "$HOME/.lesshst" on Unix systems, "$HOME/_lesshst" on DOS and + Windows systems, or "$HOME/lesshst.ini" or "$INIT/lesshst.ini" + on OS/2 systems. + + LESSHISTSIZE + The maximum number of commands to save in the history file. The + default is 100. LESSKEY Name of the default lesskey(1) file. @@ -1869,178 +1451,80 @@ LESS(1) LESS(1) Name of the default system-wide lesskey(1) file. LESSMETACHARS - List of characters which are considered "metachar­ - acters" by the shell. + List of characters which are considered "metacharacters" by the + shell. LESSMETAESCAPE - Prefix which less will add before each metacharac­ - ter in a command sent to the shell. If LESS­ - METAESCAPE is an empty string, commands containing - metacharacters will not be passed to the shell. + Prefix which less will add before each metacharacter in a com- + mand sent to the shell. If LESSMETAESCAPE is an empty string, + commands containing metacharacters will not be passed to the + shell. LESSOPEN - Command line to invoke the (optional) input-prepro­ - cessor. + Command line to invoke the (optional) input-preprocessor. LESSSECURE - Runs less in "secure" mode. See discussion under - SECURITY. + Runs less in "secure" mode. See discussion under SECURITY. LESSSEPARATOR - String to be appended to a directory name in file­ - name completion. + String to be appended to a directory name in filename comple- + tion. - LINES Sets the number of lines on the screen. Takes - precedence over the number of lines specified by - the TERM variable. (But if you have a windowing - system which supports TIOCGWINSZ or WIOCGETD, the - window system's idea of the screen size takes - precedence over the LINES and COLUMNS environment - variables.) + LESSUTFBINFMT + Format for displaying non-printable Unicode code points. - PATH User's search path (used to find a lesskey file on - MS-DOS and OS/2 systems). + LESS_IS_MORE + Emulate the more (1) command. - SHELL The shell used to execute the ! command, as well as - to expand filenames. + LINES Sets the number of lines on the screen. Takes precedence over + the number of lines specified by the TERM variable. (But if you + have a windowing system which supports TIOCGWINSZ or WIOCGETD, + the window system's idea of the screen size takes precedence + over the LINES and COLUMNS environment variables.) - TERM The type of terminal on which _l_e_s_s is being run. + PATH User's search path (used to find a lesskey file on MS-DOS and + OS/2 systems). + SHELL The shell used to execute the ! command, as well as to expand + filenames. - - - Version 382: 03 Feb 2004 29 - - - - - -LESS(1) LESS(1) - + TERM The type of terminal on which less is being run. VISUAL The name of the editor (used for the v command). -SSEEEE AALLSSOO +SEE ALSO lesskey(1) -WWAARRNNIINNGGSS - The = command and prompts (unless changed by -P) report - the line numbers of the lines at the top and bottom of the - screen, but the byte and percent of the line after the one - at the bottom of the screen. +COPYRIGHT + Copyright (C) 1984-2007 Mark Nudelman - If the :e command is used to name more than one file, and - one of the named files has been viewed previously, the new - files may be entered into the list in an unexpected order. + less is part of the GNU project and is free software. You can redis- + tribute it and/or modify it under the terms of either (1) the GNU Gen- + eral Public License as published by the Free Software Foundation; or + (2) the Less License. See the file README in the less distribution for + more details regarding redistribution. You should have received a copy + of the GNU General Public License along with the source for less; see + the file COPYING. If not, write to the Free Software Foundation, 59 + Temple Place, Suite 330, Boston, MA 02111-1307, USA. You should also + have received a copy of the Less License; see the file LICENSE. - On certain older terminals (the so-called "magic cookie" - terminals), search highlighting will cause an erroneous - display. On such terminals, search highlighting is dis­ - abled by default to avoid possible problems. - - In certain cases, when search highlighting is enabled and - a search pattern begins with a ^, more text than the - matching string may be highlighted. (This problem does - not occur when less is compiled to use the POSIX regular - expression package.) - - When viewing text containing ANSI color escape sequences - using the -R option, searching will not find text contain­ - ing an embedded escape sequence. Also, search highlight­ - ing may change the color of some of the text which follows - the highlighted text. - - On some systems, _s_e_t_l_o_c_a_l_e claims that ASCII characters 0 - thru 31 are control characters rather than binary charac­ - ters. This causes _l_e_s_s to treat some binary files as - ordinary, non-binary files. To workaround this problem, - set the environment variable LESSCHARSET to "ascii" (or - whatever character set is appropriate). - - See http://www.greenwoodsoftware.com/less for the latest - list of known bugs in this version of less. + less is distributed in the hope that it will be useful, but WITHOUT ANY + WARRANTY; without even the implied warranty of MERCHANTABILITY or FIT- + NESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + more details. -CCOOPPYYRRIIGGHHTT - Copyright (C) 2002 Mark Nudelman - - less is part of the GNU project and is free software. You - can redistribute it and/or modify it under the terms of - either (1) the GNU General Public License as published by - the Free Software Foundation; or (2) the Less License. - See the file README in the less distribution for more - details regarding redistribution. You should have - - - - Version 382: 03 Feb 2004 30 - - - - - -LESS(1) LESS(1) - - - received a copy of the GNU General Public License along - with the source for less; see the file COPYING. If not, - write to the Free Software Foundation, 59 Temple Place, - Suite 330, Boston, MA 02111-1307, USA. You should also - have received a copy of the Less License; see the file - LICENSE. - - less is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied war­ - ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR­ - POSE. See the GNU General Public License for more - details. - - -AAUUTTHHOORR +AUTHOR Mark Nudelman - Send bug reports or comments to the above address or to + See http://www.greenwoodsoftware.com/less/bugs.html for the latest list + of known bugs in less. + Send bug reports or comments to the above address or to bug-less@gnu.org. - For more information, see the less homepage at + For more information, see the less homepage at http://www.greenwoodsoftware.com/less. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Version 382: 03 Feb 2004 31 - - + Version 418: 02 Jan 2008 LESS(1) diff --git a/src/bin/less/less.nro b/src/bin/less/less.nro index 940c59c23e..c0d42f4cb0 100644 --- a/src/bin/less/less.nro +++ b/src/bin/less/less.nro @@ -1,24 +1,24 @@ -.TH LESS 1 "Version 382: 03 Feb 2004" +.TH LESS 1 "Version 418: 02 Jan 2008" .SH NAME less \- opposite of more .SH SYNOPSIS -.B "less -?" +.B "less \-?" .br -.B "less --help" +.B "less \-\-help" .br -.B "less -V" +.B "less \-V" .br -.B "less --version" +.B "less \-\-version" .br -.B "less [-[+]aBcCdeEfFgGiIJLmMnNqQrRsSuUVwWX~]" +.B "less [\-[+]aBcCdeEfFgGiIJKLmMnNqQrRsSuUVwWX~]" .br -.B " [-b \fIspace\fP] [-h \fIlines\fP] [-j \fIline\fP] [-k \fIkeyfile\fP]" +.B " [\-b \fIspace\fP] [\-h \fIlines\fP] [\-j \fIline\fP] [\-k \fIkeyfile\fP]" .br -.B " [-{oO} \fIlogfile\fP] [-p \fIpattern\fP] [-P \fIprompt\fP] [-t \fItag\fP]" +.B " [\-{oO} \fIlogfile\fP] [\-p \fIpattern\fP] [\-P \fIprompt\fP] [\-t \fItag\fP]" .br -.B " [-T \fItagsfile\fP] [-x \fItab\fP,...] [-y \fIlines\fP] [-[z] \fIlines\fP]" +.B " [\-T \fItagsfile\fP] [\-x \fItab\fP,...] [\-y \fIlines\fP] [\-[z] \fIlines\fP]" .br -.B " [-# \fIshift\fP] [+[+]\fIcmd\fP] [--] [\fIfilename\fP]..." +.B " [\-# \fIshift\fP] [+[+]\fIcmd\fP] [\-\-] [\fIfilename\fP]..." .br (See the OPTIONS section for alternate option syntax with long option names.) @@ -57,7 +57,7 @@ two character sequence "ESCAPE", then "v". Help: display a summary of these commands. If you forget all the other commands, remember this one. .IP "SPACE or ^V or f or ^F" -Scroll forward N lines, default one window (see option -z below). +Scroll forward N lines, default one window (see option \-z below). If N is more than the screen size, only the final screenful is displayed. Warning: some systems use ^V as a special literalization character. .IP "z" @@ -73,7 +73,7 @@ Scroll forward N lines, default one half of the screen size. If N is specified, it becomes the new default for subsequent d and u commands. .IP "b or ^B or ESC-v" -Scroll backward N lines, default one window (see option -z below). +Scroll backward N lines, default one window (see option \-z below). If N is more than the screen size, only the final screenful is displayed. .IP "w" Like ESC-v, but if N is specified, it becomes the new window size. @@ -87,14 +87,14 @@ If N is specified, it becomes the new default for subsequent d and u commands. .IP "ESC-) or RIGHTARROW" Scroll horizontally right N characters, default half the screen width -(see the -# option). +(see the \-# option). If a number N is specified, it becomes the default for future RIGHTARROW and LEFTARROW commands. -While the text is scrolled, it acts as though the -S option +While the text is scrolled, it acts as though the \-S option (chop lines) were in effect. .IP "ESC-( or LEFTARROW" Scroll horizontally left N characters, default half the screen width -(see the -# option). +(see the \-# option). If a number N is specified, it becomes the default for future RIGHTARROW and LEFTARROW commands. .IP "r or ^R or ^L" @@ -108,7 +108,7 @@ end of file is reached. Normally this command would be used when already at the end of the file. It is a way to monitor the tail of a file which is growing while it is being viewed. -(The behavior is similar to the "tail -f" command.) +(The behavior is similar to the "tail \-f" command.) .IP "g or < or ESC-<" Go to line N in the file, default 1 (beginning of file). (Warning: this may be slow if N is large.) @@ -119,7 +119,9 @@ or if N is not specified and standard input, rather than a file, is being read.) .IP "p or %" Go to a position N percent into the file. -N should be between 0 and 100. +N should be between 0 and 100, and may contain a decimal point. +.IP "P" +Go to the line containing byte offset N in the file. .IP "{" If a left curly bracket appears in the top line displayed on the screen, @@ -175,9 +177,9 @@ Same as single quote. Search forward in the file for the N-th line containing the pattern. N defaults to 1. The pattern is a regular expression, as recognized by -.I ed. +the regular expression library supplied by your system. The search starts at the second line displayed -(but see the -a and -j options, which change this). +(but see the \-a and \-j options, which change this). .sp Certain characters are special if entered at the beginning of the pattern; @@ -194,7 +196,7 @@ the search continues in the next file in the command line list. Begin the search at the first line of the FIRST file in the command line list, regardless of what is currently displayed on the screen -or the settings of the -a or -j options. +or the settings of the \-a or \-j options. .IP "^K" Highlight any text which matches the pattern on the current screen, but don't move to the first match (KEEP current position). @@ -219,7 +221,7 @@ the search continues in the previous file in the command line list. Begin the search at the last line of the last file in the command line list, regardless of what is currently displayed on the screen -or the settings of the -a or -j options. +or the settings of the \-a or \-j options. .IP "^K" As in forward searches. .IP "^R" @@ -252,7 +254,7 @@ Turn off highlighting of strings matching the current search pattern. If highlighting is already off because of a previous ESC-u command, turn highlighting back on. Any search command will also turn highlighting back on. -(Highlighting can also be disabled by toggling the -G option; +(Highlighting can also be disabled by toggling the \-G option; in that case search commands do not turn highlighting back on.) .IP ":e [filename]" Examine a new file. @@ -272,7 +274,7 @@ If the filename consists of several files, they are all inserted into the list of files and the first one is examined. If the filename contains one or more spaces, the entire filename should be enclosed in double quotes -(also see the -" option). +(also see the \-" option). .IP "^X^V or E" Same as :e. Warning: some systems use ^V as a special literalization character. @@ -306,8 +308,8 @@ this will change the setting of that option and print a message describing the new setting. If a ^P (CONTROL-P) is entered immediately after the dash, the setting of the option is changed but no message is printed. -If the option letter has a numeric value (such as -b or -h), -or a string value (such as -P or -t), +If the option letter has a numeric value (such as \-b or \-h), +or a string value (such as \-P or \-t), a new value may be entered after the option letter. If no new value is entered, a message describing the current setting is printed and nothing is changed. @@ -401,17 +403,17 @@ either a dash followed by a single letter, or two dashes followed by a long option name. A long option name may be abbreviated as long as the abbreviation is unambiguous. -For example, --quit-at-eof may be abbreviated --quit, but not ---qui, since both --quit-at-eof and --quiet begin with --qui. -Some long option names are in uppercase, such as --QUIT-AT-EOF, as -distinct from --quit-at-eof. +For example, \-\-quit-at-eof may be abbreviated \-\-quit, but not +--qui, since both \-\-quit-at-eof and \-\-quiet begin with \-\-qui. +Some long option names are in uppercase, such as \-\-QUIT-AT-EOF, as +distinct from \-\-quit-at-eof. Such option names need only have their first letter capitalized; the remainder of the name may be in either case. -For example, --Quit-at-eof is equivalent to --QUIT-AT-EOF. +For example, \-\-Quit-at-eof is equivalent to \-\-QUIT-AT-EOF. .PP Options are also taken from the environment variable "LESS". For example, -to avoid typing "less -options ..." each time +to avoid typing "less \-options ..." each time .I less is invoked, you might tell .I csh: @@ -432,62 +434,63 @@ If an option appears in the LESS variable, it can be reset to its default value on the command line by beginning the command line option with "\-+". .sp -For options like -P or -D which take a following string, +For options like \-P or \-D which take a following string, a dollar sign ($) must be used to signal the end of the string. -For example, to set two -D options on MS-DOS, you must have +For example, to set two \-D options on MS-DOS, you must have a dollar sign between them, like this: .sp LESS="-Dn9.1$-Ds4.1" .sp -.IP "-? or --help" +.IP "\-? or \-\-help" This option displays a summary of the commands accepted by .I less (the same as the h command). (Depending on how your shell interprets the question mark, -it may be necessary to quote the question mark, thus: "-\e?".) -.IP "-a or --search-skip-screen" +it may be necessary to quote the question mark, thus: "\-\e?".) +.IP "\-a or \-\-search-skip-screen" Causes searches to start after the last line displayed on the screen, thus skipping all lines displayed on the screen. By default, searches start at the second line on the screen -(or after the last found line; see the -j option). -.IP "-b\fIn\fP or --buffers=\fIn\fP" +(or after the last found line; see the \-j option). +.IP "\-b\fIn\fP or \-\-buffers=\fIn\fP" Specifies the amount of buffer space .I less will use for each file, in units of kilobytes (1024 bytes). By default 64K of buffer space is used for each file -(unless the file is a pipe; see the -B option). -The -b option specifies instead that \fIn\fP kilobytes of +(unless the file is a pipe; see the \-B option). +The \-b option specifies instead that \fIn\fP kilobytes of buffer space should be used for each file. -If \fIn\fP is -1, buffer space is unlimited; that is, -the entire file is read into memory. -.IP "-B or --auto-buffers" +If \fIn\fP is \-1, buffer space is unlimited; that is, +the entire file can be read into memory. +.IP "\-B or \-\-auto-buffers" By default, when data is read from a pipe, buffers are allocated automatically as needed. If a large amount of data is read from the pipe, this can cause a large amount of memory to be allocated. -The -B option disables this automatic allocation of buffers for pipes, +The \-B option disables this automatic allocation of buffers for pipes, so that only 64K -(or the amount of space specified by the -b option) +(or the amount of space specified by the \-b option) is used for the pipe. -Warning: use of -B can result in erroneous display, since only the -most recently viewed part of the file is kept in memory; +Warning: use of \-B can result in erroneous display, since only the +most recently viewed part of the piped data is kept in memory; any earlier data is lost. -.IP "-c or --clear-screen" +.IP "\-c or \-\-clear-screen" Causes full screen repaints to be painted from the top line down. By default, full screen repaints are done by scrolling from the bottom of the screen. -.IP "-C or --CLEAR-SCREEN" -The -C option is like -c, but the screen is cleared before it is repainted. -.IP "-d or --dumb" -The -d option suppresses the error message +.IP "\-C or \-\-CLEAR-SCREEN" +Same as \-c, for compatibility with older versions of +.I less. +.IP "\-d or \-\-dumb" +The \-d option suppresses the error message normally displayed if the terminal is dumb; that is, lacks some important capability, such as the ability to clear the screen or scroll backward. -The -d option does not otherwise change the behavior of +The \-d option does not otherwise change the behavior of .I less on a dumb terminal. -.IP "-D\fBx\fP\fIcolor\fP or --color=\fBx\fP\fIcolor\fP" +.IP "\-D\fBx\fP\fIcolor\fP or \-\-color=\fBx\fP\fIcolor\fP" [MS-DOS only] Sets the color of the text displayed. \fBx\fP is a single character which selects the type of text whose color is @@ -496,7 +499,7 @@ being set: n=normal, s=standout, d=bold, u=underlined, k=blink. The first number selects the foreground color and the second selects the background color of the text. A single number \fIN\fP is the same as \fIN.0\fP. -.IP "-e or --quit-at-eof" +.IP "\-e or \-\-quit-at-eof" Causes .I less to automatically exit @@ -504,88 +507,106 @@ the second time it reaches end-of-file. By default, the only way to exit .I less is via the "q" command. -.IP "-E or --QUIT-AT-EOF" +.IP "\-E or \-\-QUIT-AT-EOF" Causes .I less to automatically exit the first time it reaches end-of-file. -.IP "-f or --force" +.IP "\-f or \-\-force" Forces non-regular files to be opened. (A non-regular file is a directory or a device special file.) Also suppresses the warning message when a binary file is opened. By default, .I less will refuse to open non-regular files. -.IP "-F or --quit-if-one-screen" +Note that some operating systems will not allow directories +to be read, even if \-f is set. +.IP "\-F or \-\-quit-if-one-screen" Causes .I less to automatically exit if the entire file can be displayed on the first screen. -.IP "-g or --hilite-search" +.IP "\-g or \-\-hilite-search" Normally, .I less will highlight ALL strings which match the last search command. -The -g option changes this behavior to highlight only the particular string +The \-g option changes this behavior to highlight only the particular string which was found by the last search command. This can cause .I less to run somewhat faster than the default. -.IP "-G or --HILITE-SEARCH" -The -G option suppresses all highlighting of strings found by search commands. -.IP "-h\fIn\fP or ---max-back-scroll=\fIn\fP" +.IP "\-G or \-\-HILITE-SEARCH" +The \-G option suppresses all highlighting of strings found by search commands. +.IP "\-h\fIn\fP or \-\-max-back-scroll=\fIn\fP" Specifies a maximum number of lines to scroll backward. If it is necessary to scroll backward more than \fIn\fP lines, the screen is repainted in a forward direction instead. (If the terminal does not have the ability to scroll -backward, -h0 is implied.) -.IP "-i or --ignore-case" +backward, \-h0 is implied.) +.IP "\-i or \-\-ignore-case" Causes searches to ignore case; that is, uppercase and lowercase are considered identical. This option is ignored if any uppercase letters appear in the search pattern; in other words, if a pattern contains uppercase letters, then that search does not ignore case. -.IP "-I or --IGNORE-CASE" -Like -i, but searches ignore case even if +.IP "\-I or \-\-IGNORE-CASE" +Like \-i, but searches ignore case even if the pattern contains uppercase letters. -.IP "-j\fIn\fP or --jump-target=\fIn\fP" +.IP "\-j\fIn\fP or \-\-jump-target=\fIn\fP" Specifies a line on the screen where the "target" line is to be positioned. -A target line is the object of a text search, -tag search, jump to a line number, -jump to a file percentage, or jump to a marked position. -The screen line is specified by a number: the top line on the screen +The target line is the line specified by any command to +search for a pattern, jump to a line number, +jump to a file percentage or jump to a tag. +The screen line may be specified by a number: the top line on the screen is 1, the next is 2, and so on. The number may be negative to specify a line relative to the bottom -of the screen: the bottom line on the screen is -1, the second -to the bottom is -2, and so on. -If the -j option is used, searches begin at the line immediately -after the target line. -For example, if "-j4" is used, the target line is the -fourth line on the screen, so searches begin at the fifth line +of the screen: the bottom line on the screen is \-1, the second +to the bottom is \-2, and so on. +Alternately, the screen line may be specified as a fraction of the height +of the screen, starting with a decimal point: .5 is in the middle of the +screen, .3 is three tenths down from the first line, and so on. +If the line is specified as a fraction, the actual line number +is recalculated if the terminal window is resized, so that the +target line remains at the specified fraction of the screen height. +If any form of the \-j option is used, +forward searches begin at the line immediately after the target line, +and backward searches begin at the target line. +For example, if "\-j4" is used, the target line is the +fourth line on the screen, so forward searches begin at the fifth line on the screen. -.IP "-J or --status-column" +.IP "\-J or \-\-status-column" Displays a status column at the left edge of the screen. The status column shows the lines that matched the current search. -The status column is also used if the -w or -W option is in effect. -.IP "-k\fIfilename\fP or --lesskey-file=\fIfilename\fP" +The status column is also used if the \-w or \-W option is in effect. +.IP "\-k\fIfilename\fP or \-\-lesskey-file=\fIfilename\fP" Causes .I less to open and interpret the named file as a .I lesskey (1) file. -Multiple -k options may be specified. +Multiple \-k options may be specified. If the LESSKEY or LESSKEY_SYSTEM environment variable is set, or if a lesskey file is found in a standard place (see KEY BINDINGS), it is also used as a .I lesskey file. -.IP "-L or --no-lessopen" +.IP "\-K or \-\-quit-on-intr" +Causes +.I less +to exit immediately when an interrupt character (usually ^C) is typed. +Normally, an interrupt character causes +.I less +to stop whatever it is doing and return to its command prompt. +Note that use of this option makes it impossible to return to the +command prompt from the "F" command. +.IP "\-L or \-\-no-lessopen" Ignore the LESSOPEN environment variable (see the INPUT PREPROCESSOR section below). This option can be set from within \fIless\fP, but it will apply only to files opened subsequently, not to the file which is currently open. -.IP "-m or --long-prompt" +.IP "\-m or \-\-long-prompt" Causes .I less to prompt verbosely (like \fImore\fP), @@ -593,25 +614,25 @@ with the percent into the file. By default, .I less prompts with a colon. -.IP "-M or --LONG-PROMPT" +.IP "\-M or \-\-LONG-PROMPT" Causes .I less to prompt even more verbosely than .I more. -.IP "-n or --line-numbers" +.IP "\-n or \-\-line-numbers" Suppresses line numbers. The default (to use line numbers) may cause .I less to run more slowly in some cases, especially with a very large input file. -Suppressing line numbers with the -n option will avoid this problem. +Suppressing line numbers with the \-n option will avoid this problem. Using line numbers means: the line number will be displayed in the verbose prompt and in the = command, and the v command will pass the current line number to the editor (see also the discussion of LESSEDIT in PROMPTS below). -.IP "-N or --LINE-NUMBERS" +.IP "\-N or \-\-LINE-NUMBERS" Causes a line number to be displayed at the beginning of each line in the display. -.IP "-o\fIfilename\fP or --log-file=\fIfilename\fP" +.IP "\-o\fIfilename\fP or \-\-log-file=\fIfilename\fP" Causes .I less to copy its input to the named file as it is being viewed. @@ -620,24 +641,24 @@ not an ordinary file. If the file already exists, .I less will ask for confirmation before overwriting it. -.IP "-O\fIfilename\fP or --LOG-FILE=\fIfilename\fP" -The -O option is like -o, but it will overwrite an existing +.IP "\-O\fIfilename\fP or \-\-LOG-FILE=\fIfilename\fP" +The \-O option is like \-o, but it will overwrite an existing file without asking for confirmation. .sp If no log file has been specified, -the -o and -O options can be used from within +the \-o and \-O options can be used from within .I less to specify a log file. Without a file name, they will simply report the name of the log file. -The "s" command is equivalent to specifying -o from within +The "s" command is equivalent to specifying \-o from within .I less. -.IP "-p\fIpattern\fP or --pattern=\fIpattern\fP" -The -p option on the command line is equivalent to +.IP "\-p\fIpattern\fP or \-\-pattern=\fIpattern\fP" +The \-p option on the command line is equivalent to specifying +/\fIpattern\fP; that is, it tells .I less to start at the first occurrence of \fIpattern\fP in the file. -.IP "-P\fIprompt\fP or --prompt=\fIprompt\fP" +.IP "\-P\fIprompt\fP or \-\-prompt=\fIprompt\fP" Provides a way to tailor the three prompt styles to your own preference. This option would normally be put in the LESS environment @@ -648,15 +669,15 @@ Such an option must either be the last option in the LESS variable, or be terminated by a dollar sign. -Ps followed by a string changes the default (short) prompt to that string. --Pm changes the medium (-m) prompt. --PM changes the long (-M) prompt. +-Pm changes the medium (\-m) prompt. +-PM changes the long (\-M) prompt. -Ph changes the prompt for the help screen. -P= changes the message printed by the = command. -Pw changes the message printed while waiting for data (in the F command). All prompt strings consist of a sequence of letters and special escape sequences. See the section on PROMPTS for more details. -.IP "-q or --quiet or --silent" +.IP "\-q or \-\-quiet or \-\-silent" Causes moderately "quiet" operation: the terminal bell is not rung if an attempt is made to scroll past the end of the file @@ -665,50 +686,54 @@ If the terminal has a "visual bell", it is used instead. The bell will be rung on certain other errors, such as typing an invalid character. The default is to ring the terminal bell in all such cases. -.IP "-Q or --QUIET or --SILENT" +.IP "\-Q or \-\-QUIET or \-\-SILENT" Causes totally "quiet" operation: the terminal bell is never rung. -.IP "-r or --raw-control-chars" +.IP "\-r or \-\-raw-control-chars" Causes "raw" control characters to be displayed. The default is to display control characters using the caret notation; for example, a control-A (octal 001) is displayed as "^A". -Warning: when the -r option is used, +Warning: when the \-r option is used, .I less cannot keep track of the actual appearance of the screen (since this depends on how the screen responds to each type of control character). Thus, various display problems may result, such as long lines being split in the wrong place. -.IP "-R or --RAW-CONTROL-CHARS" -Like -r, but tries to keep track of the screen appearance where possible. -This works only if the input consists of normal text and possibly some -ANSI "color" escape sequences, which are sequences of the form: +.IP "\-R or \-\-RAW-CONTROL-CHARS" +Like \-r, but only ANSI "color" escape sequences are output in "raw" form. +Unlike \-r, the screen appearance is maintained correctly in most cases. +ANSI "color" escape sequences are sequences of the form: .sp ESC [ ... m .sp -where the "..." is zero or more characters other than "m". +where the "..." is zero or more color specification characters For the purpose of keeping track of screen appearance, -all control characters and all ANSI color escape sequences are -assumed to not move the cursor. +ANSI color escape sequences are assumed to not move the cursor. You can make .I less think that characters other than "m" can end ANSI color escape sequences by setting the environment variable LESSANSIENDCHARS to the list of characters which can end a color escape sequence. -.IP "-s or --squeeze-blank-lines" +And you can make +.I less +think that characters other than the standard ones may appear between +the ESC and the m by setting the environment variable LESSANSIMIDCHARS +to the list of characters which can appear. +.IP "\-s or \-\-squeeze-blank-lines" Causes consecutive blank lines to be squeezed into a single blank line. This is useful when viewing .I nroff output. -.IP "-S or --chop-long-lines" +.IP "\-S or \-\-chop-long-lines" Causes lines longer than the screen width to be chopped rather than folded. That is, the portion of a long line that does not fit in the screen width is not shown. The default is to fold long lines; that is, display the remainder on the next line. -.IP "-t\fItag\fP or --tag=\fItag\fP" -The -t option, followed immediately by a TAG, +.IP "\-t\fItag\fP or \-\-tag=\fItag\fP" +The \-t option, followed immediately by a TAG, will edit the file containing that tag. For this to work, tag information must be available; for example, there may be a file in the current directory called "tags", @@ -720,22 +745,22 @@ the name of a command compatible with .I global (1), and that command is executed to find the tag. (See http://www.gnu.org/software/global/global.html). -The -t option may also be specified from within +The \-t option may also be specified from within .I less (using the \- command) as a way of examining a new file. -The command ":t" is equivalent to specifying -t from within +The command ":t" is equivalent to specifying \-t from within .I less. -.IP "-T\fItagsfile\fP or --tag-file=\fItagsfile\fP" +.IP "\-T\fItagsfile\fP or \-\-tag-file=\fItagsfile\fP" Specifies a tags file to be used instead of "tags". -.IP "-u or --underline-special" +.IP "\-u or \-\-underline-special" Causes backspaces and carriage returns to be treated as printable characters; that is, they are sent to the terminal when they appear in the input. -.IP "-U or --UNDERLINE-SPECIAL" +.IP "\-U or \-\-UNDERLINE-SPECIAL" Causes backspaces, tabs and carriage returns to be treated as control characters; -that is, they are handled as specified by the -r option. +that is, they are handled as specified by the \-r option. .sp -By default, if neither -u nor -U is given, +By default, if neither \-u nor \-U is given, backspaces which appear adjacent to an underscore character are treated specially: the underlined text is displayed @@ -746,25 +771,25 @@ the overstruck text is printed using the terminal's hardware boldface capability. Other backspaces are deleted, along with the preceding character. Carriage returns immediately followed by a newline are deleted. -other carriage returns are handled as specified by the -r option. +other carriage returns are handled as specified by the \-r option. Text which is overstruck or underlined can be searched for -if neither -u nor -U is in effect. -.IP "-V or --version" +if neither \-u nor \-U is in effect. +.IP "\-V or \-\-version" Displays the version number of .I less. -.IP "-w or --hilite-unread" +.IP "\-w or \-\-hilite-unread" Temporarily highlights the first "new" line after a forward movement of a full page. The first "new" line is the line immediately following the line previously at the bottom of the screen. Also highlights the target line after a g or p command. The highlight is removed at the next command which causes movement. -The entire line is highlighted, unless the -J option is in effect, +The entire line is highlighted, unless the \-J option is in effect, in which case only the status column is highlighted. -.IP "-W or --HILITE-UNREAD" -Like -w, but temporarily highlights the first new line after any +.IP "\-W or \-\-HILITE-UNREAD" +Like \-w, but temporarily highlights the first new line after any forward movement command larger than one line. -.IP "-x\fIn\fP,... or --tabs=\fIn\fP,..." +.IP "\-x\fIn\fP,... or \-\-tabs=\fIn\fP,..." Sets tab stops. If only one \fIn\fP is specified, tab stops are set at multiples of \fIn\fP. If multiple values separated by commas are specified, tab stops @@ -772,38 +797,33 @@ are set at those positions, and then continue with the same spacing as the last two. For example, \fI-x9,17\fP will set tabs at positions 9, 17, 25, 33, etc. The default for \fIn\fP is 8. -.IP "-X or --no-init" +.IP "\-X or \-\-no-init" Disables sending the termcap initialization and deinitialization strings to the terminal. This is sometimes desirable if the deinitialization string does something unnecessary, like clearing the screen. -.IP "--no-keypad" -Disables sending the keypad initialization and deinitialization strings -to the terminal. -This is sometimes useful if the keypad strings make the numeric -keypad behave in an undesirable manner. -.IP "-y\fIn\fP or --max-forw-scroll=\fIn\fP" +.IP "\-y\fIn\fP or \-\-max-forw-scroll=\fIn\fP" Specifies a maximum number of lines to scroll forward. If it is necessary to scroll forward more than \fIn\fP lines, the screen is repainted instead. -The -c or -C option may be used to repaint from the top of +The \-c or \-C option may be used to repaint from the top of the screen if desired. By default, any forward movement causes scrolling. -.IP "-[z]\fIn\fP or --window=\fIn\fP" +.IP "\-[z]\fIn\fP or \-\-window=\fIn\fP" Changes the default scrolling window size to \fIn\fP lines. The default is one screenful. The z and w commands can also be used to change the window size. -The "z" may be omitted for compatibility with +The "z" may be omitted for compatibility with some versions of .I more. If the number .I n is negative, it indicates .I n lines less than the current screen size. -For example, if the screen is 24 lines, \fI-z-4\fP sets the +For example, if the screen is 24 lines, \fI\-z-4\fP sets the scrolling window to 20 lines. If the screen is resized to 40 lines, the scrolling window automatically changes to 36 lines. -.IP "-\fI\(dqcc\fP\ or\ --quotes=\fIcc\fP" +.IP "\-\fI\(dqcc\fP\ or\ \-\-quotes=\fIcc\fP" Changes the filename quoting character. This may be necessary if you are trying to name a file which contains both spaces and quote characters. @@ -816,19 +836,37 @@ and the close quote to the second character. Filenames containing a space should then be preceded by the open quote character and followed by the close quote character. Note that even after the quote characters are changed, this option -remains -" (a dash followed by a double quote). -.IP "-~ or --tilde" +remains \-" (a dash followed by a double quote). +.IP "\-~ or \-\-tilde" Normally lines after end of file are displayed as a single tilde (~). This option causes lines after end of file to be displayed as blank lines. -.IP "-# or --shift" +.IP "\-# or \-\-shift" Specifies the default number of positions to scroll horizontally in the RIGHTARROW and LEFTARROW commands. If the number specified is zero, it sets the default number of positions to one half of the screen width. -.IP -- -A command line argument of "--" marks the end of option arguments. +.IP "\-\-no-keypad" +Disables sending the keypad initialization and deinitialization strings +to the terminal. +This is sometimes useful if the keypad strings make the numeric +keypad behave in an undesirable manner. +.IP "\-\-follow-name" +Normally, if the input file is renamed while an F command is executing, +.I less +will continue to display the contents of the original file despite +its name change. +If \-\-follow-name is specified, during an F command +.I less +will periodically attempt to reopen the file by name. +If the reopen succeeds and the file is a different file from the original +(which means that a new file has been created +with the same name as the original (now renamed) file), +.I less +will display the contents of that new file. +.IP \-\- +A command line argument of "\-\-" marks the end of option arguments. Any arguments following this are interpreted as filenames. -This can be useful when viewing a file whose name begins with a "-" or "+". +This can be useful when viewing a file whose name begins with a "\-" or "+". .IP + If a command line option begins with \fB+\fP, the remainder of that option is taken to be an initial command to @@ -852,7 +890,8 @@ or the pattern for a search command), certain keys can be used to manipulate the command line. Most commands have an alternate form in [ brackets ] which can be used if a key does not exist on a particular keyboard. -(The bracketed forms do not work in the MS-DOS version.) +(Note that the forms beginning with ESC do not work +in some MS-DOS and Windows systems because ESC is the line erase character.) Any of these special keys may be entered literally by preceding it with the "literal" character, either ^V or ^A. A backslash itself may also be entered literally by entering two backslashes. @@ -1019,15 +1058,15 @@ lessopen.sh: .br case "$1" in .br - *.Z) uncompress -c $1 >/tmp/less.$$ 2>/dev/null + *.Z) uncompress -\c $1 >/tmp/less.$$ 2>/dev/null .br - if [ -s /tmp/less.$$ ]; then + if [ \-s /tmp/less.$$ ]; then .br echo /tmp/less.$$ .br else .br - rm -f /tmp/less.$$ + rm \-f /tmp/less.$$ .br fi .br @@ -1074,7 +1113,7 @@ lesspipe.sh: .br case "$1" in .br - *.Z) uncompress -c $1 2>/dev/null + *.Z) uncompress \-c $1 2>/dev/null .br ;; .br @@ -1087,7 +1126,7 @@ When an input pipe is used, a LESSCLOSE postprocessor can be used, but it is usually not necessary since there is no replacement file to clean up. In this case, the replacement file name passed to the LESSCLOSE -postprocessor is "-". +postprocessor is "\-". .SH "NATIONAL CHARACTER SETS" There are three types of characters in the input file: @@ -1131,8 +1170,12 @@ Selects a Russian character set. Selects a character set appropriate for NeXT computers. .IP utf-8 Selects the UTF-8 encoding of the ISO 10646 character set. +UTF-8 is special in that it supports multi-byte characters in the input file. +It is the only character set that supports multi-byte characters. +.IP windows +Selects a character set appropriate for Microsoft Windows (cp 1251). .PP -In special cases, it may be desired to tailor +In rare cases, it may be desired to tailor .I less to use a character set other than the ones definable by LESSCHARSET. In this case, the environment variable LESSCHARDEF can be used @@ -1173,7 +1216,8 @@ to each of the possible values for LESSCHARSET: next\ \ 8bcccbcc18b95.bb125.bb .PP If neither LESSCHARSET nor LESSCHARDEF is set, -but the string "UTF-8" is found in the LC_ALL, LC_TYPE or LANG +but any of the strings "UTF-8", "UTF8", "utf-8" or "utf8" +is found in the LC_ALL, LC_TYPE or LANG environment variables, then the default character set is utf-8. .PP If that string is not found, but your system supports the @@ -1205,10 +1249,28 @@ printf-style escape sequence (a % followed by x, X, o, d, etc.). For example, if LESSBINFMT is "*u[%x]", binary characters are displayed in underlined hexadecimal surrounded by brackets. The default if no LESSBINFMT is specified is "*s<%X>". +The default if no LESSBINFMT is specified is "*s<%02X>". +Warning: the result of expanding the character via LESSBINFMT must +be less than 31 characters. +.PP +When the character set is utf-8, the LESSUTFBINFMT environment variable +acts similarly to LESSBINFMT but it applies to Unicode code points +that were successfully decoded but are unsuitable for display (e.g., +unassigned code points). +Its default value is "". +Note that LESSUTFBINFMT and LESSBINFMT share their display attribute +setting ("*x") so specifying one will affect both; +LESSUTFBINFMT is read after LESSBINFMT so its setting, if any, +will have priority. +Problematic octets in a UTF-8 file (octets of a truncated sequence, +octets of a complete but non-shortest form sequence, illegal octets, +and stray trailing octets) +are displayed individually using LESSBINFMT so as to facilitate diagnostic +of how the UTF-8 file is ill-formed. .SH "PROMPTS" -The -P option allows you to tailor the prompt to your preference. -The string given to the -P option replaces the specified prompt string. +The \-P option allows you to tailor the prompt to your preference. +The string given to the \-P option replaces the specified prompt string. Certain characters in the string are interpreted specially. The prompt mechanism is rather complicated to provide flexibility, but the ordinary user need not understand the details of constructing @@ -1225,7 +1287,7 @@ display is used, an "m" means use the middle line, a "b" means use the bottom line, a "B" means use the line just after the bottom line, -and a "j" means use the "target" line, as specified by the -j option. +and a "j" means use the "target" line, as specified by the \-j option. .IP "%B" Replaced by the size of the current input file. .IP "%c" @@ -1350,7 +1412,7 @@ followed by the name of the next file, if there is one. Finally, any trailing spaces are truncated. This is the default prompt. For reference, here are the defaults for -the other two prompts (-m and -M respectively). +the other two prompts (\-m and \-M respectively). Each is broken into two lines here for readability only. .nf .sp @@ -1398,11 +1460,11 @@ the pipe command the examine command. .IP "v" the editing command -.IP "s -o" +.IP "s \-o" log files -.IP "-k" +.IP "\-k" use of lesskey files -.IP "-t" +.IP "\-t" use of tags files .IP " " metacharacters in filenames, such as * @@ -1412,6 +1474,36 @@ filename completion (TAB, ^L) .PP Less can also be compiled to be permanently in "secure" mode. +.SH "COMPATIBILITY WITH MORE" +If the environment variable LESS_IS_MORE is set to 1, +or if the program is invoked via a file link named "more", +.I less +behaves (mostly) in conformance with the POSIX "more" command specification. +In this mode, less behaves differently in these ways: +.PP +The \-e option works differently. +If the \-e option is not set, +.I less +behaves as if the \-E option were set. +If the \-e option is set, +.I less +behaves as if the \-e and \-F options were set. +.PP +The \-m option works differently. +If the \-m option is not set, the medium prompt is used, +and it is prefixed with the string "--More--". +If the \-m option is set, the short prompt is used. +.PP +The \-n option acts like the \-z option. +The normal behavior of the \-n option is unavailable in this mode. +.PP +The parameter to the \-p option is taken to be a +.I less +command rather than a search pattern. +.PP +The LESS environment variable is ignored, +and the MORE environment variable is used in its place. + .SH "ENVIRONMENT VARIABLES" Environment variables may be specified either in the system environment as usual, or in a @@ -1447,8 +1539,12 @@ Options which are passed to .I less automatically. .IP LESSANSIENDCHARS -Characters which are assumed to end an ANSI color escape sequence +Characters which may end an ANSI color escape sequence (default "m"). +.IP LESSANSIMIDCHARS +Characters which may appear between the ESC character and the +end character in an ANSI color escape sequence +(default "0123456789;[?!"'#%()*+\ ". .IP LESSBINFMT Format for displaying non-printable, non-control characters. .IP LESSCHARDEF @@ -1465,10 +1561,21 @@ in filenames on Unix systems. Editor prototype string (used for the v command). See discussion under PROMPTS. .IP LESSGLOBALTAGS -Name of the command used by the -t option to find global tags. +Name of the command used by the \-t option to find global tags. Normally should be set to "global" if your system has the .I global (1) command. If not set, global tags are not used. +.IP LESSHISTFILE +Name of the history file used to remember search commands and +shell commands between invocations of +.I less. +If set to "\-" or "/dev/null", a history file is not used. +The default is "$HOME/.lesshst" on Unix systems, "$HOME/_lesshst" on +DOS and Windows systems, or "$HOME/lesshst.ini" or "$INIT/lesshst.ini" +on OS/2 systems. +.IP LESSHISTSIZE +The maximum number of commands to save in the history file. +The default is 100. .IP LESSKEY Name of the default lesskey(1) file. .IP LESSKEY_SYSTEM @@ -1487,6 +1594,12 @@ Runs less in "secure" mode. See discussion under SECURITY. .IP LESSSEPARATOR String to be appended to a directory name in filename completion. +.IP LESSUTFBINFMT +Format for displaying non-printable Unicode code points. +.IP LESS_IS_MORE +Emulate the +.I more +(1) command. .IP LINES Sets the number of lines on the screen. Takes precedence over the number of lines specified by the TERM variable. @@ -1508,46 +1621,8 @@ The name of the editor (used for the v command). .SH "SEE ALSO" lesskey(1) -.SH WARNINGS -The = command and prompts (unless changed by -P) -report the line numbers of the lines at the top and bottom of the screen, -but the byte and percent of the line after the one at the bottom of the screen. -.PP -If the :e command is used to name more than one file, -and one of the named files has been viewed previously, -the new files may be entered into the list in an unexpected order. -.PP -On certain older terminals (the so-called "magic cookie" terminals), -search highlighting will cause an erroneous display. -On such terminals, search highlighting is disabled by default -to avoid possible problems. -.PP -In certain cases, when search highlighting is enabled and -a search pattern begins with a ^, -more text than the matching string may be highlighted. -(This problem does not occur when less is compiled to use the POSIX -regular expression package.) -.PP -When viewing text containing ANSI color escape sequences using the -R option, -searching will not find text containing an embedded escape sequence. -Also, search highlighting may change the color of some of the text -which follows the highlighted text. -.PP -On some systems, -.I setlocale -claims that ASCII characters 0 thru 31 are control characters -rather than binary characters. -This causes -.I less -to treat some binary files as ordinary, non-binary files. -To workaround this problem, set the environment variable -LESSCHARSET to "ascii" (or whatever character set is appropriate). -.PP -See http://www.greenwoodsoftware.com/less for the latest list of known bugs in this -version of less. - .SH COPYRIGHT -Copyright (C) 2002 Mark Nudelman +Copyright (C) 1984-2007 Mark Nudelman .PP less is part of the GNU project and is free software. You can redistribute it and/or modify it @@ -1572,6 +1647,12 @@ See the GNU General Public License for more details. .PP Mark Nudelman .br -Send bug reports or comments to the above address or to bug-less@gnu.org. +See http://www.greenwoodsoftware.com/less/bugs.html for the latest list of known bugs in less. .br -For more information, see the less homepage at http://www.greenwoodsoftware.com/less. +Send bug reports or comments to the above address or to +.br +bug-less@gnu.org. +.br +For more information, see the less homepage at +.br +http://www.greenwoodsoftware.com/less. diff --git a/src/bin/less/less.rdef b/src/bin/less/less.rdef index b684956785..80beb625cf 100644 --- a/src/bin/less/less.rdef +++ b/src/bin/less/less.rdef @@ -1,11 +1,11 @@ resource app_version { - major = 3, - middle = 8, - minor = 2, + major = 4, + middle = 1, + minor = 8, variety = 5, internal = 0, - short_info = "382", - long_info = "382 ©2004 The Free Software Foundation" + short_info = "418", + long_info = "418 ©2008 The Free Software Foundation" }; diff --git a/src/bin/less/lessecho.c b/src/bin/less/lessecho.c index 0c766f073b..ac42c062e6 100644 --- a/src/bin/less/lessecho.c +++ b/src/bin/less/lessecho.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -28,7 +28,7 @@ #include "less.h" -static char *version = "$Revision: 1.2 $"; +static char *version = "$Revision: 1.11 $"; static int quote_all = 0; static char openquote = '"'; diff --git a/src/bin/less/lessecho.man b/src/bin/less/lessecho.man new file mode 100644 index 0000000000..f727ff690e --- /dev/null +++ b/src/bin/less/lessecho.man @@ -0,0 +1,49 @@ +LESSECHO(1) LESSECHO(1) + + + +NAME + lessecho - expand metacharacters + +SYNOPSIS + lessecho [-ox] [-cx] [-pn] [-dn] [-mx] [-nn] [-ex] [-a] file ... + +DESCRIPTION + lessecho is a program that simply echos its arguments on standard out- + put. But any argument containing spaces is enclosed in quotes. + +OPTIONS + A summary of options is included below. + + -ox Specifies "x" to be the open quote character. + + -cx Specifies "x" to be the close quote character. + + -pn Specifies "n" to be the open quote character, as an integer. + + -dn Specifies "n" to be the close quote character, as an integer. + + -mx Specifies "x" to be a metachar. + + -nn Specifies "n" to be a metachar, as an integer. + + -ex Specifies "x" to be the escape char for metachars. + + -fn Specifies "n" to be the escape char for metachars, as an inte- + ger. + + -a Specifies that all arguments are to be quoted. The default is + that only arguments containing spaces are quoted. + +SEE ALSO + less(1) + +AUTHOR + This manual page was written by Thomas Schoepf , + for the Debian GNU/Linux system (but may be used by others). + + Send bug reports or comments to bug-less@gnu.org. + + + + Version 418: 02 Jan 2008 LESSECHO(1) diff --git a/src/bin/less/lessecho.nro b/src/bin/less/lessecho.nro new file mode 100644 index 0000000000..1c31c40a38 --- /dev/null +++ b/src/bin/less/lessecho.nro @@ -0,0 +1,47 @@ +.TH LESSECHO 1 "Version 418: 02 Jan 2008" +.SH NAME +lessecho \- expand metacharacters +.SH SYNOPSIS +.B lessecho +.I "[-ox] [-cx] [-pn] [-dn] [-mx] [-nn] [-ex] [-a] file ..." +.SH "DESCRIPTION" +.I lessecho +is a program that simply echos its arguments on standard output. +But any argument containing spaces is enclosed in quotes. +.SH OPTIONS +A summary of options is included below. +.TP +.B \-ox +Specifies "x" to be the open quote character. +.TP +.B \-cx +Specifies "x" to be the close quote character. +.TP +.B \-pn +Specifies "n" to be the open quote character, as an integer. +.TP +.B \-dn +Specifies "n" to be the close quote character, as an integer. +.TP +.B \-mx +Specifies "x" to be a metachar. +.TP +.B \-nn +Specifies "n" to be a metachar, as an integer. +.TP +.B \-ex +Specifies "x" to be the escape char for metachars. +.TP +.B \-fn +Specifies "n" to be the escape char for metachars, as an integer. +.TP +.B \-a +Specifies that all arguments are to be quoted. +The default is that only arguments containing spaces are quoted. +.SH "SEE ALSO" +less(1) +.SH AUTHOR +This manual page was written by Thomas Schoepf , +for the Debian GNU/Linux system (but may be used by others). +.PP +Send bug reports or comments to bug-less@gnu.org. diff --git a/src/bin/less/lesskey.c b/src/bin/less/lesskey.c index 25d01e7656..2e95c20dcf 100644 --- a/src/bin/less/lesskey.c +++ b/src/bin/less/lesskey.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. diff --git a/src/bin/less/lesskey.h b/src/bin/less/lesskey.h index dc33c58446..e6601a434e 100644 --- a/src/bin/less/lesskey.h +++ b/src/bin/less/lesskey.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. diff --git a/src/bin/less/lesskey.man b/src/bin/less/lesskey.man index 9c5cf45f83..770c8a6b62 100644 --- a/src/bin/less/lesskey.man +++ b/src/bin/less/lesskey.man @@ -1,46 +1,40 @@ +LESSKEY(1) LESSKEY(1) -LESSKEY(1) LESSKEY(1) - - -NNAAMMEE +NAME lesskey - specify key bindings for less -SSYYNNOOPPSSIISS - lleesssskkeeyy [[--oo oouuttppuutt]] [[----]] [[iinnppuutt]] - lleesssskkeeyy [[----oouuttppuutt==oouuttppuutt]] [[----]] [[iinnppuutt]] - lleesssskkeeyy --VV - lleesssskkeeyy ----vveerrssiioonn +SYNOPSIS + lesskey [-o output] [--] [input] + lesskey [--output=output] [--] [input] + lesskey -V + lesskey --version -DDEESSCCRRIIPPTTIIOONN - _L_e_s_s_k_e_y is used to specify a set of key bindings to be - used by _l_e_s_s_. The input file is a text file which - describes the key bindings, If the input file is "-", - standard input is read. If no input file is specified, a - standard filename is used as the name of the input file, - which depends on the system being used: On Unix systems, - $HOME/.lesskey is used; on MS-DOS systems, $HOME/_lesskey - is used; and on OS/2 systems $HOME/lesskey.ini is used, or - $INIT/lesskey.ini if $HOME is undefined. The output file - is a binary file which is used by _l_e_s_s_. If no output file - is specified, and the environment variable LESSKEY is set, - the value of LESSKEY is used as the name of the output - file. Otherwise, a standard filename is used as the name - of the output file, which depends on the system being - used: On Unix and OS-9 systems, $HOME/.less is used; on - MS-DOS systems, $HOME/_less is used; and on OS/2 systems, - $HOME/less.ini is used, or $INIT/less.ini if $HOME is - undefined. If the output file already exists, _l_e_s_s_k_e_y - will overwrite it. +DESCRIPTION + Lesskey is used to specify a set of key bindings to be used by less. + The input file is a text file which describes the key bindings, If the + input file is "-", standard input is read. If no input file is speci- + fied, a standard filename is used as the name of the input file, which + depends on the system being used: On Unix systems, $HOME/.lesskey is + used; on MS-DOS systems, $HOME/_lesskey is used; and on OS/2 systems + $HOME/lesskey.ini is used, or $INIT/lesskey.ini if $HOME is undefined. + The output file is a binary file which is used by less. If no output + file is specified, and the environment variable LESSKEY is set, the + value of LESSKEY is used as the name of the output file. Otherwise, a + standard filename is used as the name of the output file, which depends + on the system being used: On Unix and OS-9 systems, $HOME/.less is + used; on MS-DOS systems, $HOME/_less is used; and on OS/2 systems, + $HOME/less.ini is used, or $INIT/less.ini if $HOME is undefined. If + the output file already exists, lesskey will overwrite it. - The -V or --version option causes _l_e_s_s_k_e_y to print its - version number and immediately exit. If -V or --version - is present, other options and arguments are ignored. + The -V or --version option causes lesskey to print its version number + and immediately exit. If -V or --version is present, other options and + arguments are ignored. - The input file consists of one or more _s_e_c_t_i_o_n_s_. Each - section starts with a line that identifies the type of - section. Possible sections are: + The input file consists of one or more sections. Each section starts + with a line that identifies the type of section. Possible sections + are: #command Defines new command keys. @@ -50,42 +44,28 @@ DDEESSCCRRIIPPTTIIOONN #env Defines environment variables. - Blank lines and lines which start with a pound sign (#) - are ignored, except for the special section header lines. + Blank lines and lines which start with a pound sign (#) are ignored, + except for the special section header lines. -CCOOMMMMAANNDD SSEECCTTIIOONN +COMMAND SECTION The command section begins with the line #command + If the command section is the first section in the file, this line may + be omitted. The command section consists of lines of the form: + string action [extra-string] - Version 382: 03 Feb 2004 1 - - - - - -LESSKEY(1) LESSKEY(1) - - - If the command section is the first section in the file, - this line may be omitted. The command section consists of - lines of the form: - - _s_t_r_i_n_g _a_c_t_i_o_n [extra-string] - - Whitespace is any sequence of one or more spaces and/or - tabs. The _s_t_r_i_n_g is the command key(s) which invoke the - action. The _s_t_r_i_n_g may be a single command key, or a - sequence of up to 15 keys. The _a_c_t_i_o_n is the name of the - less action, from the list below. The characters in the - _s_t_r_i_n_g may appear literally, or be prefixed by a caret to - indicate a control key. A backslash followed by one to - three octal digits may be used to specify a character by - its octal value. A backslash followed by certain charac­ - ters specifies input characters as follows: + Whitespace is any sequence of one or more spaces and/or tabs. The + string is the command key(s) which invoke the action. The string may + be a single command key, or a sequence of up to 15 keys. The action is + the name of the less action, from the list below. The characters in + the string may appear literally, or be prefixed by a caret to indicate + a control key. A backslash followed by one to three octal digits may + be used to specify a character by its octal value. A backslash fol- + lowed by certain characters specifies input characters as follows: \b BACKSPACE @@ -115,37 +95,22 @@ LESSKEY(1) LESSKEY(1) \kx DELETE - A backslash followed by any other character indicates that - character is to be taken literally. Characters which must - be preceded by backslash include caret, space, tab and the - backslash itself. + A backslash followed by any other character indicates that character is + to be taken literally. Characters which must be preceded by backslash + include caret, space, tab and the backslash itself. - An action may be followed by an "extra" string. When such - a command is entered while running _l_e_s_s_, the action is - performed, and then the extra string is parsed, just as if - it were typed in to _l_e_s_s_. This feature can be used in + An action may be followed by an "extra" string. When such a command is + entered while running less, the action is performed, and then the extra + string is parsed, just as if it were typed in to less. This feature + can be used in certain cases to extend the functionality of a command. + For example, see the "{" and ":t" commands in the example below. The + extra string has a special meaning for the "quit" action: when less + quits, first character of the extra string is used as its exit status. - - Version 382: 03 Feb 2004 2 - - - - - -LESSKEY(1) LESSKEY(1) - - - certain cases to extend the functionality of a command. - For example, see the "{" and ":t" commands in the example - below. The extra string has a special meaning for the - "quit" action: when _l_e_s_s quits, first character of the - extra string is used as its exit status. - - -EEXXAAMMPPLLEE - The following input file describes the set of default com­ - mand keys used by less: +EXAMPLE + The following input file describes the set of default command keys used + by less: #command \r forw-line @@ -190,18 +155,6 @@ EEXXAAMMPPLLEE < goto-line \e< goto-line p percent - - - - Version 382: 03 Feb 2004 3 - - - - - -LESSKEY(1) LESSKEY(1) - - % percent \e[ left-scroll \e] right-scroll @@ -256,18 +209,6 @@ LESSKEY(1) LESSKEY(1) 0 digit 1 digit 2 digit - - - - Version 382: 03 Feb 2004 4 - - - - - -LESSKEY(1) LESSKEY(1) - - 3 digit 4 digit 5 digit @@ -282,57 +223,40 @@ LESSKEY(1) LESSKEY(1) ZZ quit -PPRREECCEEDDEENNCCEE - Commands specified by _l_e_s_s_k_e_y take precedence over the - default commands. A default command key may be disabled - by including it in the input file with the action - "invalid". Alternatively, a key may be defined to do - nothing by using the action "noaction". "noaction" is - similar to "invalid", but _l_e_s_s will give an error beep for - an "invalid" command, but not for a "noaction" command. - In addition, ALL default commands may be disabled by - adding this control line to the input file: +PRECEDENCE + Commands specified by lesskey take precedence over the default com- + mands. A default command key may be disabled by including it in the + input file with the action "invalid". Alternatively, a key may be + defined to do nothing by using the action "noaction". "noaction" is + similar to "invalid", but less will give an error beep for an "invalid" + command, but not for a "noaction" command. In addition, ALL default + commands may be disabled by adding this control line to the input file: #stop - This will cause all default commands to be ignored. The - #stop line should be the last line in that section of the - file. + This will cause all default commands to be ignored. The #stop line + should be the last line in that section of the file. - Be aware that #stop can be dangerous. Since all default - commands are disabled, you must provide sufficient com­ - mands before the #stop line to enable all necessary - actions. For example, failure to provide a "quit" command - can lead to frustration. + Be aware that #stop can be dangerous. Since all default commands are + disabled, you must provide sufficient commands before the #stop line to + enable all necessary actions. For example, failure to provide a "quit" + command can lead to frustration. -LLIINNEE EEDDIITTIINNGG SSEECCTTIIOONN +LINE EDITING SECTION The line-editing section begins with the line: #line-edit - This section specifies new key bindings for the line edit­ - ing commands, in a manner similar to the way key bindings - for ordinary commands are specified in the #command sec­ - tion. The line-editing section consists of a list of keys - and actions, one per line as in the example below. + This section specifies new key bindings for the line editing commands, + in a manner similar to the way key bindings for ordinary commands are + specified in the #command section. The line-editing section consists + of a list of keys and actions, one per line as in the example below. -EEXXAAMMPPLLEE - The following input file describes the set of default - line-editing keys used by less: - - - - - Version 382: 03 Feb 2004 5 - - - - - -LESSKEY(1) LESSKEY(1) - +EXAMPLE + The following input file describes the set of default line-editing keys + used by less: #line-edit \t forw-complete @@ -365,40 +289,26 @@ LESSKEY(1) LESSKEY(1) -LLEESSSS EENNVVIIRROONNMMEENNTT VVAARRIIAABBLLEESS +LESS ENVIRONMENT VARIABLES The environment variable section begins with the line #env - Following this line is a list of environment variable - assignments. Each line consists of an environment vari­ - able name, an equals sign (=) and the value to be assigned - to the environment variable. White space before and after - the equals sign is ignored. Variables assigned in this - way are visible only to _l_e_s_s_. If a variable is specified - in the system environment and also in a lesskey file, the - value in the lesskey file takes precedence. Although the - lesskey file can be used to override variables set in the - environment, the main purpose of assigning variables in - the lesskey file is simply to have all _l_e_s_s configuration + Following this line is a list of environment variable assignments. + Each line consists of an environment variable name, an equals sign (=) + and the value to be assigned to the environment variable. White space + before and after the equals sign is ignored. Variables assigned in + this way are visible only to less. If a variable is specified in the + system environment and also in a lesskey file, the value in the lesskey + file takes precedence. Although the lesskey file can be used to over- + ride variables set in the environment, the main purpose of assigning + variables in the lesskey file is simply to have all less configuration information stored in one file. -EEXXAAMMPPLLEE - The following input file sets the -i option whenever _l_e_s_s - is run, and specifies the character set to be "latin1": - - - - - Version 382: 03 Feb 2004 6 - - - - - -LESSKEY(1) LESSKEY(1) - +EXAMPLE + The following input file sets the -i option whenever less is run, and + specifies the character set to be "latin1": #env LESS = -i @@ -406,57 +316,45 @@ LESSKEY(1) LESSKEY(1) -SSEEEE AALLSSOO +SEE ALSO less(1) -WWAARRNNIINNGGSS - It is not possible to specify special keys, such as upar­ - row, in a keyboard-independent manner. The only way to - specify such keys is to specify the escape sequence which - a particular keyboard sends when such a key is pressed. +WARNINGS + It is not possible to specify special keys, such as uparrow, in a key- + board-independent manner. The only way to specify such keys is to + specify the escape sequence which a particular keyboard sends when such + a key is pressed. - On MS-DOS and OS/2 systems, certain keys send a sequence - of characters which start with a NUL character (0). This - NUL character should be represented as \340 in a lesskey - file. + On MS-DOS and OS/2 systems, certain keys send a sequence of characters + which start with a NUL character (0). This NUL character should be + represented as \340 in a lesskey file. -CCOOPPYYRRIIGGHHTT - Copyright (C) 2000 Mark Nudelman +COPYRIGHT + Copyright (C) 2000-2007 Mark Nudelman - lesskey is part of the GNU project and is free software; - you can redistribute it and/or modify it under the terms - of the GNU General Public License as published by the Free - Software Foundation; either version 2, or (at your option) - any later version. + lesskey is part of the GNU project and is free software; you can redis- + tribute it and/or modify it under the terms of the GNU General Public + License as published by the Free Software Foundation; either version 2, + or (at your option) any later version. - lesskey is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied war­ - ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR­ - POSE. See the GNU General Public License for more - details. + lesskey 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 lesskey; see the file COPYING. If not, - write to the Free Software Foundation, 59 Temple Place, - Suite 330, Boston, MA 02111-1307, USA. + You should have received a copy of the GNU General Public License along + with lesskey; see the file COPYING. If not, write to the Free Software + Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. -AAUUTTHHOORR +AUTHOR Mark Nudelman - Send bug reports or comments to the above address or to - bug-less@gnu.org. + Send bug reports or comments to the above address or to bug- + less@gnu.org. - - - - - - - Version 382: 03 Feb 2004 7 - - + Version 418: 02 Jan 2008 LESSKEY(1) diff --git a/src/bin/less/lesskey.nro b/src/bin/less/lesskey.nro index da3f23fae6..a8ebb949d6 100644 --- a/src/bin/less/lesskey.nro +++ b/src/bin/less/lesskey.nro @@ -1,4 +1,4 @@ -.TH LESSKEY 1 "Version 382: 03 Feb 2004" +.TH LESSKEY 1 "Version 418: 02 Jan 2008" .SH NAME lesskey \- specify key bindings for less .SH SYNOPSIS @@ -358,7 +358,7 @@ which start with a NUL character (0). This NUL character should be represented as \e340 in a lesskey file. .SH COPYRIGHT -Copyright (C) 2000 Mark Nudelman +Copyright (C) 2000-2007 Mark Nudelman .PP lesskey is part of the GNU project and is free software; you can redistribute it and/or modify it diff --git a/src/bin/less/lglob.h b/src/bin/less/lglob.h index f2b49cef63..8dc677f920 100644 --- a/src/bin/less/lglob.h +++ b/src/bin/less/lglob.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. diff --git a/src/bin/less/line.c b/src/bin/less/line.c index 14659f399c..3bd2b3808e 100644 --- a/src/bin/less/line.c +++ b/src/bin/less/line.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -16,14 +16,13 @@ */ #include "less.h" +#include "charset.h" -#define IS_CONT(c) (((c) & 0xC0) == 0x80) - -public char *linebuf = NULL; /* Buffer which holds the current output line */ +static char *linebuf = NULL; /* Buffer which holds the current output line */ static char *attr = NULL; /* Extension of linebuf to hold attributes */ public int size_linebuf = 0; /* Size of line buffer (and attr buffer) */ -public int cshift; /* Current left-shift of output line buffer */ +static int cshift; /* Current left-shift of output line buffer */ public int hshift; /* Desired left-shift of output line buffer */ public int tabstops[TABSTOP_MAX] = { 0 }; /* Custom tabstops */ public int ntabstops = 1; /* Number of tabstops */ @@ -36,13 +35,17 @@ static int overstrike; /* Next char should overstrike previous char */ static int last_overstrike = AT_NORMAL; static int is_null_line; /* There is no current line */ static int lmargin; /* Left margin */ -static int hilites; /* Number of hilites in this line */ +static int line_matches; /* Number of search matches in this line */ static char pendc; static POSITION pendpos; static char *end_ansi_chars; +static char *mid_ansi_chars; +static int attr_swidth(); +static int attr_ewidth(); static int do_append(); +extern int sigs; extern int bs_mode; extern int linenums; extern int ctldisp; @@ -56,9 +59,15 @@ extern int bl_s_width, bl_e_width; extern int so_s_width, so_e_width; extern int sc_width, sc_height; extern int utf_mode; +extern int oldbot; extern POSITION start_attnpos; extern POSITION end_attnpos; +static char mbc_buf[MAX_UTF_CHAR_LEN]; +static int mbc_buf_len = 0; +static int mbc_buf_index = 0; +static POSITION mbc_pos; + /* * Initialize from environment variables. */ @@ -68,6 +77,11 @@ init_line() end_ansi_chars = lgetenv("LESSANSIENDCHARS"); if (end_ansi_chars == NULL || *end_ansi_chars == '\0') end_ansi_chars = "m"; + + mid_ansi_chars = lgetenv("LESSANSIMIDCHARS"); + if (mid_ansi_chars == NULL || *mid_ansi_chars == '\0') + mid_ansi_chars = "0123456789;[?!\"'#%()*+ "; + linebuf = (char *) ecalloc(LINEBUF_SIZE, sizeof(char)); attr = (char *) ecalloc(LINEBUF_SIZE, sizeof(char)); size_linebuf = LINEBUF_SIZE; @@ -76,12 +90,20 @@ init_line() /* * Expand the line buffer. */ - static int + static int expand_linebuf() { - int new_size = size_linebuf + LINEBUF_SIZE; + /* Double the size of the line buffer. */ + int new_size = size_linebuf * 2; + + /* Just realloc to expand the buffer, if we can. */ +#if HAVE_REALLOC + char *new_buf = (char *) realloc(linebuf, new_size); + char *new_attr = (char *) realloc(attr, new_size); +#else char *new_buf = (char *) calloc(new_size, sizeof(char)); char *new_attr = (char *) calloc(new_size, sizeof(char)); +#endif if (new_buf == NULL || new_attr == NULL) { if (new_attr != NULL) @@ -90,16 +112,39 @@ expand_linebuf() free(new_buf); return 1; } +#if HAVE_REALLOC + /* + * We realloc'd the buffers; they already have the old contents. + */ + #if 0 + memset(new_buf + size_linebuf, 0, new_size - size_linebuf); + memset(new_attr + size_linebuf, 0, new_size - size_linebuf); + #endif +#else + /* + * We just calloc'd the buffers; copy the old contents. + */ memcpy(new_buf, linebuf, size_linebuf * sizeof(char)); memcpy(new_attr, attr, size_linebuf * sizeof(char)); free(attr); free(linebuf); +#endif linebuf = new_buf; attr = new_attr; size_linebuf = new_size; return 0; } +/* + * Is a character ASCII? + */ + public int +is_ascii_char(ch) + LWCHAR ch; +{ + return (ch <= 0x7F); +} + /* * Rewind the line buffer. */ @@ -108,14 +153,17 @@ prewind() { curr = 0; column = 0; + cshift = 0; overstrike = 0; + last_overstrike = AT_NORMAL; + mbc_buf_len = 0; is_null_line = 0; pendc = '\0'; lmargin = 0; if (status_col) lmargin += 1; #if HILITE_SEARCH - hilites = 0; + line_matches = 0; #endif } @@ -150,9 +198,9 @@ plinenum(pos) linebuf[curr] = ' '; if (start_attnpos != NULL_POSITION && pos >= start_attnpos && pos < end_attnpos) - attr[curr] = AT_STANDOUT; + attr[curr] = AT_NORMAL|AT_HILITE; else - attr[curr] = 0; + attr[curr] = AT_NORMAL; curr++; column++; } @@ -189,63 +237,6 @@ plinenum(pos) } } -/* - * Determine how many characters are required to shift N columns. - */ - static int -shift_chars(s, len) - char *s; - int len; -{ - char *p = s; - - /* - * Each char counts for one column, except ANSI color escape - * sequences use no columns since they don't move the cursor. - */ - while (*p != '\0' && len > 0) - { - if (*p++ != ESC) - { - len--; - } else - { - while (*p != '\0') - { - if (is_ansi_end(*p++)) - break; - } - } - } - return (p - s); -} - -/* - * Determine how many characters are required to shift N columns (UTF version). - * {{ FIXME: what about color escape sequences in UTF mode? }} - */ - static int -utf_shift_chars(s, len) - char *s; - int len; -{ - int ulen = 0; - - while (*s != '\0' && len > 0) - { - if (!IS_CONT(*s)) - len--; - s++; - ulen++; - } - while (IS_CONT(*s)) - { - s++; - ulen++; - } - return (ulen); -} - /* * Shift the input line left. * This means discarding N printable chars at the start of the buffer. @@ -254,28 +245,124 @@ utf_shift_chars(s, len) pshift(shift) int shift; { - int i; - int nchars; + LWCHAR prev_ch = 0; + unsigned char c; + int shifted = 0; + int to; + int from; + int len; + int width; + int prev_attr; + int next_attr; if (shift > column - lmargin) shift = column - lmargin; if (shift > curr - lmargin) shift = curr - lmargin; - if (utf_mode) - nchars = utf_shift_chars(linebuf + lmargin, shift); - else - nchars = shift_chars(linebuf + lmargin, shift); - if (nchars > curr) - nchars = curr; - for (i = 0; i < curr - nchars; i++) + to = from = lmargin; + /* + * We keep on going when shifted == shift + * to get all combining chars. + */ + while (shifted <= shift && from < curr) { - linebuf[lmargin + i] = linebuf[lmargin + i + nchars]; - attr[lmargin + i] = attr[lmargin + i + nchars]; + c = linebuf[from]; + if (ctldisp == OPT_ONPLUS && IS_CSI_START(c)) + { + /* Keep cumulative effect. */ + linebuf[to] = c; + attr[to++] = attr[from++]; + while (from < curr && linebuf[from]) + { + linebuf[to] = linebuf[from]; + attr[to++] = attr[from]; + if (!is_ansi_middle(linebuf[from++])) + break; + } + continue; + } + + width = 0; + + if (!IS_ASCII_OCTET(c) && utf_mode) + { + /* Assumes well-formedness validation already done. */ + LWCHAR ch; + + len = utf_len(c); + if (from + len > curr) + break; + ch = get_wchar(linebuf + from); + if (!is_composing_char(ch) && !is_combining_char(prev_ch, ch)) + width = is_wide_char(ch) ? 2 : 1; + prev_ch = ch; + } else + { + len = 1; + if (c == '\b') + /* XXX - Incorrect if several '\b' in a row. */ + width = (utf_mode && is_wide_char(prev_ch)) ? -2 : -1; + else if (!control_char(c)) + width = 1; + prev_ch = 0; + } + + if (width == 2 && shift - shifted == 1) { + /* Should never happen when called by pshift_all(). */ + attr[to] = attr[from]; + /* + * Assume a wide_char will never be the first half of a + * combining_char pair, so reset prev_ch in case we're + * followed by a '\b'. + */ + prev_ch = linebuf[to++] = ' '; + from += len; + shifted++; + continue; + } + + /* Adjust width for magic cookies. */ + prev_attr = (to > 0) ? attr[to-1] : AT_NORMAL; + next_attr = (from + len < curr) ? attr[from + len] : prev_attr; + if (!is_at_equiv(attr[from], prev_attr) && + !is_at_equiv(attr[from], next_attr)) + { + width += attr_swidth(attr[from]); + if (from + len < curr) + width += attr_ewidth(attr[from]); + if (is_at_equiv(prev_attr, next_attr)) + { + width += attr_ewidth(prev_attr); + if (from + len < curr) + width += attr_swidth(next_attr); + } + } + + if (shift - shifted < width) + break; + from += len; + shifted += width; + if (shifted < 0) + shifted = 0; } - curr -= nchars; - column -= shift; - cshift += shift; + while (from < curr) + { + linebuf[to] = linebuf[from]; + attr[to++] = attr[from++]; + } + curr = to; + column -= shifted; + cshift += shifted; +} + +/* + * + */ + public void +pshift_all() +{ + pshift(column); } /* @@ -286,14 +373,20 @@ pshift(shift) attr_swidth(a) int a; { - switch (a) - { - case AT_BOLD: return (bo_s_width); - case AT_UNDERLINE: return (ul_s_width); - case AT_BLINK: return (bl_s_width); - case AT_STANDOUT: return (so_s_width); - } - return (0); + int w = 0; + + a = apply_at_specials(a); + + if (a & AT_UNDERLINE) + w += ul_s_width; + if (a & AT_BOLD) + w += bo_s_width; + if (a & AT_BLINK) + w += bl_s_width; + if (a & AT_STANDOUT) + w += so_s_width; + + return w; } /* @@ -304,14 +397,20 @@ attr_swidth(a) attr_ewidth(a) int a; { - switch (a) - { - case AT_BOLD: return (bo_e_width); - case AT_UNDERLINE: return (ul_e_width); - case AT_BLINK: return (bl_e_width); - case AT_STANDOUT: return (so_e_width); - } - return (0); + int w = 0; + + a = apply_at_specials(a); + + if (a & AT_UNDERLINE) + w += ul_e_width; + if (a & AT_BOLD) + w += bo_e_width; + if (a & AT_BLINK) + w += bl_e_width; + if (a & AT_STANDOUT) + w += so_e_width; + + return w; } /* @@ -321,49 +420,92 @@ attr_ewidth(a) * attribute sequence to be inserted, so this must be taken into account. */ static int -pwidth(c, a) - int c; +pwidth(ch, a, prev_ch) + LWCHAR ch; int a; + LWCHAR prev_ch; { - register int w; + int w; - if (utf_mode && IS_CONT(c)) - return (0); - - if (c == '\b') + if (ch == '\b') /* - * Backspace moves backwards one position. + * Backspace moves backwards one or two positions. + * XXX - Incorrect if several '\b' in a row. */ - return (-1); + return (utf_mode && is_wide_char(prev_ch)) ? -2 : -1; - if (control_char(c)) - /* - * Control characters do unpredicatable things, - * so we don't even try to guess; say it doesn't move. - * This can only happen if the -r flag is in effect. - */ - return (0); + if (!utf_mode || is_ascii_char(ch)) + { + if (control_char((char)ch)) + { + /* + * Control characters do unpredictable things, + * so we don't even try to guess; say it doesn't move. + * This can only happen if the -r flag is in effect. + */ + return (0); + } + } else + { + if (is_composing_char(ch) || is_combining_char(prev_ch, ch)) + { + /* + * Composing and combining chars take up no space. + * + * Some terminals, upon failure to compose a + * composing character with the character(s) that + * precede(s) it will actually take up one column + * for the composing character; there isn't much + * we could do short of testing the (complex) + * composition process ourselves and printing + * a binary representation when it fails. + */ + return (0); + } + } /* - * Other characters take one space, + * Other characters take one or two columns, * plus the width of any attribute enter/exit sequence. */ w = 1; - if (curr > 0 && attr[curr-1] != a) + if (is_wide_char(ch)) + w++; + if (curr > 0 && !is_at_equiv(attr[curr-1], a)) w += attr_ewidth(attr[curr-1]); - if (a && (curr == 0 || attr[curr-1] != a)) + if ((apply_at_specials(a) != AT_NORMAL) && + (curr == 0 || !is_at_equiv(attr[curr-1], a))) w += attr_swidth(a); return (w); } /* - * Delete the previous character in the line buffer. + * Delete to the previous base character in the line buffer. + * Return 1 if one is found. */ - static void + static int backc() { - curr--; - column -= pwidth(linebuf[curr], attr[curr]); + LWCHAR prev_ch; + char *p = linebuf + curr; + LWCHAR ch = step_char(&p, -1, linebuf + lmargin); + int width; + + /* This assumes that there is no '\b' in linebuf. */ + while ( curr > lmargin + && column > lmargin + && (!(attr[curr - 1] & (AT_ANSI|AT_BINARY)))) + { + curr = p - linebuf; + prev_ch = step_char(&p, -1, linebuf + lmargin); + width = pwidth(ch, attr[curr], prev_ch); + column -= width; + if (width > 0) + return 1; + ch = prev_ch; + } + + return 0; } /* @@ -372,17 +514,18 @@ backc() static int in_ansi_esc_seq() { - int i; + char *p; /* * Search backwards for either an ESC (which means we ARE in a seq); * or an end char (which means we're NOT in a seq). */ - for (i = curr-1; i >= 0; i--) + for (p = &linebuf[curr]; p > linebuf; ) { - if (linebuf[i] == ESC) + LWCHAR ch = step_char(&p, -1, linebuf); + if (IS_CSI_START(ch)) return (1); - if (is_ansi_end(linebuf[i])) + if (!is_ansi_middle(ch)) return (0); } return (0); @@ -392,50 +535,109 @@ in_ansi_esc_seq() * Is a character the end of an ANSI escape sequence? */ public int -is_ansi_end(c) - char c; +is_ansi_end(ch) + LWCHAR ch; { - return (strchr(end_ansi_chars, c) != NULL); + if (!is_ascii_char(ch)) + return (0); + return (strchr(end_ansi_chars, (char) ch) != NULL); +} + +/* + * + */ + public int +is_ansi_middle(ch) + LWCHAR ch; +{ + if (!is_ascii_char(ch)) + return (0); + if (is_ansi_end(ch)) + return (0); + return (strchr(mid_ansi_chars, (char) ch) != NULL); } /* * Append a character and attribute to the line buffer. */ -#define STORE_CHAR(c,a,pos) \ - do { if (store_char((c),(a),(pos))) return (1); else curr++; } while (0) +#define STORE_CHAR(ch,a,rep,pos) \ + do { \ + if (store_char((ch),(a),(rep),(pos))) return (1); \ + } while (0) static int -store_char(c, a, pos) - int c; +store_char(ch, a, rep, pos) + LWCHAR ch; int a; + char *rep; POSITION pos; { - register int w; + int w; + int replen; + char cs; + + w = (a & (AT_UNDERLINE|AT_BOLD)); /* Pre-use w. */ + if (w != AT_NORMAL) + last_overstrike = w; - if (a != AT_NORMAL) - last_overstrike = a; #if HILITE_SEARCH - if (is_hilited(pos, pos+1, 0)) { - /* - * This character should be highlighted. - * Override the attribute passed in. - */ - a = AT_STANDOUT; - hilites++; + int matches; + if (is_hilited(pos, pos+1, 0, &matches)) + { + /* + * This character should be highlighted. + * Override the attribute passed in. + */ + if (a != AT_ANSI) + a |= AT_HILITE; + } + line_matches += matches; } #endif + if (ctldisp == OPT_ONPLUS && in_ansi_esc_seq()) + { + if (!is_ansi_end(ch) && !is_ansi_middle(ch)) { + /* Remove whole unrecognized sequence. */ + do { + if (curr == 0) + break; + --curr; + } while (!IS_CSI_START(linebuf[curr])); + return 0; + } + a = AT_ANSI; /* Will force re-AT_'ing around it. */ w = 0; + } + else if (ctldisp == OPT_ONPLUS && IS_CSI_START(ch)) + { + a = AT_ANSI; /* Will force re-AT_'ing around it. */ + w = 0; + } else - w = pwidth(c, a); + { + char *p = &linebuf[curr]; + LWCHAR prev_ch = step_char(&p, -1, linebuf); + w = pwidth(ch, a, prev_ch); + } + if (ctldisp != OPT_ON && column + w + attr_ewidth(a) > sc_width) /* * Won't fit on screen. */ return (1); - if (curr >= size_linebuf-2) + if (rep == NULL) + { + cs = (char) ch; + rep = &cs; + replen = 1; + } else + { + replen = utf_len(rep[0]); + } + if (curr + replen >= size_linebuf-6) { /* * Won't fit in line buffer. @@ -445,41 +647,12 @@ store_char(c, a, pos) return (1); } - /* - * Special handling for "magic cookie" terminals. - * If an attribute enter/exit sequence has a printing width > 0, - * and the sequence is adjacent to a space, delete the space. - * We just mark the space as invisible, to avoid having too - * many spaces deleted. - * {{ Note that even if the attribute width is > 1, we - * delete only one space. It's not worth trying to do more. - * It's hardly worth doing this much. }} - */ - if (curr > 0 && a != AT_NORMAL && - linebuf[curr-1] == ' ' && attr[curr-1] == AT_NORMAL && - attr_swidth(a) > 0) + while (replen-- > 0) { - /* - * We are about to append an enter-attribute sequence - * just after a space. Delete the space. - */ - attr[curr-1] = AT_INVIS; - column--; - } else if (curr > 0 && attr[curr-1] != AT_NORMAL && - attr[curr-1] != AT_INVIS && c == ' ' && a == AT_NORMAL && - attr_ewidth(attr[curr-1]) > 0) - { - /* - * We are about to append a space just after an - * exit-attribute sequence. Delete the space. - */ - a = AT_INVIS; - column--; + linebuf[curr] = *rep++; + attr[curr] = a; + curr++; } - /* End of magic cookie handling. */ - - linebuf[curr] = c; - attr[curr] = a; column += w; return (0); } @@ -510,12 +683,57 @@ store_tab(attr, pos) to_tab = tabstops[i+1] - to_tab; } + if (column + to_tab - 1 + pwidth(' ', attr, 0) + attr_ewidth(attr) > sc_width) + return 1; + do { - STORE_CHAR(' ', attr, pos); + STORE_CHAR(' ', attr, " ", pos); } while (--to_tab > 0); return 0; } +#define STORE_PRCHAR(c, pos) \ + do { if (store_prchar((c), (pos))) return 1; } while (0) + + static int +store_prchar(c, pos) + char c; + POSITION pos; +{ + char *s; + + /* + * Convert to printable representation. + */ + s = prchar(c); + + /* + * Make sure we can get the entire representation + * of the character on this line. + */ + if (column + (int) strlen(s) - 1 + + pwidth(' ', binattr, 0) + attr_ewidth(binattr) > sc_width) + return 1; + + for ( ; *s != 0; s++) + STORE_CHAR(*s, AT_BINARY, NULL, pos); + + return 0; +} + + static int +flush_mbc_buf(pos) + POSITION pos; +{ + int i; + + for (i = 0; i < mbc_buf_index; i++) + if (store_prchar(mbc_buf[i], pos)) + return mbc_buf_index - i; + + return 0; +} + /* * Append a character to the line buffer. * Expand tabs into spaces, handle underlining, boldfacing, etc. @@ -523,14 +741,14 @@ store_tab(attr, pos) */ public int pappend(c, pos) - register int c; + char c; POSITION pos; { int r; if (pendc) { - if (do_append(pendc, pendpos)) + if (do_append(pendc, NULL, pendpos)) /* * Oops. We've probably lost the char which * was in pendc, since caller won't back up. @@ -541,6 +759,16 @@ pappend(c, pos) if (c == '\r' && bs_mode == BS_SPECIAL) { + if (mbc_buf_len > 0) /* utf_mode must be on. */ + { + /* Flush incomplete (truncated) sequence. */ + r = flush_mbc_buf(mbc_pos); + mbc_buf_index = r + 1; + mbc_buf_len = 0; + if (r) + return (mbc_buf_index); + } + /* * Don't put the CR into the buffer until we see * the next char. If the next char is a newline, @@ -551,7 +779,50 @@ pappend(c, pos) return (0); } - r = do_append(c, pos); + if (!utf_mode) + { + r = do_append((LWCHAR) c, NULL, pos); + } else + { + /* Perform strict validation in all possible cases. */ + if (mbc_buf_len == 0) + { + retry: + mbc_buf_index = 1; + *mbc_buf = c; + if (IS_ASCII_OCTET(c)) + r = do_append((LWCHAR) c, NULL, pos); + else if (IS_UTF8_LEAD(c)) + { + mbc_buf_len = utf_len(c); + mbc_pos = pos; + return (0); + } else + /* UTF8_INVALID or stray UTF8_TRAIL */ + r = flush_mbc_buf(pos); + } else if (IS_UTF8_TRAIL(c)) + { + mbc_buf[mbc_buf_index++] = c; + if (mbc_buf_index < mbc_buf_len) + return (0); + if (is_utf8_well_formed(mbc_buf)) + r = do_append(get_wchar(mbc_buf), mbc_buf, mbc_pos); + else + /* Complete, but not shortest form, sequence. */ + mbc_buf_index = r = flush_mbc_buf(mbc_pos); + mbc_buf_len = 0; + } else + { + /* Flush incomplete (truncated) sequence. */ + r = flush_mbc_buf(mbc_pos); + mbc_buf_index = r + 1; + mbc_buf_len = 0; + /* Handle new char. */ + if (!r) + goto retry; + } + } + /* * If we need to shift the line, do it. * But wait until we get to at least the middle of the screen, @@ -563,42 +834,48 @@ pappend(c, pos) linebuf[curr] = '\0'; pshift(hshift - cshift); } + if (r) + { + /* How many chars should caller back up? */ + r = (!utf_mode) ? 1 : mbc_buf_index; + } return (r); } -#define IS_UTF8_4BYTE(c) ( ((c) & 0xf8) == 0xf0 ) -#define IS_UTF8_3BYTE(c) ( ((c) & 0xf0) == 0xe0 ) -#define IS_UTF8_2BYTE(c) ( ((c) & 0xe0) == 0xc0 ) -#define IS_UTF8_TRAIL(c) ( ((c) & 0xc0) == 0x80 ) - static int -do_append(c, pos) - int c; +do_append(ch, rep, pos) + LWCHAR ch; + char *rep; POSITION pos; { - register char *s; register int a; + LWCHAR prev_ch; -#define STOREC(c,a) \ - if ((c) == '\t') STORE_TAB((a),pos); else STORE_CHAR((c),(a),pos) + a = AT_NORMAL; - if (c == '\b') + if (ch == '\b') { - switch (bs_mode) - { - case BS_NORMAL: - STORE_CHAR(c, AT_NORMAL, pos); - break; - case BS_CONTROL: + if (bs_mode == BS_CONTROL) goto do_control_char; - case BS_SPECIAL: - if (curr == 0) - break; - backc(); - overstrike = 1; - break; - } - } else if (overstrike) + + /* + * A better test is needed here so we don't + * backspace over part of the printed + * representation of a binary character. + */ + if ( curr <= lmargin + || column <= lmargin + || (attr[curr - 1] & (AT_ANSI|AT_BINARY))) + STORE_PRCHAR('\b', pos); + else if (bs_mode == BS_NORMAL) + STORE_CHAR(ch, AT_NORMAL, NULL, pos); + else if (bs_mode == BS_SPECIAL) + overstrike = backc(); + + return 0; + } + + if (overstrike > 0) { /* * Overstrike the character at the current position @@ -607,29 +884,11 @@ do_append(c, pos) * bold (if an identical character is overstruck), * or just deletion of the character in the buffer. */ - overstrike--; - if (utf_mode && IS_UTF8_4BYTE(c) && curr > 2 && (char)c == linebuf[curr-3]) - { - backc(); - backc(); - backc(); - STORE_CHAR(linebuf[curr], AT_BOLD, pos); - overstrike = 3; - } else if (utf_mode && (IS_UTF8_3BYTE(c) || (overstrike==2 && IS_UTF8_TRAIL(c))) && curr > 1 && (char)c == linebuf[curr-2]) - { - backc(); - backc(); - STORE_CHAR(linebuf[curr], AT_BOLD, pos); - overstrike = 2; - } else if (utf_mode && curr > 0 && (IS_UTF8_2BYTE(c) || (overstrike==1 && IS_UTF8_TRAIL(c))) && (char)c == linebuf[curr-1]) - { - backc(); - STORE_CHAR(linebuf[curr], AT_BOLD, pos); - overstrike = 1; - } else if (utf_mode && curr > 0 && IS_UTF8_TRAIL(c) && attr[curr-1] == AT_UNDERLINE) - { - STOREC(c, AT_UNDERLINE); - } else if ((char)c == linebuf[curr]) + overstrike = utf_mode ? -1 : 0; + /* To be correct, this must be a base character. */ + prev_ch = get_wchar(linebuf + curr); + a = attr[curr]; + if (ch == prev_ch) { /* * Overstriking a char with itself means make it bold. @@ -638,40 +897,37 @@ do_append(c, pos) * it could mean make it underlined. * Use the previous overstrike to resolve it. */ - if (c == '_' && last_overstrike != AT_NORMAL) - STOREC(c, last_overstrike); - else - STOREC(c, AT_BOLD); - } else if (c == '_') - { - if (utf_mode) + if (ch == '_') { - int i; - for (i = 0; i < 5; i++) - { - if (curr <= i || !IS_CONT(linebuf[curr-i])) - break; - attr[curr-i-1] = AT_UNDERLINE; - } - } - STOREC(linebuf[curr], AT_UNDERLINE); - } else if (linebuf[curr] == '_') + if ((a & (AT_BOLD|AT_UNDERLINE)) != AT_NORMAL) + a |= (AT_BOLD|AT_UNDERLINE); + else if (last_overstrike != AT_NORMAL) + a |= last_overstrike; + else + a |= AT_BOLD; + } else + a |= AT_BOLD; + } else if (ch == '_') { - if (utf_mode) - { - if (IS_UTF8_2BYTE(c)) - overstrike = 1; - else if (IS_UTF8_3BYTE(c)) - overstrike = 2; - else if (IS_UTF8_4BYTE(c)) - overstrike = 3; - } - STOREC(c, AT_UNDERLINE); - } else if (control_char(c)) - goto do_control_char; + a |= AT_UNDERLINE; + ch = prev_ch; + rep = linebuf + curr; + } else if (prev_ch == '_') + { + a |= AT_UNDERLINE; + } + /* Else we replace prev_ch, but we keep its attributes. */ + } else if (overstrike < 0) + { + if ( is_composing_char(ch) + || is_combining_char(get_wchar(linebuf + curr), ch)) + /* Continuation of the same overstrike. */ + a = last_overstrike; else - STOREC(c, AT_NORMAL); - } else if (c == '\t') + overstrike = 0; + } + + if (ch == '\t') { /* * Expand a tab into spaces. @@ -682,43 +938,56 @@ do_append(c, pos) goto do_control_char; case BS_NORMAL: case BS_SPECIAL: - STORE_TAB(AT_NORMAL, pos); + STORE_TAB(a, pos); break; } - } else if (control_char(c)) + } else if ((!utf_mode || is_ascii_char(ch)) && control_char((char)ch)) { do_control_char: - if (ctldisp == OPT_ON || (ctldisp == OPT_ONPLUS && c == ESC)) + if (ctldisp == OPT_ON || (ctldisp == OPT_ONPLUS && IS_CSI_START(ch))) { /* * Output as a normal character. */ - STORE_CHAR(c, AT_NORMAL, pos); + STORE_CHAR(ch, AT_NORMAL, rep, pos); } else { - /* - * Convert to printable representation. - */ - s = prchar(c); - a = binattr; - - /* - * Make sure we can get the entire representation - * of the character on this line. - */ - if (column + (int) strlen(s) + - attr_swidth(a) + attr_ewidth(a) > sc_width) - return (1); - - for ( ; *s != 0; s++) - STORE_CHAR(*s, a, pos); + STORE_PRCHAR((char) ch, pos); } - } else + } else if (utf_mode && ctldisp != OPT_ON && is_ubin_char(ch)) { - STOREC(c, AT_NORMAL); - } + char *s; - return (0); + s = prutfchar(ch); + + if (column + (int) strlen(s) - 1 + + pwidth(' ', binattr, 0) + attr_ewidth(binattr) > sc_width) + return (1); + + for ( ; *s != 0; s++) + STORE_CHAR(*s, AT_BINARY, NULL, pos); + } else + { + STORE_CHAR(ch, a, rep, pos); + } + return (0); +} + +/* + * + */ + public int +pflushmbc() +{ + int r = 0; + + if (mbc_buf_len > 0) + { + /* Flush incomplete (truncated) sequence. */ + r = flush_mbc_buf(mbc_pos); + mbc_buf_len = 0; + } + return r; } /* @@ -728,13 +997,17 @@ do_append(c, pos) pdone(endline) int endline; { + int nl; + + (void) pflushmbc(); + if (pendc && (pendc != '\r' || !endline)) /* * If we had a pending character, put it in the buffer. * But discard a pending CR if we are at end of line * (that is, discard the CR in a CR/LF sequence). */ - (void) do_append(pendc, pendpos); + (void) do_append(pendc, NULL, pendpos); /* * Make sure we've shifted the line, if we need to. @@ -742,31 +1015,67 @@ pdone(endline) if (cshift < hshift) pshift(hshift - cshift); + if (ctldisp == OPT_ONPLUS && is_ansi_end('m')) + { + /* Switch to normal attribute at end of line. */ + char *p = "\033[m"; + for ( ; *p != '\0'; p++) + { + linebuf[curr] = *p; + attr[curr++] = AT_ANSI; + } + } + /* * Add a newline if necessary, * and append a '\0' to the end of the line. + * We output a newline if we're not at the right edge of the screen, + * or if the terminal doesn't auto wrap, + * or if this is really the end of the line AND the terminal ignores + * a newline at the right edge. + * (In the last case we don't want to output a newline if the terminal + * doesn't ignore it since that would produce an extra blank line. + * But we do want to output a newline if the terminal ignores it in case + * the next line is blank. In that case the single newline output for + * that blank line would be ignored!) */ - if (column < sc_width || !auto_wrap || ignaw || ctldisp == OPT_ON) + if (!oldbot) + nl = (column < sc_width || !auto_wrap || (endline && ignaw) || ctldisp == OPT_ON); + else + nl = (column < sc_width || !auto_wrap || ignaw || ctldisp == OPT_ON); + if (nl) { linebuf[curr] = '\n'; attr[curr] = AT_NORMAL; curr++; + } + else if (ignaw && !auto_wrap && column >= sc_width) + { + /* + * Big horrible kludge. + * No-wrap terminals are too hard to deal with when they get in + * the state where a full screen width of characters have been + * output but the cursor is sitting on the right edge instead + * of at the start of the next line. + * So after we output a full line, we output an extra + * space and backspace to force the cursor to the + * beginning of the next line, like a sane terminal. + */ + linebuf[curr] = ' '; + attr[curr++] = AT_NORMAL; + linebuf[curr] = '\b'; + attr[curr++] = AT_NORMAL; } linebuf[curr] = '\0'; attr[curr] = AT_NORMAL; #if HILITE_SEARCH - if (status_col && hilites > 0) + if (status_col && line_matches > 0) { linebuf[0] = '*'; - attr[0] = AT_STANDOUT; + attr[0] = AT_NORMAL|AT_HILITE; } #endif - /* - * If we are done with this line, reset the current shift. - */ - if (endline) - cshift = 0; } /* @@ -779,21 +1088,28 @@ gline(i, ap) register int i; register int *ap; { - char *s; - if (is_null_line) { /* * If there is no current line, we pretend the line is * either "~" or "", depending on the "twiddle" flag. */ - *ap = AT_BOLD; - s = (twiddle) ? "~\n" : "\n"; - return (s[i]); + if (twiddle) + { + if (i == 0) + { + *ap = AT_BOLD; + return '~'; + } + --i; + } + /* Make sure we're back to AT_NORMAL before the '\n'. */ + *ap = AT_NORMAL; + return i ? '\0' : '\n'; } *ap = attr[i]; - return (linebuf[i] & 0377); + return (linebuf[i] & 0xFF); } /* @@ -812,9 +1128,10 @@ null_line() * {{ This is supposed to be more efficient than forw_line(). }} */ public POSITION -forw_raw_line(curr_pos, linep) +forw_raw_line(curr_pos, linep, line_lenp) POSITION curr_pos; char **linep; + int *line_lenp; { register int n; register int c; @@ -827,7 +1144,7 @@ forw_raw_line(curr_pos, linep) n = 0; for (;;) { - if (c == '\n' || c == EOI) + if (c == '\n' || c == EOI || ABORT_SIGS()) { new_pos = ch_tell(); break; @@ -850,6 +1167,8 @@ forw_raw_line(curr_pos, linep) linebuf[n] = '\0'; if (linep != NULL) *linep = linebuf; + if (line_lenp != NULL) + *line_lenp = n; return (new_pos); } @@ -858,9 +1177,10 @@ forw_raw_line(curr_pos, linep) * {{ This is supposed to be more efficient than back_line(). }} */ public POSITION -back_raw_line(curr_pos, linep) +back_raw_line(curr_pos, linep, line_lenp) POSITION curr_pos; char **linep; + int *line_lenp; { register int n; register int c; @@ -875,7 +1195,7 @@ back_raw_line(curr_pos, linep) for (;;) { c = ch_back_get(); - if (c == '\n') + if (c == '\n' || ABORT_SIGS()) { /* * This is the newline ending the previous line. @@ -911,8 +1231,8 @@ back_raw_line(curr_pos, linep) /* * Shift the data to the end of the new linebuf. */ - for (fm = linebuf + old_size_linebuf, - to = linebuf + size_linebuf; + for (fm = linebuf + old_size_linebuf - 1, + to = linebuf + size_linebuf - 1; fm >= linebuf; fm--, to--) *to = *fm; n = size_linebuf - old_size_linebuf; @@ -921,5 +1241,7 @@ back_raw_line(curr_pos, linep) } if (linep != NULL) *linep = &linebuf[n]; + if (line_lenp != NULL) + *line_lenp = size_linebuf - 1 - n; return (new_pos); } diff --git a/src/bin/less/linenum.c b/src/bin/less/linenum.c index 24026fa327..184306b8e8 100644 --- a/src/bin/less/linenum.c +++ b/src/bin/less/linenum.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -314,7 +314,7 @@ find_linenum(pos) /* * Allow a signal to abort this loop. */ - cpos = forw_raw_line(cpos, (char **)NULL); + cpos = forw_raw_line(cpos, (char **)NULL, (int *)NULL); if (ABORT_SIGS() || cpos == NULL_POSITION) return (0); longish(); @@ -343,7 +343,7 @@ find_linenum(pos) /* * Allow a signal to abort this loop. */ - cpos = back_raw_line(cpos, (char **)NULL); + cpos = back_raw_line(cpos, (char **)NULL, (int *)NULL); if (ABORT_SIGS() || cpos == NULL_POSITION) return (0); longish(); @@ -398,7 +398,7 @@ find_pos(linenum) /* * Allow a signal to abort this loop. */ - cpos = forw_raw_line(cpos, (char **)NULL); + cpos = forw_raw_line(cpos, (char **)NULL, (int *)NULL); if (ABORT_SIGS() || cpos == NULL_POSITION) return (NULL_POSITION); } @@ -414,7 +414,7 @@ find_pos(linenum) /* * Allow a signal to abort this loop. */ - cpos = back_raw_line(cpos, (char **)NULL); + cpos = back_raw_line(cpos, (char **)NULL, (int *)NULL); if (ABORT_SIGS() || cpos == NULL_POSITION) return (NULL_POSITION); } diff --git a/src/bin/less/lsystem.c b/src/bin/less/lsystem.c index c25c089449..512bea34dc 100644 --- a/src/bin/less/lsystem.c +++ b/src/bin/less/lsystem.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -133,9 +133,9 @@ lsystem(cmd, donemsg) char *esccmd = shell_quote(cmd); if (esccmd != NULL) { - p = (char *) ecalloc(strlen(shell) + - strlen(esccmd) + 5, sizeof(char)); - sprintf(p, "%s %s %s", shell, shell_coption(), esccmd); + int len = strlen(shell) + strlen(esccmd) + 5; + p = (char *) ecalloc(len, sizeof(char)); + SNPRINTF3(p, len, "%s %s %s", shell, shell_coption(), esccmd); free(esccmd); } } diff --git a/src/bin/less/main.c b/src/bin/less/main.c index 1fb91a3c94..36a230e36a 100644 --- a/src/bin/less/main.c +++ b/src/bin/less/main.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -32,6 +32,7 @@ public char * progname; public int quitting; public int secure; public int dohelp; +public int less_is_more; #if LOGFILE public int logfile = -1; @@ -56,6 +57,8 @@ static char consoleTitle[256]; extern int missing_cap; extern int know_dumb; +extern int quit_if_one_screen; +extern int pr_type; /* @@ -111,11 +114,26 @@ main(argc, argv) is_tty = isatty(1); get_term(); init_cmds(); - init_prompt(); init_charset(); init_line(); + init_cmdhist(); init_option(); - s = lgetenv("LESS"); + + /* + * If the name of the executable program is "more", + * act like LESS_IS_MORE is set. + */ + for (s = progname + strlen(progname); s > progname; s--) + { + if (s[-1] == PATHNAME_SEP[0]) + break; + } + if (strcmp(s, "more") == 0) + less_is_more = 1; + + init_prompt(); + + s = lgetenv(less_is_more ? "MORE" : "LESS"); if (s != NULL) scan_option(save(s)); @@ -140,6 +158,9 @@ main(argc, argv) quit(QUIT_OK); } + if (less_is_more && get_quit_at_eof()) + quit_if_one_screen = TRUE; + #if EDITOR editor = lgetenv("VISUAL"); if (editor == NULL || *editor == '\0') @@ -335,14 +356,14 @@ sprefix(ps, s, uppercase) c = *ps; if (uppercase) { - if (len == 0 && SIMPLE_IS_LOWER(c)) + if (len == 0 && ASCII_IS_LOWER(c)) return (-1); - if (SIMPLE_IS_UPPER(c)) - c = SIMPLE_TO_LOWER(c); + if (ASCII_IS_UPPER(c)) + c = ASCII_TO_LOWER(c); } sc = *s; - if (len > 0 && SIMPLE_IS_UPPER(sc)) - sc = SIMPLE_TO_LOWER(sc); + if (len > 0 && ASCII_IS_UPPER(sc)) + sc = ASCII_TO_LOWER(sc); if (c != sc) break; len++; @@ -369,6 +390,7 @@ quit(status) save_status = status; quitting = 1; edit((char*)NULL); + save_cmdhist(); if (any_display && is_tty) clear_bot(); deinit(); diff --git a/src/bin/less/mark.c b/src/bin/less/mark.c index 04f97885d1..870f426e36 100644 --- a/src/bin/less/mark.c +++ b/src/bin/less/mark.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. diff --git a/src/bin/less/mkhelp.c b/src/bin/less/mkhelp.c index d05cb49945..f4a7ea76dc 100644 --- a/src/bin/less/mkhelp.c +++ b/src/bin/less/mkhelp.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. diff --git a/src/bin/less/optfunc.c b/src/bin/less/optfunc.c index 590b495450..f296b79368 100644 --- a/src/bin/less/optfunc.c +++ b/src/bin/less/optfunc.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -45,6 +45,9 @@ extern char *hproto; extern char *wproto; extern IFILE curr_ifile; extern char version[]; +extern int jump_sline; +extern int jump_sline_fraction; +extern int less_is_more; #if LOGFILE extern char *namelogfile; extern int force_logfile; @@ -53,7 +56,6 @@ extern int logfile; #if TAGS public char *tagoption = NULL; extern char *tags; -extern int jump_sline; #endif #if MSDOS_COMPILER extern int nm_fg_color, nm_bg_color; @@ -154,6 +156,71 @@ opt_l(type, s) } } +/* + * Handlers for -j option. + */ + public void +opt_j(type, s) + int type; + char *s; +{ + PARG parg; + char buf[16]; + int len; + int err; + + switch (type) + { + case INIT: + case TOGGLE: + if (*s == '.') + { + s++; + jump_sline_fraction = getfraction(&s, "j", &err); + if (err) + error("Invalid line fraction", NULL_PARG); + else + calc_jump_sline(); + } else + { + int sline = getnum(&s, "j", &err); + if (err) + error("Invalid line number", NULL_PARG); + else + { + jump_sline = sline; + jump_sline_fraction = -1; + } + } + break; + case QUERY: + if (jump_sline_fraction < 0) + { + parg.p_int = jump_sline; + error("Position target at screen line %d", &parg); + } else + { + + sprintf(buf, ".%06d", jump_sline_fraction); + len = strlen(buf); + while (len > 2 && buf[len-1] == '0') + len--; + buf[len] = '\0'; + parg.p_string = buf; + error("Position target at screen position %s", &parg); + } + break; + } +} + + public void +calc_jump_sline() +{ + if (jump_sline_fraction < 0) + return; + jump_sline = sc_height * jump_sline_fraction / NUM_FRAC_DENOM; +} + #if USERFILE public void opt_k(type, s) @@ -201,10 +268,13 @@ opt_t(type, s) } findtag(skipsp(s)); save_ifile = save_curr_ifile(); - if (edit_tagfile()) - break; - if ((pos = tagsearch()) == NULL_POSITION) + /* + * Try to open the file containing the tag + * and search for the tag in that file. + */ + if (edit_tagfile() || (pos = tagsearch()) == NULL_POSITION) { + /* Failed: reopen the old file. */ reedit_ifile(save_ifile); break; } @@ -259,7 +329,12 @@ opt_p(type, s) */ plusoption = TRUE; ungetsc(s); - ungetsc("/"); + /* + * In "more" mode, the -p argument is a command, + * not a search string, so we don't need a slash. + */ + if (!less_is_more) + ungetsc("/"); break; } } @@ -367,7 +442,7 @@ opt__V(type, s) any_display = 1; putstr("less "); putstr(version); - putstr("\nCopyright (C) 2002 Mark Nudelman\n\n"); + putstr("\nCopyright (C) 1984-2007 Mark Nudelman\n\n"); putstr("less comes with NO WARRANTY, to the extent permitted by law.\n"); putstr("For information about the terms of redistribution,\n"); putstr("see the file named README in the less distribution.\n"); @@ -450,8 +525,8 @@ opt_D(type, s) } if (type == TOGGLE) { - so_enter(); - so_exit(); + at_enter(AT_STANDOUT); + at_exit(); } break; case QUERY: diff --git a/src/bin/less/option.c b/src/bin/less/option.c index 8bb4504ba6..92a8fdd610 100644 --- a/src/bin/less/option.c +++ b/src/bin/less/option.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -29,6 +29,8 @@ static char *optstring(); static int flip_triple(); extern int screen_trashed; +extern int less_is_more; +extern int quit_at_eof; extern char *every_first_cmd; /* @@ -132,6 +134,10 @@ scan_option(s) s--; optc = 'z'; break; + case 'n': + if (less_is_more) + optc = 'z'; + break; } /* @@ -142,12 +148,12 @@ scan_option(s) if (optname == NULL) { printopt = propt(optc); - lc = SIMPLE_IS_LOWER(optc); + lc = ASCII_IS_LOWER(optc); o = findopt(optc); } else { printopt = optname; - lc = SIMPLE_IS_LOWER(optname[0]); + lc = ASCII_IS_LOWER(optname[0]); o = findopt_name(&optname, NULL, &err); s = optname; optname = NULL; @@ -350,14 +356,14 @@ toggle_option(c, s, how_toggle) { case OPT_TOGGLE: *(o->ovar) = flip_triple(*(o->ovar), - islower(c)); + ASCII_IS_LOWER(c)); break; case OPT_UNSET: *(o->ovar) = o->odefault; break; case OPT_SET: *(o->ovar) = flip_triple(o->odefault, - islower(c)); + ASCII_IS_LOWER(c)); break; } break; @@ -583,6 +589,30 @@ optstring(s, p_str, printopt, validchars) return (p); } +/* + */ + static int +num_error(printopt, errp) + char *printopt; + int *errp; +{ + PARG parg; + + if (errp != NULL) + { + *errp = TRUE; + return (-1); + } + if (printopt != NULL) + { + parg.p_string = printopt; + error("Number is required after %s", &parg); + } + quit(QUIT_ERROR); + /* NOTREACHED */ + return (-1); +} + /* * Translate a string into a number. * Like atoi(), but takes a pointer to a char *, and updates @@ -597,7 +627,6 @@ getnum(sp, printopt, errp) register char *s; register int n; register int neg; - PARG parg; s = skipsp(*sp); neg = FALSE; @@ -607,19 +636,7 @@ getnum(sp, printopt, errp) s++; } if (*s < '0' || *s > '9') - { - if (errp != NULL) - { - *errp = TRUE; - return (-1); - } - if (printopt != NULL) - { - parg.p_string = printopt; - error("Number is required after %s", &parg); - } - quit(QUIT_ERROR); - } + return (num_error(printopt, errp)); n = 0; while (*s >= '0' && *s <= '9') @@ -631,3 +648,53 @@ getnum(sp, printopt, errp) n = -n; return (n); } + +/* + * Translate a string into a fraction, represented by the part of a + * number which would follow a decimal point. + * The value of the fraction is returned as parts per NUM_FRAC_DENOM. + * That is, if "n" is returned, the fraction intended is n/NUM_FRAC_DENOM. + */ + public long +getfraction(sp, printopt, errp) + char **sp; + char *printopt; + int *errp; +{ + register char *s; + long frac = 0; + int fraclen = 0; + + s = skipsp(*sp); + if (*s < '0' || *s > '9') + return (num_error(printopt, errp)); + + for ( ; *s >= '0' && *s <= '9'; s++) + { + frac = (frac * 10) + (*s - '0'); + fraclen++; + } + if (fraclen > NUM_LOG_FRAC_DENOM) + while (fraclen-- > NUM_LOG_FRAC_DENOM) + frac /= 10; + else + while (fraclen++ < NUM_LOG_FRAC_DENOM) + frac *= 10; + *sp = s; + if (errp != NULL) + *errp = FALSE; + return (frac); +} + + +/* + * Get the value of the -e flag. + */ + public int +get_quit_at_eof() +{ + if (!less_is_more) + return quit_at_eof; + /* When less_is_more is set, the -e flag semantics are different. */ + return quit_at_eof ? OPT_ON : OPT_ONPLUS; +} diff --git a/src/bin/less/option.h b/src/bin/less/option.h index 8749d9359b..3ab7c8f703 100644 --- a/src/bin/less/option.h +++ b/src/bin/less/option.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. diff --git a/src/bin/less/opttbl.c b/src/bin/less/opttbl.c index bdf8d05fc7..755a93d72a 100644 --- a/src/bin/less/opttbl.c +++ b/src/bin/less/opttbl.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -40,6 +40,7 @@ public int ctldisp; /* Send control chars to screen untranslated */ public int force_open; /* Open the file even if not regular file */ public int swindow; /* Size of scrolling window */ public int jump_sline; /* Screen line of "jump target" */ +public long jump_sline_fraction = -1; public int chopline; /* Truncate displayed lines at screen width */ public int no_init; /* Disable sending ti/te termcap strings */ public int no_keypad; /* Disable sending ks/ke termcap strings */ @@ -48,10 +49,15 @@ public int show_attn; /* Hilite first unread line */ public int shift_count; /* Number of positions to shift horizontally */ public int status_col; /* Display a status column */ public int use_lessopen; /* Use the LESSOPEN filter */ +public int quit_on_intr; /* Quit on interrupt */ +public int follow_mode; /* F cmd Follows file desc or file name? */ +public int oldbot; /* Old bottom of screen behavior {{REMOVE}} */ #if HILITE_SEARCH public int hilite_search; /* Highlight matched search patterns? */ #endif +public int less_is_more = 0; /* Make compatible with POSIX more */ + /* * Long option names. */ @@ -76,6 +82,7 @@ static struct optname J__optname = { "status-column", NULL }; #if USERFILE static struct optname k_optname = { "lesskey-file", NULL }; #endif +static struct optname K__optname = { "quit-on-intr", NULL }; static struct optname L__optname = { "no-lessopen", NULL }; static struct optname m_optname = { "long-prompt", NULL }; static struct optname n_optname = { "line-numbers", NULL }; @@ -106,6 +113,8 @@ static struct optname tilde_optname = { "tilde", NULL }; static struct optname query_optname = { "help", NULL }; static struct optname pound_optname = { "shift", NULL }; static struct optname keypad_optname = { "no-keypad", NULL }; +static struct optname oldbot_optname = { "old-bot", NULL }; +static struct optname follow_optname = { "follow-name", NULL }; /* @@ -151,7 +160,7 @@ static struct loption option[] = TRIPLE, OPT_OFF, &top_scroll, NULL, { "Repaint by scrolling from bottom of screen", - "Repaint by clearing each line", + "Repaint by painting from top of screen", "Repaint by painting from top of screen" } }, @@ -224,10 +233,10 @@ static struct loption option[] = } }, { 'j', &j_optname, - NUMBER, 1, &jump_sline, NULL, + STRING, 0, NULL, opt_j, { "Target line: ", - "Position target at screen line %d", + "0123456789.", NULL } }, @@ -245,6 +254,14 @@ static struct loption option[] = { NULL, NULL, NULL } }, #endif + { 'K', &K__optname, + BOOL, OPT_OFF, &quit_on_intr, NULL, + { + "Interrupt (ctrl-C) returns to prompt", + "Interrupt (ctrl-C) exits less", + NULL + } + }, { 'l', NULL, STRING|NO_TOGGLE|NO_QUERY, 0, NULL, opt_l, { NULL, NULL, NULL } @@ -417,6 +434,22 @@ static struct loption option[] = NULL } }, + { '.', &oldbot_optname, + BOOL, OPT_OFF, &oldbot, NULL, + { + "Use new bottom of screen behavior", + "Use old bottom of screen behavior", + NULL + } + }, + { '.', &follow_optname, + BOOL, FOLLOW_DESC, &follow_mode, NULL, + { + "F command Follows file descriptor", + "F command Follows file name", + NULL + } + }, { '\0', NULL, NOVAR, 0, NULL, NULL, { NULL, NULL, NULL } } }; @@ -428,6 +461,11 @@ static struct loption option[] = init_option() { register struct loption *o; + char *p; + + p = lgetenv("LESS_IS_MORE"); + if (p != NULL && *p != '\0') + less_is_more = 1; for (o = option; o->oletter != '\0'; o++) { @@ -454,7 +492,7 @@ findopt(c) { if (o->oletter == c) return (o); - if ((o->otype & TRIPLE) && toupper(o->oletter) == c) + if ((o->otype & TRIPLE) && ASCII_TO_UPPER(o->oletter) == c) return (o); } return (NULL); @@ -467,9 +505,9 @@ findopt(c) is_optchar(c) char c; { - if (SIMPLE_IS_UPPER(c)) + if (ASCII_IS_UPPER(c)) return 1; - if (SIMPLE_IS_LOWER(c)) + if (ASCII_IS_LOWER(c)) return 1; if (c == '-') return 1; @@ -498,7 +536,6 @@ findopt_name(p_optname, p_oname, p_err) int maxlen = 0; int ambig = 0; int exact = 0; - char *eq; /* * Check all options. diff --git a/src/bin/less/os.c b/src/bin/less/os.c index e4f4fb50bd..fef5f94097 100644 --- a/src/bin/less/os.c +++ b/src/bin/less/os.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -74,6 +74,7 @@ iread(fd, buf, len) { register int n; +start: #if MSDOS_COMPILER==WIN32C if (ABORT_SIGS()) return (READ_INTR); @@ -156,7 +157,25 @@ iread(fd, buf, len) #endif reading = 0; if (n < 0) + { +#if HAVE_ERRNO + /* + * Certain values of errno indicate we should just retry the read. + */ +#if MUST_DEFINE_ERRNO + extern int errno; +#endif +#ifdef EINTR + if (errno == EINTR) + goto start; +#endif +#ifdef EAGAIN + if (errno == EAGAIN) + goto start; +#endif +#endif return (-1); + } return (n); } @@ -216,6 +235,7 @@ errno_message(filename) { register char *p; register char *m; + int len; #if HAVE_ERRNO #if MUST_DEFINE_ERRNO extern int errno; @@ -224,8 +244,9 @@ errno_message(filename) #else p = "cannot open"; #endif - m = (char *) ecalloc(strlen(filename) + strlen(p) + 3, sizeof(char)); - sprintf(m, "%s: %s", filename, p); + len = strlen(filename) + strlen(p) + 3; + m = (char *) ecalloc(len, sizeof(char)); + SNPRINTF2(m, len, "%s: %s", filename, p); return (m); } @@ -249,18 +270,25 @@ percentage(num, den) * Return the specified percentage of a POSITION. */ public POSITION -percent_pos(pos, percent) +percent_pos(pos, percent, fraction) POSITION pos; int percent; + long fraction; { - POSITION result100; + /* Change percent (parts per 100) to perden (parts per NUM_FRAC_DENOM). */ + long perden = (percent * (NUM_FRAC_DENOM / 100)) + (fraction / 100); + POSITION temp; - if (percent == 0) + if (perden == 0) return (0); - else if ((result100 = pos * percent) / percent == pos) - return (result100 / 100); + temp = pos * perden; /* This might overflow. */ + if (temp / perden == pos) + /* No overflow */ + return (temp / NUM_FRAC_DENOM); else - return (percent * (pos / 100)); + /* Above calculation overflows; + * use a method that is less precise but won't overflow. */ + return (perden * (pos / NUM_FRAC_DENOM)); } #if !HAVE_STRCHR diff --git a/src/bin/less/output.c b/src/bin/less/output.c index 7f5acbac9b..e3300459c8 100644 --- a/src/bin/less/output.c +++ b/src/bin/less/output.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -21,6 +21,7 @@ public int errmsgs; /* Count of messages displayed by error() */ public int need_clr; public int final_attr; +public int at_prompt; extern int sigs; extern int sc_width; @@ -28,8 +29,9 @@ extern int so_s_width, so_e_width; extern int screen_trashed; extern int any_display; extern int is_tty; +extern int oldbot; -#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC +#if MSDOS_COMPILER==WIN32C || MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC extern int ctldisp; extern int nm_fg_color, nm_bg_color; extern int bo_fg_color, bo_bg_color; @@ -47,7 +49,6 @@ put_line() register int c; register int i; int a; - int curr_attr; if (ABORT_SIGS()) { @@ -58,49 +59,19 @@ put_line() return; } - curr_attr = AT_NORMAL; + final_attr = AT_NORMAL; for (i = 0; (c = gline(i, &a)) != '\0'; i++) { - if (a != curr_attr) - { - /* - * Changing attributes. - * Display the exit sequence for the old attribute - * and the enter sequence for the new one. - */ - switch (curr_attr) - { - case AT_UNDERLINE: ul_exit(); break; - case AT_BOLD: bo_exit(); break; - case AT_BLINK: bl_exit(); break; - case AT_STANDOUT: so_exit(); break; - } - switch (a) - { - case AT_UNDERLINE: ul_enter(); break; - case AT_BOLD: bo_enter(); break; - case AT_BLINK: bl_enter(); break; - case AT_STANDOUT: so_enter(); break; - } - curr_attr = a; - } - if (curr_attr == AT_INVIS) - continue; + at_switch(a); + final_attr = a; if (c == '\b') putbs(); else putchr(c); } - switch (curr_attr) - { - case AT_UNDERLINE: ul_exit(); break; - case AT_BOLD: bo_exit(); break; - case AT_BLINK: bl_exit(); break; - case AT_STANDOUT: so_exit(); break; - } - final_attr = curr_attr; + at_exit(); } static char obuf[OUTBUF_SIZE]; @@ -131,53 +102,7 @@ flush() n = ob - obuf; if (n == 0) return; -#if MSDOS_COMPILER==WIN32C - if (is_tty && any_display) - { - char *op; - DWORD nwritten = 0; - CONSOLE_SCREEN_BUFFER_INFO scr; - int row; - int col; - int olen; - extern HANDLE con_out; - olen = ob - obuf; - /* - * There is a bug in Win32 WriteConsole() if we're - * writing in the last cell with a different color. - * To avoid color problems in the bottom line, - * we scroll the screen manually, before writing. - */ - GetConsoleScreenBufferInfo(con_out, &scr); - col = scr.dwCursorPosition.X; - row = scr.dwCursorPosition.Y; - for (op = obuf; op < obuf + olen; op++) - { - if (*op == '\n') - { - col = 0; - row++; - } else if (*op == '\r') - { - col = 0; - } else - { - col++; - if (col >= sc_width) - { - col = 0; - row++; - } - } - } - if (row > scr.srWindow.Bottom) - win32_scroll_up(row - scr.srWindow.Bottom); - WriteConsole(con_out, obuf, olen, &nwritten, NULL); - ob = obuf; - return; - } -#else #if MSDOS_COMPILER==MSOFTC if (is_tty && any_display) { @@ -187,12 +112,12 @@ flush() return; } #else -#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC +#if MSDOS_COMPILER==WIN32C || MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC if (is_tty && any_display) { *ob = '\0'; if (ctldisp != OPT_ONPLUS) - cputs(obuf); + WIN32textout(obuf, ob - obuf); else { /* @@ -202,64 +127,69 @@ flush() * the -D command-line option. */ char *anchor, *p, *p_next; - int buflen = ob - obuf; - unsigned char fg, bg, norm_attr; - /* - * Only dark colors mentioned here, so that - * bold has visible effect. - */ + unsigned char fg, bg; +#if MSDOS_COMPILER==WIN32C + /* Screen colors used by 3x and 4x SGR commands. */ + static unsigned char screen_color[] = { + 0, /* BLACK */ + FOREGROUND_RED, + FOREGROUND_GREEN, + FOREGROUND_RED|FOREGROUND_GREEN, + FOREGROUND_BLUE, + FOREGROUND_BLUE|FOREGROUND_RED, + FOREGROUND_BLUE|FOREGROUND_GREEN, + FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_RED + }; +#else static enum COLORS screen_color[] = { BLACK, RED, GREEN, BROWN, BLUE, MAGENTA, CYAN, LIGHTGRAY }; +#endif - /* Normal text colors are used as baseline. */ - bg = nm_bg_color & 0xf; - fg = nm_fg_color & 0xf; - norm_attr = (bg << 4) | fg; for (anchor = p_next = obuf; - (p_next = memchr (p_next, ESC, - buflen - (p_next - obuf))) - != NULL; ) + (p_next = memchr(p_next, ESC, ob - p_next)) != NULL; ) { p = p_next; - - /* - * Handle the null escape sequence - * (ESC-[m), which is used to restore - * the original color. - */ - if (p[1] == '[' && is_ansi_end(p[2])) + if (p[1] == '[') /* "ESC-[" sequence */ { - textattr(norm_attr); - p += 3; - anchor = p_next = p; - continue; - } - - if (p[1] == '[') /* "Esc-[" sequence */ - { - /* - * If some chars seen since - * the last escape sequence, - * write it out to the screen - * using current text attributes. - */ if (p > anchor) { - *p = '\0'; - cputs (anchor); - *p = ESC; + /* + * If some chars seen since + * the last escape sequence, + * write them out to the screen. + */ + WIN32textout(anchor, p-anchor); anchor = p; } - p += 2; + p += 2; /* Skip the "ESC-[" */ + if (is_ansi_end(*p)) + { + /* + * Handle null escape sequence + * "ESC[m", which restores + * the normal color. + */ + p++; + anchor = p_next = p; + WIN32setcolors(nm_fg_color, nm_bg_color); + continue; + } p_next = p; + + /* + * Select foreground/background colors + * based on the escape sequence. + */ + fg = nm_fg_color; + bg = nm_bg_color; while (!is_ansi_end(*p)) { char *q; long code = strtol(p, &q, 10); - if (!*q) + if (*q == '\0') { /* * Incomplete sequence. @@ -267,15 +197,15 @@ flush() * in the buffer. */ int slop = q - anchor; + /* {{ strcpy args overlap! }} */ strcpy(obuf, anchor); ob = &obuf[slop]; return; } - if (q == p - || code > 49 || code < 0 - || (!is_ansi_end(*q) - && *q != ';')) + if (q == p || + code > 49 || code < 0 || + (!is_ansi_end(*q) && *q != ';')) { p_next = q; break; @@ -285,11 +215,21 @@ flush() switch (code) { + default: + /* case 0: all attrs off */ + /* case 22: bold off */ + /* case 23: italic off */ + /* case 24: underline off */ + /* case 27: inverse off */ + fg = nm_fg_color; + bg = nm_bg_color; + break; case 1: /* bold on */ fg = bo_fg_color; bg = bo_bg_color; break; case 3: /* italic on */ + case 7: /* inverse on */ fg = so_fg_color; bg = so_bg_color; break; @@ -297,16 +237,14 @@ flush() fg = ul_fg_color; bg = ul_bg_color; break; + case 5: /* slow blink on */ + case 6: /* fast blink on */ + fg = bl_fg_color; + bg = bl_bg_color; + break; case 8: /* concealed on */ fg = (bg & 7) | 8; break; - case 0: /* all attrs off */ - case 22:/* bold off */ - case 23:/* italic off */ - case 24:/* underline off */ - fg = nm_fg_color; - bg = nm_bg_color; - break; case 30: case 31: case 32: case 33: case 34: case 35: case 36: case 37: @@ -326,26 +264,23 @@ flush() } p = q; } - if (is_ansi_end(*p) && p > p_next) - { - bg &= 15; - fg &= 15; - textattr ((bg << 4)| fg); - p_next = anchor = p + 1; - } else + if (!is_ansi_end(*p) || p == p_next) break; + fg &= 0xf; + bg &= 0xf; + WIN32setcolors(fg, bg); + p_next = anchor = p + 1; } else p_next++; } /* Output what's left in the buffer. */ - cputs (anchor); + WIN32textout(anchor, ob - anchor); } ob = obuf; return; } #endif -#endif #endif fd = (any_display) ? 1 : 2; if (write(fd, obuf, n) != n) @@ -360,6 +295,25 @@ flush() putchr(c) int c; { +#if 0 /* fake UTF-8 output for testing */ + extern int utf_mode; + if (utf_mode) + { + static char ubuf[MAX_UTF_CHAR_LEN]; + static int ubuf_len = 0; + static int ubuf_index = 0; + if (ubuf_len == 0) + { + ubuf_len = utf_len(c); + ubuf_index = 0; + } + ubuf[ubuf_index++] = c; + if (ubuf_index < ubuf_len) + return c; + c = get_wchar(ubuf) & 0xFF; + ubuf_len = 0; + } +#endif if (need_clr) { need_clr = 0; @@ -384,6 +338,7 @@ putchr(c) if (ob >= &obuf[sizeof(obuf)-1]) flush(); *ob++ = c; + at_prompt = 0; return (c); } @@ -534,8 +489,11 @@ error(fmt, parg) if (any_display && is_tty) { + if (!oldbot) + squish_check(); + at_exit(); clear_bot(); - so_enter(); + at_enter(AT_STANDOUT); col += so_s_width; } @@ -548,7 +506,7 @@ error(fmt, parg) } putstr(return_to_continue); - so_exit(); + at_exit(); col += sizeof(return_to_continue) + so_e_width; get_return(); @@ -578,11 +536,12 @@ ierror(fmt, parg) char *fmt; PARG *parg; { + at_exit(); clear_bot(); - so_enter(); + at_enter(AT_STANDOUT); (void) less_printf(fmt, parg); putstr(intr_to_abort); - so_exit(); + at_exit(); flush(); need_clr = 1; } diff --git a/src/bin/less/pckeys.h b/src/bin/less/pckeys.h index 723df550f9..8683e86d89 100644 --- a/src/bin/less/pckeys.h +++ b/src/bin/less/pckeys.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. diff --git a/src/bin/less/position.c b/src/bin/less/position.c index 7c10068856..da737dc289 100644 --- a/src/bin/less/position.c +++ b/src/bin/less/position.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. diff --git a/src/bin/less/position.h b/src/bin/less/position.h index 29a90d91c7..863707b06c 100644 --- a/src/bin/less/position.h +++ b/src/bin/less/position.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. diff --git a/src/bin/less/prompt.c b/src/bin/less/prompt.c index 9a2f99a4ec..67b5ddcdbf 100644 --- a/src/bin/less/prompt.c +++ b/src/bin/less/prompt.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -30,6 +30,7 @@ extern int linenums; extern int hshift; extern int sc_height; extern int jump_sline; +extern int less_is_more; extern IFILE curr_ifile; #if EDITOR extern char *editor; @@ -52,6 +53,8 @@ static constant char h_proto[] = "HELP -- ?eEND -- Press g to see it again:Press RETURN for more., or q when done"; static constant char w_proto[] = "Waiting for data"; +static constant char more_proto[] = + "--More--(?eEND ?x- Next\\: %x.:?pB%pB\\%:byte %bB?s/%s...%t)"; public char *prproto[3]; public char constant *eqproto = e_proto; @@ -68,7 +71,7 @@ static char *mp; init_prompt() { prproto[0] = save(s_proto); - prproto[1] = save(m_proto); + prproto[1] = save(less_is_more ? more_proto : m_proto); prproto[2] = save(M_proto); eqproto = save(e_proto); hproto = save(h_proto); @@ -164,7 +167,7 @@ curr_byte(where) POSITION pos; pos = position(where); - while (pos == NULL_POSITION && where >= 0 && where < sc_height) + while (pos == NULL_POSITION && where >= 0 && where < sc_height-1) pos = position(++where); if (pos == NULL_POSITION) pos = ch_length(); @@ -200,7 +203,7 @@ cond(c, where) case 'd': /* Same as l */ return (linenums); case 'L': /* Final line number known? */ - case 'D': /* Same as L */ + case 'D': /* Final page number known? */ return (linenums && ch_length() != NULL_POSITION); case 'm': /* More than one file? */ #if TAGS @@ -254,6 +257,9 @@ protochar(c, where, iseditproto) LINENUM last_linenum; IFILE h; +#undef PAGE_NUM +#define PAGE_NUM(linenum) ((((linenum) - 1) / (sc_height - 1)) + 1) + switch (c) { case 'b': /* Current byte offset */ @@ -269,17 +275,26 @@ protochar(c, where, iseditproto) case 'd': /* Current page number */ linenum = currline(where); if (linenum > 0 && sc_height > 1) - ap_linenum(((linenum - 1) / (sc_height - 1)) + 1); + ap_linenum(PAGE_NUM(linenum)); else ap_quest(); break; - case 'D': /* Last page number */ + case 'D': /* Final page number */ + /* Find the page number of the last byte in the file (len-1). */ len = ch_length(); - if (len == NULL_POSITION || len == ch_zero() || - (linenum = find_linenum(len)) <= 0) + if (len == NULL_POSITION) ap_quest(); + else if (len == 0) + /* An empty file has no pages. */ + ap_linenum(0); else - ap_linenum(((linenum - 1) / (sc_height - 1)) + 1); + { + linenum = find_linenum(len - 1); + if (linenum <= 0) + ap_quest(); + else + ap_linenum(PAGE_NUM(linenum)); + } break; #if EDITOR case 'E': /* Editor name */ @@ -518,7 +533,7 @@ pr_expand(proto, maxwidth) } if (mp == message) - return (NULL); + return (""); if (maxwidth > 0 && mp >= message + maxwidth) { /* @@ -549,9 +564,11 @@ eq_message() pr_string() { char *prompt; + int type; + type = (!less_is_more) ? pr_type : pr_type ? 0 : 1; prompt = pr_expand((ch_getflags() & CH_HELPFILE) ? - hproto : prproto[pr_type], + hproto : prproto[type], sc_width-so_s_width-so_e_width-2); new_file = 0; return (prompt); diff --git a/src/bin/less/screen.c b/src/bin/less/screen.c index d18db2d560..39e3f17617 100644 --- a/src/bin/less/screen.c +++ b/src/bin/less/screen.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -38,11 +38,12 @@ extern int fd0; #else -#if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS -#include -#if HAVE_SYS_IOCTL_H && !defined(TIOCGWINSZ) +#if HAVE_SYS_IOCTL_H #include #endif + +#if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS +#include #else #if HAVE_TERMIO_H #include @@ -50,10 +51,7 @@ extern int fd0; #if HAVE_SGSTAT_H #include #else -//#include -#endif -#if HAVE_SYS_IOCTL_H && (defined(TIOCGWINSZ) || defined(TCGETA) || defined(TIOCGETP) || defined(WIOCGETD)) -#include +#include #endif #endif #endif @@ -165,6 +163,7 @@ static char *sc_home, /* Cursor home */ *sc_addline, /* Add line, scroll down following lines */ *sc_lower_left, /* Cursor to last line, first column */ + *sc_return, /* Cursor to beginning of current line */ *sc_move, /* General cursor positioning */ *sc_clear, /* Clear screen */ *sc_eol_clear, /* Clear to end of line */ @@ -189,7 +188,9 @@ static int init_done = 0; public int auto_wrap; /* Terminal does \r\n when write past margin */ public int ignaw; /* Terminal ignores \n immediately after wrap */ -public int erase_char, kill_char; /* The user's erase and line-kill chars */ +public int erase_char; /* The user's erase char */ +public int erase2_char; /* The user's other erase char */ +public int kill_char; /* The user's line-kill char */ public int werase_char; /* The user's word-erase char */ public int sc_width, sc_height; /* Height & width of screen */ public int bo_s_width, bo_e_width; /* Printing width of boldface seq */ @@ -202,6 +203,7 @@ public int clear_bg; /* Clear fills with background color */ public int missing_cap = 0; /* Some capability is missing */ static int attrmode = AT_NORMAL; +extern int binattr; #if !MSDOS_COMPILER static char *cheaper(); @@ -230,6 +232,8 @@ extern int sigs; extern int wscroll; extern int screen_trashed; extern int tty; +extern int top_scroll; +extern int oldbot; #if HILITE_SEARCH extern int hilite_search; #endif @@ -257,6 +261,7 @@ raw_mode(on) if (on == curr_on) return; + erase2_char = '\b'; /* in case OS doesn't know about erase2 */ #if HAVE_TERMIOS_H && HAVE_TERMIOS_FUNCS { struct termios s; @@ -339,6 +344,9 @@ raw_mode(on) } #endif erase_char = s.c_cc[VERASE]; +#ifdef VERASE2 + erase2_char = s.c_cc[VERASE2]; +#endif kill_char = s.c_cc[VKILL]; #ifdef VWERASE werase_char = s.c_cc[VWERASE]; @@ -615,7 +623,25 @@ ltget_env(capname) char *capname; { char name[16]; + char *s; + s = lgetenv("LESS_TERMCAP_DEBUG"); + if (s != NULL && *s != '\0') + { + struct env { struct env *next; char *name; char *value; }; + static struct env *envs = NULL; + struct env *p; + for (p = envs; p != NULL; p = p->next) + if (strcmp(p->name, capname) == 0) + return p->value; + p = (struct env *) ecalloc(1, sizeof(struct env)); + p->name = save(capname); + p->value = (char *) ecalloc(strlen(capname)+3, sizeof(char)); + sprintf(p->value, "<%s>", capname); + p->next = envs; + envs = p; + return p->value; + } strcpy(name, "LESS_TERMCAP_"); strcat(name, capname); return (lgetenv(name)); @@ -1121,7 +1147,7 @@ get_term() if ((term = lgetenv("TERM")) == NULL) term = DEFAULT_TERM; hardcopy = 0; - if (tgetent(termbuf, term) <= 0) + if (tgetent(termbuf, term) != TGETENT_OK) hardcopy = 1; if (ltgetflag("hc")) hardcopy = 1; @@ -1201,7 +1227,7 @@ get_term() if (below_mem && (sc_eos_clear == NULL || *sc_eos_clear == '\0')) { missing_cap = 1; - sc_eol_clear = ""; + sc_eos_clear = ""; } sc_clear = ltgetstr("cl", &sp); @@ -1276,6 +1302,13 @@ get_term() } sc_lower_left = cheaper(t1, t2, "\r"); + /* + * Get carriage return string. + */ + sc_return = ltgetstr("cr", &sp); + if (sc_return == NULL) + sc_return = "\r"; + /* * Choose between using "al" or "sr" ("add line" or "scroll reverse") * to add a line at the top of the screen. @@ -1505,6 +1538,19 @@ init() tputs(sc_init, sc_height, putchr); if (!no_keypad) tputs(sc_s_keypad, sc_height, putchr); + if (top_scroll) + { + int i; + + /* + * This is nice to terminals with no alternate screen, + * but with saved scrolled-off-the-top lines. This way, + * no previous line is lost, but we start with a whole + * screen to ourself. + */ + for (i = 1; i < sc_height; i++) + putchr('\n'); + } #else #if MSDOS_COMPILER==WIN32C if (!no_init) @@ -1781,6 +1827,37 @@ lower_left() #endif } +/* + * Move cursor to left position of current line. + */ + public void +line_left() +{ +#if !MSDOS_COMPILER + tputs(sc_return, 1, putchr); +#else + int row; + flush(); +#if MSDOS_COMPILER==WIN32C + { + CONSOLE_SCREEN_BUFFER_INFO scr; + GetConsoleScreenBufferInfo(con_out, &scr); + row = scr.dwCursorPosition.Y - scr.srWindow.Top + 1; + } +#else +#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC + row = wherey(); +#else + { + struct rccoord tpos = _gettextposition(); + row = tpos.row; + } +#endif +#endif + _settextposition(row, 1); +#endif +} + /* * Check if the console size has changed and reset internals * (in lieu of SIGWINCH for WIN32). @@ -1846,12 +1923,12 @@ create_flash() videopages = w.numvideopages; if (videopages < 2) { - so_enter(); - so_exit(); + at_enter(AT_STANDOUT); + at_exit(); } else { _setactivepage(1); - so_enter(); + at_enter(AT_STANDOUT); blanks = (char *) ecalloc(w.numtextcols, sizeof(char)); for (col = 0; col < w.numtextcols; col++) blanks[col] = ' '; @@ -1860,7 +1937,7 @@ create_flash() _setactivepage(0); _setvisualpage(0); free(blanks); - so_exit(); + at_exit(); } #else #if MSDOS_COMPILER==BORLANDC @@ -2089,154 +2166,119 @@ clear_bot() * the mode while we do the clear. Some terminals fill the * cleared area with the current attribute. */ - lower_left(); - switch (attrmode) + if (oldbot) + lower_left(); + else + line_left(); + + if (attrmode == AT_NORMAL) + clear_eol_bot(); + else { - case AT_STANDOUT: - so_exit(); + int saved_attrmode = attrmode; + + at_exit(); clear_eol_bot(); - so_enter(); - break; - case AT_UNDERLINE: - ul_exit(); - clear_eol_bot(); - ul_enter(); - break; - case AT_BOLD: - bo_exit(); - clear_eol_bot(); - bo_enter(); - break; - case AT_BLINK: - bl_exit(); - clear_eol_bot(); - bl_enter(); - break; - default: - clear_eol_bot(); - break; + at_enter(saved_attrmode); } } -/* - * Begin "standout" (bold, underline, or whatever). - */ public void -so_enter() +at_enter(attr) + int attr; { + attr = apply_at_specials(attr); + #if !MSDOS_COMPILER - tputs(sc_s_in, 1, putchr); + /* The one with the most priority is last. */ + if (attr & AT_UNDERLINE) + tputs(sc_u_in, 1, putchr); + if (attr & AT_BOLD) + tputs(sc_b_in, 1, putchr); + if (attr & AT_BLINK) + tputs(sc_bl_in, 1, putchr); + if (attr & AT_STANDOUT) + tputs(sc_s_in, 1, putchr); #else flush(); - SETCOLORS(so_fg_color, so_bg_color); + /* The one with the most priority is first. */ + if (attr & AT_STANDOUT) + { + SETCOLORS(so_fg_color, so_bg_color); + } else if (attr & AT_BLINK) + { + SETCOLORS(bl_fg_color, bl_bg_color); + } + else if (attr & AT_BOLD) + { + SETCOLORS(bo_fg_color, bo_bg_color); + } + else if (attr & AT_UNDERLINE) + { + SETCOLORS(ul_fg_color, ul_bg_color); + } #endif - attrmode = AT_STANDOUT; + + attrmode = attr; } -/* - * End "standout". - */ public void -so_exit() +at_exit() { #if !MSDOS_COMPILER - tputs(sc_s_out, 1, putchr); + /* Undo things in the reverse order we did them. */ + if (attrmode & AT_STANDOUT) + tputs(sc_s_out, 1, putchr); + if (attrmode & AT_BLINK) + tputs(sc_bl_out, 1, putchr); + if (attrmode & AT_BOLD) + tputs(sc_b_out, 1, putchr); + if (attrmode & AT_UNDERLINE) + tputs(sc_u_out, 1, putchr); #else flush(); SETCOLORS(nm_fg_color, nm_bg_color); #endif + attrmode = AT_NORMAL; } -/* - * Begin "underline" (hopefully real underlining, - * otherwise whatever the terminal provides). - */ public void -ul_enter() +at_switch(attr) + int attr; { -#if !MSDOS_COMPILER - tputs(sc_u_in, 1, putchr); -#else - flush(); - SETCOLORS(ul_fg_color, ul_bg_color); -#endif - attrmode = AT_UNDERLINE; + int new_attrmode = apply_at_specials(attr); + int ignore_modes = AT_ANSI; + + if ((new_attrmode & ~ignore_modes) != (attrmode & ~ignore_modes)) + { + at_exit(); + at_enter(attr); + } } -/* - * End "underline". - */ - public void -ul_exit() + public int +is_at_equiv(attr1, attr2) + int attr1; + int attr2; { -#if !MSDOS_COMPILER - tputs(sc_u_out, 1, putchr); -#else - flush(); - SETCOLORS(nm_fg_color, nm_bg_color); -#endif - attrmode = AT_NORMAL; + attr1 = apply_at_specials(attr1); + attr2 = apply_at_specials(attr2); + + return (attr1 == attr2); } -/* - * Begin "bold" - */ - public void -bo_enter() + public int +apply_at_specials(attr) + int attr; { -#if !MSDOS_COMPILER - tputs(sc_b_in, 1, putchr); -#else - flush(); - SETCOLORS(bo_fg_color, bo_bg_color); -#endif - attrmode = AT_BOLD; -} + if (attr & AT_BINARY) + attr |= binattr; + if (attr & AT_HILITE) + attr |= AT_STANDOUT; + attr &= ~(AT_BINARY|AT_HILITE); -/* - * End "bold". - */ - public void -bo_exit() -{ -#if !MSDOS_COMPILER - tputs(sc_b_out, 1, putchr); -#else - flush(); - SETCOLORS(nm_fg_color, nm_bg_color); -#endif - attrmode = AT_NORMAL; -} - -/* - * Begin "blink" - */ - public void -bl_enter() -{ -#if !MSDOS_COMPILER - tputs(sc_bl_in, 1, putchr); -#else - flush(); - SETCOLORS(bl_fg_color, bl_bg_color); -#endif - attrmode = AT_BLINK; -} - -/* - * End "blink". - */ - public void -bl_exit() -{ -#if !MSDOS_COMPILER - tputs(sc_bl_out, 1, putchr); -#else - flush(); - SETCOLORS(nm_fg_color, nm_bg_color); -#endif - attrmode = AT_NORMAL; + return attr; } #if 0 /* No longer used */ @@ -2427,3 +2469,32 @@ WIN32getch(tty) return ((char)ascii); } #endif + +#if MSDOS_COMPILER +/* + */ + public void +WIN32setcolors(fg, bg) + int fg; + int bg; +{ + SETCOLORS(fg, bg); +} + +/* + */ + public void +WIN32textout(text, len) + char *text; + int len; +{ +#if MSDOS_COMPILER==WIN32C + WriteConsole(con_out, text, len, NULL, NULL); +#else + char c = text[len]; + text[len] = '\0'; + cputs(text); + text[len] = c; +#endif +} +#endif diff --git a/src/bin/less/scrsize.c b/src/bin/less/scrsize.c index 9af7e345ca..45cf20a1d7 100644 --- a/src/bin/less/scrsize.c +++ b/src/bin/less/scrsize.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. diff --git a/src/bin/less/search.c b/src/bin/less/search.c index 7d0af8b284..8d2d13edd7 100644 --- a/src/bin/less/search.c +++ b/src/bin/less/search.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -15,6 +15,7 @@ #include "less.h" #include "position.h" +#include "charset.h" #define MINPOS(a,b) (((a) < (b)) ? (a) : (b)) #define MAXPOS(a,b) (((a) > (b)) ? (a) : (b)) @@ -54,6 +55,7 @@ extern int jump_sline; extern int bs_mode; extern int ctldisp; extern int status_col; +extern void * constant ml_search; extern POSITION start_attnpos; extern POSITION end_attnpos; #if HILITE_SEARCH @@ -62,7 +64,9 @@ extern int screen_trashed; extern int size_linebuf; extern int squished; extern int can_goto_line; +extern int utf_mode; static int hide_hilite; +static int oldbot; static POSITION prep_startpos; static POSITION prep_endpos; @@ -101,44 +105,81 @@ static int is_ucase_pattern; static int last_search_type; static char *last_pattern = NULL; -/* - * Convert text. Perform one or more of these transformations: - */ #define CVT_TO_LC 01 /* Convert upper-case to lower-case */ #define CVT_BS 02 /* Do backspace processing */ #define CVT_CRLF 04 /* Remove CR after LF */ #define CVT_ANSI 010 /* Remove ANSI escape sequences */ - static void -cvt_text(odst, osrc, ops) - char *odst; - char *osrc; +/* + * Get the length of a buffer needed to convert a string. + */ + static int +cvt_length(len, ops) + int len; int ops; { - register char *dst; - register char *src; + if (utf_mode) + /* + * Just copying a string in UTF-8 mode can cause it to grow + * in length. + * Six output bytes for one input byte is the worst case + * (and unfortunately is far more than is needed in any + * non-pathological situation, so this is very wasteful). + */ + len *= 6; + return len + 1; +} - for (src = osrc, dst = odst; *src != '\0'; src++) +/* + * Convert text. Perform one or more of these transformations: + */ + static void +cvt_text(odst, osrc, lenp, ops) + char *odst; + char *osrc; + int *lenp; + int ops; +{ + char *dst; + char *src; + register char *src_end; + LWCHAR ch; + + if (lenp != NULL) + src_end = osrc + *lenp; + else + src_end = osrc + strlen(osrc); + + for (src = osrc, dst = odst; src < src_end; ) { - if ((ops & CVT_TO_LC) && isupper((unsigned char) *src)) + ch = step_char(&src, +1, src_end); + if ((ops & CVT_TO_LC) && IS_UPPER(ch)) + { /* Convert uppercase to lowercase. */ - *dst++ = tolower((unsigned char) *src); - else if ((ops & CVT_BS) && *src == '\b' && dst > odst) - /* Delete BS and preceding char. */ - dst--; - else if ((ops & CVT_ANSI) && *src == ESC) + put_wchar(&dst, TO_LOWER(ch)); + } else if ((ops & CVT_BS) && ch == '\b' && dst > odst) + { + /* Delete backspace and preceding char. */ + do { + dst--; + } while (dst > odst && + !IS_ASCII_OCTET(*dst) && !IS_UTF8_LEAD(*dst)); + } else if ((ops & CVT_ANSI) && IS_CSI_START(ch)) { /* Skip to end of ANSI escape sequence. */ - while (src[1] != '\0') - if (is_ansi_end(*++src)) + src++; /* skip the CSI start char */ + while (src < src_end) + if (!is_ansi_middle(*src++)) break; } else /* Just copy. */ - *dst++ = *src; + put_wchar(&dst, ch); } if ((ops & CVT_CRLF) && dst > odst && dst[-1] == '\r') dst--; *dst = '\0'; + if (lenp != NULL) + *lenp = dst - odst; } /* @@ -169,14 +210,18 @@ get_cvt_ops() * Are there any uppercase letters in this string? */ static int -is_ucase(s) - char *s; +is_ucase(str) + char *str; { - register char *p; + char *str_end = str + strlen(str); + LWCHAR ch; - for (p = s; *p != '\0'; p++) - if (isupper((unsigned char) *p)) + while (str < str_end) + { + ch = step_char(&str, +1, str_end); + if (IS_UPPER(ch)) return (1); + } return (0); } @@ -247,17 +292,26 @@ repaint_hilite(on) if (pos == NULL_POSITION) continue; epos = position(slinenum+1); +#if 0 /* * If any character in the line is highlighted, * repaint the line. + * + * {{ This doesn't work -- if line is drawn with highlights + * which should be erased (e.g. toggle -i with status column), + * we must redraw the line even if it has no highlights. + * For now, just repaint every line. }} */ - if (is_hilited(pos, epos, 1)) + if (is_hilited(pos, epos, 1, NULL)) +#endif { (void) forw_line(pos); goto_line(slinenum); put_line(); } } + if (!oldbot) + lower_left(); hide_hilite = save_hide_hilite; } @@ -272,6 +326,7 @@ clear_attn() POSITION old_end_attnpos; POSITION pos; POSITION epos; + int moved = 0; if (start_attnpos == NULL_POSITION) return; @@ -299,8 +354,11 @@ clear_attn() (void) forw_line(pos); goto_line(slinenum); put_line(); + moved = 1; } } + if (moved) + lower_left(); } #endif @@ -325,7 +383,7 @@ undo_search() * Compile a search pattern, for future use by match_pattern. */ static int -compile_pattern(pattern, search_type) +compile_pattern2(pattern, search_type) char *pattern; int search_type; { @@ -404,6 +462,30 @@ compile_pattern(pattern, search_type) return (0); } +/* + * Like compile_pattern, but convert the pattern to lowercase if necessary. + */ + static int +compile_pattern(pattern, search_type) + char *pattern; + int search_type; +{ + char *cvt_pattern; + int result; + + if (caseless != OPT_ONPLUS) + cvt_pattern = pattern; + else + { + cvt_pattern = (char*) ecalloc(1, cvt_length(strlen(pattern), CVT_TO_LC)); + cvt_text(cvt_pattern, pattern, (int *)NULL, CVT_TO_LC); + } + result = compile_pattern2(cvt_pattern, search_type); + if (cvt_pattern != pattern) + free(cvt_pattern); + return (result); +} + /* * Forget that we have a compiled pattern. */ @@ -441,8 +523,9 @@ uncompile_pattern() * Set sp and ep to the start and end of the matched string. */ static int -match_pattern(line, sp, ep, notbol) +match_pattern(line, line_len, sp, ep, notbol) char *line; + int line_len; char **sp; char **ep; int notbol; @@ -450,7 +533,7 @@ match_pattern(line, sp, ep, notbol) int matched; if (last_search_type & SRCH_NO_REGEX) - return (match(last_pattern, line, sp, ep)); + return (match(last_pattern, strlen(last_pattern), line, line_len, sp, ep)); #if HAVE_POSIX_REGCOMP { @@ -472,7 +555,7 @@ match_pattern(line, sp, ep, notbol) { int flags = (notbol) ? PCRE_NOTBOL : 0; int ovector[3]; - matched = pcre_exec(regpattern, NULL, line, strlen(line), + matched = pcre_exec(regpattern, NULL, line, line_len, 0, flags, ovector, 3) >= 0; if (!matched) return (0); @@ -506,7 +589,7 @@ match_pattern(line, sp, ep, notbol) *ep = regpattern->endp[0]; #endif #if NO_REGEX - matched = match(last_pattern, line, sp, ep); + matched = match(last_pattern, strlen(last_pattern), line, line_len, sp, ep); #endif return (matched); } @@ -530,17 +613,43 @@ clr_hilite() prep_startpos = prep_endpos = NULL_POSITION; } +/* + * Should any characters in a specified range be highlighted? + */ + static int +is_hilited_range(pos, epos) + POSITION pos; + POSITION epos; +{ + struct hilite *hl; + + /* + * Look at each highlight and see if any part of it falls in the range. + */ + for (hl = hilite_anchor.hl_first; hl != NULL; hl = hl->hl_next) + { + if (hl->hl_endpos > pos && + (epos == NULL_POSITION || epos > hl->hl_startpos)) + return (1); + } + return (0); +} + /* * Should any characters in a specified range be highlighted? * If nohide is nonzero, don't consider hide_hilite. */ public int -is_hilited(pos, epos, nohide) +is_hilited(pos, epos, nohide, p_matches) POSITION pos; POSITION epos; int nohide; + int *p_matches; { - struct hilite *hl; + int match; + + if (p_matches != NULL) + *p_matches = 0; if (!status_col && start_attnpos != NULL_POSITION && @@ -551,6 +660,16 @@ is_hilited(pos, epos, nohide) */ return (1); + match = is_hilited_range(pos, epos); + if (!match) + return (0); + + if (p_matches != NULL) + /* + * Report matches, even if we're hiding highlights. + */ + *p_matches = 1; + if (hilite_search == 0) /* * Not doing highlighting. @@ -563,16 +682,7 @@ is_hilited(pos, epos, nohide) */ return (0); - /* - * Look at each highlight and see if any part of it falls in the range. - */ - for (hl = hilite_anchor.hl_first; hl != NULL; hl = hl->hl_next) - { - if (hl->hl_endpos > pos && - (epos == NULL_POSITION || epos > hl->hl_startpos)) - return (1); - } - return (0); + return (1); } /* @@ -616,7 +726,7 @@ add_hilite(anchor, hl) } /* - * Adjust hl_startpos & hl_endpos to account for backspace processing. + * Adjust hl_startpos & hl_endpos to account for processing by cvt_text. */ static void adj_hilite(anchor, linepos, cvt_ops) @@ -625,19 +735,25 @@ adj_hilite(anchor, linepos, cvt_ops) int cvt_ops; { char *line; + char *oline; + int line_len; + char *line_end; struct hilite *hl; int checkstart; POSITION opos; POSITION npos; + LWCHAR ch; + int ncwidth; /* * The line was already scanned and hilites were added (in hilite_line). * But it was assumed that each char position in the line * correponds to one char position in the file. - * This may not be true if there are backspaces in the line. + * This may not be true if cvt_text modified the line. * Get the raw line again. Look at each character. */ - (void) forw_raw_line(linepos, &line); + (void) forw_raw_line(linepos, &line, &line_len); + line_end = line + line_len; opos = npos = linepos; hl = anchor->hl_first; checkstart = TRUE; @@ -662,41 +778,47 @@ adj_hilite(anchor, linepos, cvt_ops) hl = hl->hl_next; continue; /* {{ necessary }} */ } - if (*line == '\0') + if (line == line_end) break; - if (cvt_ops & CVT_ANSI) + + /* Get the next char from the line. */ + oline = line; + ch = step_char(&line, +1, line_end); + ncwidth = line - oline; + npos += ncwidth; + + /* Figure out how this char was processed by cvt_text. */ + if ((cvt_ops & CVT_BS) && ch == '\b') { - while (line[0] == ESC) + /* Skip the backspace and the following char. */ + oline = line; + ch = step_char(&line, +1, line_end); + ncwidth = line - oline; + npos += ncwidth; + } else if ((cvt_ops & CVT_TO_LC) && IS_UPPER(ch)) + { + /* Converted uppercase to lower. + * Note that this may have changed the number of bytes + * that the character occupies. */ + char dbuf[6]; + char *dst = dbuf; + put_wchar(&dst, TO_LOWER(ch)); + opos += dst - dbuf; + } else if ((cvt_ops & CVT_ANSI) && IS_CSI_START(ch)) + { + /* Skip to end of ANSI escape sequence. */ + line++; /* skip the CSI start char */ + npos++; + while (line < line_end) { - /* - * Found an ESC. The file position moves - * forward past the entire ANSI escape sequence. - */ - line++; npos++; - while (*line != '\0') - { - npos++; - if (is_ansi_end(*line++)) - break; - } + if (!is_ansi_middle(*line++)) + break; } - } - opos++; - npos++; - line++; - if (cvt_ops & CVT_BS) + } else { - while (line[0] == '\b' && line[1] != '\0') - { - /* - * Found a backspace. The file position moves - * forward by 2 relative to the processed line - * which was searched in hilite_line. - */ - npos += 2; - line += 2; - } + /* Ordinary unprocessed character. */ + opos += ncwidth; } } } @@ -707,14 +829,16 @@ adj_hilite(anchor, linepos, cvt_ops) * sp,ep delimit the first match already found. */ static void -hilite_line(linepos, line, sp, ep, cvt_ops) +hilite_line(linepos, line, line_len, sp, ep, cvt_ops) POSITION linepos; char *line; + int line_len; char *sp; char *ep; int cvt_ops; { char *searchp; + char *line_end = line + line_len; struct hilite *hl; struct hilite hilites; @@ -728,7 +852,7 @@ hilite_line(linepos, line, sp, ep, cvt_ops) * substrings of the line, may mark more than is correct * if the pattern starts with "^". This bug is fixed * for those regex functions that accept a notbol parameter - * (currently POSIX and V8-with-regexec2). }} + * (currently POSIX, PCRE and V8-with-regexec2). }} */ searchp = line; /* @@ -755,11 +879,11 @@ hilite_line(linepos, line, sp, ep, cvt_ops) */ if (ep > searchp) searchp = ep; - else if (*searchp != '\0') + else if (searchp != line_end) searchp++; else /* end of line */ break; - } while (match_pattern(searchp, &sp, &ep, 1)); + } while (match_pattern(searchp, line_end - searchp, &sp, &ep, 1)); /* * If there were backspaces in the original line, they @@ -890,7 +1014,7 @@ search_pos(search_type) pos = position(linenum); if (search_type & SRCH_FORW) { - pos = forw_raw_line(pos, (char **)NULL); + pos = forw_raw_line(pos, (char **)NULL, (int *)NULL); while (pos == NULL_POSITION) { if (++linenum >= sc_height) @@ -924,6 +1048,8 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos) POSITION *pendpos; { char *line; + char *cline; + int line_len; LINENUM linenum; char *sp, *ep; int line_match; @@ -966,7 +1092,7 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos) * starting position of that line in linepos. */ linepos = pos; - pos = forw_raw_line(pos, &line); + pos = forw_raw_line(pos, &line, &line_len); if (linenum != 0) linenum++; } else @@ -975,7 +1101,7 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos) * Read the previous line and save the * starting position of that line in linepos. */ - pos = back_raw_line(pos, &line); + pos = back_raw_line(pos, &line, &line_len); linepos = pos; if (linenum != 0) linenum--; @@ -1008,18 +1134,22 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos) * If we're doing backspace processing, delete backspaces. */ cvt_ops = get_cvt_ops(); - cvt_text(line, line, cvt_ops); + cline = calloc(1, cvt_length(line_len, cvt_ops)); + cvt_text(cline, line, &line_len, cvt_ops); /* * Test the next line to see if we have a match. * We are successful if we either want a match and got one, * or if we want a non-match and got one. */ - line_match = match_pattern(line, &sp, &ep, 0); + line_match = match_pattern(cline, line_len, &sp, &ep, 0); line_match = (!(search_type & SRCH_NO_MATCH) && line_match) || ((search_type & SRCH_NO_MATCH) && !line_match); if (!line_match) + { + free(cline); continue; + } /* * Got a match. */ @@ -1032,8 +1162,9 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos) * hilite list and keep searching. */ if (line_match) - hilite_line(linepos, line, sp, ep, cvt_ops); + hilite_line(linepos, cline, line_len, sp, ep, cvt_ops); #endif + free(cline); } else if (--matches <= 0) { /* @@ -1041,7 +1172,7 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos) * Return it. */ #if HILITE_SEARCH - if (hilite_search == 1) + if (hilite_search == OPT_ON) { /* * Clear the hilite list and add only @@ -1049,9 +1180,10 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos) */ clr_hilite(); if (line_match) - hilite_line(linepos, line, sp, ep, cvt_ops); + hilite_line(linepos, cline, line_len, sp, ep, cvt_ops); } #endif + free(cline); if (plinepos != NULL) *plinepos = linepos; return (0); @@ -1059,6 +1191,41 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos) } } + /* + * search for a pattern in history. If found, compile that pattern. + */ + static int +hist_pattern(search_type) + int search_type; +{ +#if CMD_HISTORY + char *pattern; + + set_mlist(ml_search, 0); + pattern = cmd_lastpattern(); + if (pattern == NULL) + return (0); + + if (compile_pattern(pattern, search_type) < 0) + return (0); + + is_ucase_pattern = is_ucase(pattern); + if (is_ucase_pattern && caseless != OPT_ONPLUS) + is_caseless = 0; + else + is_caseless = caseless; + +#if HILITE_SEARCH + if (hilite_search == OPT_ONPLUS && !hide_hilite) + hilite_screen(); +#endif + + return (1); +#else /* CMD_HISTORY */ + return (0); +#endif /* CMD_HISTORY */ +} + /* * Search for the n-th occurrence of a specified pattern, * either forward or backward. @@ -1075,14 +1242,14 @@ search(search_type, pattern, n) int n; { POSITION pos; - int ucase; + int result; if (pattern == NULL || *pattern == '\0') { /* * A null pattern means use the previously compiled pattern. */ - if (!prev_pattern()) + if (!prev_pattern() && !hist_pattern(search_type)) { error("No previous regular expression", NULL_PARG); return (-1); @@ -1118,16 +1285,13 @@ search(search_type, pattern, n) /* * Compile the pattern. */ - ucase = is_ucase(pattern); - if (caseless == OPT_ONPLUS) - cvt_text(pattern, pattern, CVT_TO_LC); if (compile_pattern(pattern, search_type) < 0) return (-1); /* * Ignore case if -I is set OR * -i is set AND the pattern is all lowercase. */ - is_ucase_pattern = ucase; + is_ucase_pattern = is_ucase(pattern); if (is_ucase_pattern && caseless != OPT_ONPLUS) is_caseless = 0; else @@ -1248,7 +1412,7 @@ prep_hilite(spos, epos, maxlines) { max_epos = spos; for (i = 0; i < maxlines; i++) - max_epos = forw_raw_line(max_epos, (char **)NULL); + max_epos = forw_raw_line(max_epos, (char **)NULL, (int *)NULL); } /* @@ -1344,18 +1508,23 @@ prep_hilite(spos, epos, maxlines) * It supports no metacharacters like *, etc. */ static int -match(pattern, buf, pfound, pend) - char *pattern, *buf; +match(pattern, pattern_len, buf, buf_len, pfound, pend) + char *pattern; + int pattern_len; + char *buf; + int buf_len; char **pfound, **pend; { register char *pp, *lp; + register char *pattern_end = pattern + pattern_len; + register char *buf_end = buf + buf_len; - for ( ; *buf != '\0'; buf++) + for ( ; buf < buf_end; buf++) { for (pp = pattern, lp = buf; *pp == *lp; pp++, lp++) - if (*pp == '\0' || *lp == '\0') + if (pp == pattern_end || lp == buf_end) break; - if (*pp == '\0') + if (pp == pattern_end) { if (pfound != NULL) *pfound = buf; diff --git a/src/bin/less/signal.c b/src/bin/less/signal.c index a641d99ee9..ce3714c706 100644 --- a/src/bin/less/signal.c +++ b/src/bin/less/signal.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -33,6 +33,8 @@ extern int lnloop; extern int linenums; extern int wscroll; extern int reading; +extern int quit_on_intr; +extern long jump_sline_fraction; /* * Interrupt signal handler. @@ -152,13 +154,12 @@ init_signals(on) #endif #ifdef SIGWINCH (void) LSIGNAL(SIGWINCH, winch); -#else +#endif #ifdef SIGWIND (void) LSIGNAL(SIGWIND, winch); #endif #ifdef SIGQUIT (void) LSIGNAL(SIGQUIT, SIG_IGN); -#endif #endif } else { @@ -241,12 +242,15 @@ psignals() if (sc_width != old_width || sc_height != old_height) { wscroll = (sc_height + 1) / 2; + calc_jump_sline(); screen_trashed = 1; } } #endif if (tsignals & S_INTERRUPT) { + if (quit_on_intr) + quit(QUIT_OK); bell(); /* * {{ You may wish to replace the bell() with diff --git a/src/bin/less/tags.c b/src/bin/less/tags.c index 409e1209e3..ab00faf004 100644 --- a/src/bin/less/tags.c +++ b/src/bin/less/tags.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -56,7 +56,7 @@ static int getentry(); * * Use either pattern or line number. * findgtag() always uses line number, so pattern is always NULL. - * findctag() usually either pattern (in which case line number is 0), + * findctag() uses either pattern (in which case line number is 0), * or line number (in which case pattern is NULL). */ struct taglist { @@ -75,10 +75,10 @@ struct tag { static struct tag *curtag; #define TAG_INS(tp) \ - (tp)->next = taglist.tl_first; \ - (tp)->prev = TAG_END; \ - taglist.tl_first->prev = (tp); \ - taglist.tl_first = (tp); + (tp)->next = TAG_END; \ + (tp)->prev = taglist.tl_last; \ + taglist.tl_last->next = (tp); \ + taglist.tl_last = (tp); #define TAG_RM(tp) \ (tp)->next->prev = (tp)->prev; \ @@ -418,7 +418,7 @@ ctagsearch() * starting position of that line in linepos. */ linepos = pos; - pos = forw_raw_line(pos, &line); + pos = forw_raw_line(pos, &line, (int *)NULL); if (linenum != 0) linenum++; @@ -498,7 +498,7 @@ findgtag(tag, type) #if !HAVE_POPEN return TAG_NOFILE; #else - char command[512]; + char *command; char *flag; char *qtag; char *cmd = lgetenv("LESSGLOBALTAGS"); @@ -528,10 +528,13 @@ findgtag(tag, type) qtag = shell_quote(tag); if (qtag == NULL) qtag = tag; + command = (char *) ecalloc(strlen(cmd) + strlen(flag) + + strlen(qtag) + 5, sizeof(char)); sprintf(command, "%s -x%s %s", cmd, flag, qtag); if (qtag != tag) free(qtag); fp = popen(command, "r"); + free(command); #endif } if (fp != NULL) @@ -539,6 +542,7 @@ findgtag(tag, type) while (fgets(buf, sizeof(buf), fp)) { char *name, *file, *line; + int len; if (sigs) { @@ -548,8 +552,9 @@ findgtag(tag, type) #endif return TAG_INTR; } - if (buf[strlen(buf) - 1] == '\n') - buf[strlen(buf) - 1] = 0; + len = strlen(buf); + if (len > 0 && buf[len-1] == '\n') + buf[len-1] = '\0'; else { int c; @@ -657,7 +662,7 @@ prevgtag() /* * Position the current file at at what is hopefully the tag that was chosen * using either findtag() or one of nextgtag() and prevgtag(). Returns -1 - * if it was unable to position at the tag, 0 if succesful. + * if it was unable to position at the tag, 0 if successful. */ static POSITION gtagsearch() @@ -695,14 +700,6 @@ gtagsearch() * The tag, file, and line will each be NUL-terminated pointers * into buf. */ - -#ifndef isspace -#define isspace(c) ((c) == ' ' || (c) == '\t' || (c) == '\n' || (c) == '\r' || (c) == '\f') -#endif -#ifndef isdigit -#define isdigit(c) ((c) >= '0' && (c <= '9')) -#endif - static int getentry(buf, tag, file, line) char *buf; /* standard or extended ctags -x format data */ @@ -712,12 +709,12 @@ getentry(buf, tag, file, line) { char *p = buf; - for (*tag = p; *p && !isspace(*p); p++) /* tag name */ + for (*tag = p; *p && !IS_SPACE(*p); p++) /* tag name */ ; if (*p == 0) return (-1); *p++ = 0; - for ( ; *p && isspace(*p); p++) /* (skip blanks) */ + for ( ; *p && IS_SPACE(*p); p++) /* (skip blanks) */ ; if (*p == 0) return (-1); @@ -725,27 +722,27 @@ getentry(buf, tag, file, line) * If the second part begin with other than digit, * it is assumed tag type. Skip it. */ - if (!isdigit(*p)) + if (!IS_DIGIT(*p)) { - for ( ; *p && !isspace(*p); p++) /* (skip tag type) */ + for ( ; *p && !IS_SPACE(*p); p++) /* (skip tag type) */ ; - for (; *p && isspace(*p); p++) /* (skip blanks) */ + for (; *p && IS_SPACE(*p); p++) /* (skip blanks) */ ; } - if (!isdigit(*p)) + if (!IS_DIGIT(*p)) return (-1); *line = p; /* line number */ - for (*line = p; *p && !isspace(*p); p++) + for (*line = p; *p && !IS_SPACE(*p); p++) ; if (*p == 0) return (-1); *p++ = 0; - for ( ; *p && isspace(*p); p++) /* (skip blanks) */ + for ( ; *p && IS_SPACE(*p); p++) /* (skip blanks) */ ; if (*p == 0) return (-1); *file = p; /* file name */ - for (*file = p; *p && !isspace(*p); p++) + for (*file = p; *p && !IS_SPACE(*p); p++) ; if (*p == 0) return (-1); diff --git a/src/bin/less/ttyin.c b/src/bin/less/ttyin.c index 5d99d335e9..0cb427bc2d 100644 --- a/src/bin/less/ttyin.c +++ b/src/bin/less/ttyin.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -26,6 +26,7 @@ static DWORD console_mode; public int tty; extern int sigs; +extern int utf_mode; /* * Open keyboard for input. @@ -131,6 +132,38 @@ getchr() */ quit(QUIT_ERROR); } +#endif +#if 0 /* allow entering arbitrary hex chars for testing */ + /* ctrl-A followed by two hex chars makes a byte */ + { + int hex_in = 0; + int hex_value = 0; + if (c == CONTROL('A')) + { + hex_in = 2; + result = 0; + continue; + } + if (hex_in > 0) + { + int v; + if (c >= '0' && c <= '9') + v = c - '0'; + else if (c >= 'a' && c <= 'f') + v = c - 'a' + 10; + else if (c >= 'A' && c <= 'F') + v = c - 'A' + 10; + else + hex_in = 0; + hex_value = (hex_value << 4) | v; + if (--hex_in > 0) + { + result = 0; + continue; + } + c = hex_value; + } + } #endif /* * Various parts of the program cannot handle @@ -141,5 +174,5 @@ getchr() c = '\340'; } while (result != 1); - return (c & 0377); + return (c & 0xFF); } diff --git a/src/bin/less/version.c b/src/bin/less/version.c index 9d23db6384..ddd062a201 100644 --- a/src/bin/less/version.c +++ b/src/bin/less/version.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2007 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. @@ -646,6 +646,67 @@ v380 11/24/02 Make LINENUM same as POSITION. v381 11/28/02 Make -N use 7 columns for line number if possible. ----------------------------------------------------------------- v382 2/3/04 Remove copyrighted code. +----------------------------------------------------------------- +v383 2/16/04 Add history file; add -K option; improve UTF-8 handling; + fix some signed char bugs (thanks to Christian Biere); + fix some upper/lower case bugs (thanks to Bjoern Jacke); + add erase2 char (thanks to David Lawrence); + add windows charset (thanks to Dimitar Zhekov). +v384 2/20/04 Improvements in UTF-8 handling. +v385 2/23/04 Fix UTF-8 output bug. +----------------------------------------------------------------- +v386 9/13/05 Improvements to UTF-8 shift & color (thanks to Charles Levert); + protect against invalid LESSOPEN and LESSCLOSE values. +v387 9/14/05 Update Charles Levert's UTF-8 patch. +v388 9/14/05 Change history behavior; change most sprintf calls to snprintf. +v389 9/14/05 Fix copy & paste with long lines; improve performance of + expand_linebuf; fix crash in init_mlist; +v390 9/15/05 Show search matches in status column even if -G is set. +----------------------------------------------------------------- +v391 9/17/05 Fix bugs. +v392 10/14/05 Fix line wrapping bug. +v393 10/19/05 Allow multiple attributes per char; fix bold+underline bug + (thanks again to Charles Levert). +v394 11/8/05 Fix prompt bug; fix compile problem in Windows build. +----------------------------------------------------------------- +v395 1/12/07 Update Unicode tables (thanks to Charles Levert); + don't chmod if LESSHISTFILE = /dev/null; + make -f work for directories; support DESTDIR in Makefile; + fix sigset_t detection in configure; + make "t" cmd traverse tags in correct order +v396 1/13/07 Add compatibility with POSIX more. +v397 3/21/07 Allow decimal point in number for % command; + Allow decimal point in number for -j option; + Allow n command to fetch last search pattern from history + (thanks to arno). +v398 3/22/07 Don't rewrite history file if not necessary; + fix bug when filenames contain "$". +v399 3/22/07 Don't move to bottom of screen at startup; + don't output extraneous newlines. +v400 3/23/07 Allow search to find pattern after null byte (PCRE and no-regex) + (thanks to Michael Constant). +----------------------------------------------------------------- +v401 3/24/07 Minor documentation fixes. +v402 3/30/07 Fix autoconf bug when memcpy etc are inline; + fix bug in terminating number following -j option. +v403 5/25/07 Fix Windows build. +v404 6/5/07 Fix display bug with F command and long lines. +v405 6/17/07 Fix display bug when using -w option. +v406 6/17/07 Fix secure build. +v407 8/16/07 Fix bugs; support CSI chars. +v408 10/1/07 Fix bug in -i with non-ASCII chars. +v409 10/12/07 Fix crash when viewing text with invalid UTF-8 sequences. +v411 11/6/07 Fix case-insensitive searching with non-ASCII text. +v412 11/6/07 Use symbolic SEEK constants. +v413 11/6/07 Fix search highlight bug with non-ASCII text. +v414 11/6/07 Fix display bug with no-wrap terminals. +v415 11/14/07 Add --follow-name option. +v416 11/22/07 Fix crash when searching text with invalid UTF-8 sequences. +v417 12/31/07 Don't support single-char CSI in UTF-8 mode; + fix bug with -R and invalid CSI sequences; + fix bug searching text with SGR sequences with -r; + emulate SGR sequences in WIN32 build. +v418 12/31/07 Clean up. */ -char version[] = "382"; +char version[] = "418";