diff --git a/contrib/less/LICENSE b/contrib/less/LICENSE index 7e4887bcd768..8112859e8ae8 100644 --- a/contrib/less/LICENSE +++ b/contrib/less/LICENSE @@ -1,27 +1,27 @@ Less License ------------ Less -Copyright (C) 1984-2005 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 are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/contrib/less/NEWS b/contrib/less/NEWS index 0154225de76c..3d6b0983c203 100644 --- a/contrib/less/NEWS +++ b/contrib/less/NEWS @@ -1,700 +1,712 @@ NEWS about less ====================================================================== For the latest news about less, see the "less" Web page: http://www.greenwoodsoftware.com/less You can also download the latest version of less from there. To report bugs, suggestions or comments, send email to bug-less@gnu.org or markn@greenwoodsoftware.com. ====================================================================== + Major changes between "less" versions 409 and 415 + +* 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. This probably breaks OS/9 support. ====================================================================== Major changes between "less" versions 378 and 381 * New -L option to disable LESSOPEN processing. * Further support for large (64 bit) file addressing. Large file support is now set up by the configure script. * Use autoconf 2.54. Replace configure.in, acconfig.h, defines.h.top with configure.ac. * Overstriking underscore with underscore is now bold or underlined depending on context. * Use only 7 spaces for line numbers in -N mode, if possible. * Fix some bugs in handling overstriking in UTF-8 files. * Fix some nroff issues in the man page. ====================================================================== Major changes between "less" versions 376 and 378 * Bug fixes: Default buffer space is now 64K as documented. Search highlighting works properly when used with -R. Windows version works properly when input file contains carriage returns. Clean up some compiler warnings. ====================================================================== Major changes between "less" versions 358 and 376 * -x option can now specify multiple variable-width tab stops. * -X option no longer disables keypad initialization. New option --no-keypad disables keypad initialization. * New commands t and T step through multiple tag matches. Added support for "global(1)" tags (see http://www.gnu.org/software/global/global.html). * New prompt style set by option -Pw defines the message printed while waiting for data in the F command. * System-wide lesskey file now defaults to sysless in etc directory instead of .sysless in bin directory. Use "configure --sysconfdir=..." to change it. (For backwards compatibility, .sysless in bin is still recognized.) * Pressing RightArrow or LeftArrow while entering a number now shifts the display N columns rather than editing the number itself. * Status column (enabled with -J) now shows search results. * Windows version sets window title. * Default LESSCHARSET for MS-DOS versions is now "dos". * Searching works better with ANSI (SGR) escape sequences. ANSI color escape sequences are now supported in the MS-DOS (DJGPP) version. * Improved performance in reading very large pipes. * Eliminated some dependencies on file offets being 32 bits. * Fixed problems when viewing files with very long lines. * Fixed overstriking in UTF-8 mode, and overstriking tabs. * Improved horizontal shifting of text using -R option with ANSI color. * Improved handling of filenames containing shell metacharacters. * Some fixes for EBCDIC systems. * Some fixes for OS/2 systems. ====================================================================== Major changes between "less" versions 354 and 358 * Add -J (--status-column) option to display a status column. * Add -# (--shift) option to set default horizontal shift distance. Default horizontal shift distance is now one-half screen width. * Horizontal shifting does not shift line numbers if -N is in effect. * Horizontal shifting acts as though -S were set, to avoid confusion. ====================================================================== Major changes between "less" versions 352 and 354 * Allow space after numeric-valued command line options. * Fix problem with configuring terminal libraries on some systems. * Add support for PCRE regular expression library. * Add --with-regex option to configure to allow manually selecting a regular expression library. * Fix bug compiling with SECURE = 1. ====================================================================== Major changes between "less" versions 346 and 352 * Enable UTF-8 if "UTF-8" appears in locale-related environment variables. * Add --with-editor option to configure script. * The -M prompt and = message now show the top and bottom line number. * Fix bug in running the editor on a file whose name contains quotes, etc. * Fix bug in horizontal scrolling of long lines. * Fix bug in doing :d on a file which contains marks. * Fix bug causing cleared lines to sometimes be filled with standout, bold, underline, etc. on certain terminals. * Fixes for MS-DOS (DJGPP) version. ====================================================================== Major changes between "less" versions 340 and 346 * The UTF-8 character set is now supported. * The default character set is now latin1 rather than ascii. * New option -R (--RAW-CONTROL-CHARS) is like -r but handles long (wrapped) lines correctly, as long as the input contains only normal text and ANSI color escape sequences. * New option -F (--quit-if-one-screen) quits if the text fits on the first screen. * The -w option now highlights the target line of a g or p command. * A system-wide lesskey file is supported (LESSKEY_SYSTEM). * New escape for prompt strings: %c is replaced by column number. * New escape for prompt strings: %P is replaced by percentage into file, based on line number rather than byte offset. * HOME and END keys now jump to beginning of file or end of file. ====================================================================== Major changes between "less" versions 337 and 340 * Command line options for less may now be given in either the old single-letter form, or a new long name form (--option-name). See the less man page or "less --help" for the list of long option names. * Command line options for lesskey may now be given in a new long name form. See the lesskey man page for the list of long option names. * New command -- toggles an option using the long option name. * New command __ queries an option using the long option name. * The old -- command is renamed as -!. * If a ^P is entered between the dash and the option letter of the - command, the message describing the new setting is suppressed. * Lesskey files may now contain \k escape sequences to represent the "special" keys (arrows, PAGE-UP/PAGE-DOWN, HOME, END, INSERT, DELETE). * New command :d removes the current file from the list of files. * New option -~ (like -w before version 335) suppresses tildes after end-of-file. * Less is now released under the GNU General Public License. ====================================================================== Major changes between "less" versions 335 and 337 * Fixed bugs in "make install". ====================================================================== Major changes between "less" versions 332 and 335 * The old -w flag (suppress tildes after end-of-file) has been removed. * New -w flag highlights the first new line after a forward-screen. * New -W flag highlights the first new line after any forward movement. * Window resize works even if LINES and/or COLUMNS environment variables are incorrect. * New percent escapes for prompt strings: %d is replaced by the page number, and %D is replaced by the number of pages in the file. * Added charsets "iso8859" and "ebcdic". * In Windows version, uses HOMEDRIVE and HOMEPATH if HOME is not defined. * Fixed some bugs causing incorrect display on DOS/Windows. ====================================================================== Major changes between "less" versions 330 and 332 * Filenames from the command line are entered into the command history, so UPARROW/DOWNARROW can be used to retrieve them from the :e command. * Now works correctly on Windows when using a scrolling terminal window (buffer larger than display window). * On Windows, now restores the console screen on exit. Use -X to get the old behavior. * Fixed bug on Windows when CAPS-LOCK or NUM-LOCK is pressed. * Fixed bug on Windows when piping output of an interactive program. * Fixed bug in tags file processing when tags file has DOS-style line terminators (CR/LF). * Fixed compilation problem on OS/2. ====================================================================== Major changes between "less" versions 321 and 330 * Now supports filenames containing spaces (in double quotes). New option -" can be used to change the quoting characters. * In filename completion, a slash is appended to a directory name. If the environment variable LESSSEPARATOR is set, the value of that variable, rather than a slash, is appended. * LeftArrow and RightArrow are same as ESC-[ and ESC-]. * Added commands ESC-( and ESC-), same as ESC-[ and ESC-]. * A "quit" command defined in a lesskey file may now have an "extra" string, which is used to return an exit code from less when it quits. * New environment variables LESSMETACHARS and LESSMETAESCAPE provide more control over how less interfaces to the shell. * Ported to Microsoft Visual C compiler for Windows. * Ported to DJGPP compiler for MS-DOS. * Bug fixes. ====================================================================== Major changes between "less" versions 291 and 321 * Command line at bottom of screen now scrolls, so it can be longer than the screen width. * New commands ESC-] and ESC-[ scroll the display horizontally. * New command ESC-SPACE scrolls forward a full screen, even if it hits end-of-file. * Alternate modifiers for search commands: ^N is same as !, ^F is same as @, and ^E is same as *. * New modifier for search commands: ^K means highlight the matches currently on-screen, but don't move to the first match. * New modifier for search commands: ^R means don't use regular expressions in the search. * Environment variable LESSKEY gives name of default lesskey file. * Environment variable LESSSECURE will force less to run in "secure" mode. * Command line argument "--" signals that the rest of the arguments are files (not option flags). * Help file (less.hlp) is no longer installed. Help text is now embedded in the less executable itself. * Added -Ph to change the prompt for the help text. Added -Ps to change the default short prompt (same as plain -P). * Ported to the Borland C compiler for MS-DOS. * Ported to Windows 95 & Windows NT. * Ported to OS-9. * Ported to GNU Hurd. ====================================================================== Major changes between "less" versions 290 and 291 * Less environment variables can be specified in lesskey files. * Fixed MS-DOS build. ====================================================================== Major changes between "less" versions 278 and 290 * Accepts GNU-style options "--help" and "--version". * OS/2 version looks for less.ini in $HOME before $INIT and $PATH. * Bug fixes ====================================================================== Major changes between "less" versions 252 and 278 * A LESSOPEN preprocessor may now pipe the converted file data to less, rather than writing it to a temporary file. * Search pattern highlighting has been fixed. It now highlights reliably, even if a string is split across two screen lines, contains TABs, etc. * The -F flag (which suppress search highlighting) has been changed to -G. A new flag, -g, changes search highlighting to highlight only the string found by the last search command, instead of all strings which match the last search command. * New flag -I acts like -i, but ignores case even if the search pattern contains uppercase letters. * Less now checks for the environment variable VISUAL before EDITOR. * Ported to OS/2. ====================================================================== Major changes between "less" versions 237 and 252 * Changes in line-editing keys: The literal key is now ^V or ^A rather than \ (backslash). Filename completion commands (TAB and ^L) are disabled when typing a search pattern. * Line-editing command keys can be redefined using lesskey. * Lesskey with no input file defaults to $HOME/.lesskey rather than standard input. * New option -V displays version number of less. * New option -V displays version number of lesskey. * Help file less.hlp is now installed by default in /usr/local/share rather than /usr/local/lib. ====================================================================== Major changes between "less" versions 170 and 237 * By popular demand, text which matches the current search pattern is highlighted. New -F flag disables this feature. * Henry Spencer's regexp.c is now included, for systems which do not have a regular expression library. regexp.c is Copyright (c) 1986 by University of Toronto. * New line-editing keys, including command history (arrow keys) and filename completion (TAB). * Input preprocessor allows modification of input files (e.g. uncompress) via LESSOPEN/LESSCLOSE environment variables. * New -X flag disables sending termcap "ti" and "te" (initialize and deinitialize) strings to the terminal. * Changing -i from within less now correctly affects a subsequent repeated search. * Searching for underlined or overstruck text now works when the -u flag is in effect, rather than the -i flag. * Use setlocale (LANG and LC_CTYPE environment variables) to determine the character set if LESSCHARSET/LESSCHARDEF are not set. * The default format for displaying binary characters is now standout (reverse video) rather than blinking. This can still be changed by setting the LESSBINFMT environment variable. * Use autoconf installation technology. * Ported to MS-DOS. ******************************** Things that may surprise you ******************************** * When you enter text at the bottom of the screen (search string, filename, etc.), some keys act different than previously. Specifically, \ (backslash), ESC, TAB, BACKTAB, and control-L now have line editing functions. * Some previous unofficial versions of less were able to display compressed files. The new LESSOPEN/LESSCLOSE feature now provides this functionality in a different way. * Some previous unofficial versions of less provided a -Z flag to set the number of lines of text to retain between full screen scrolls. The -z-n flag (that is, -z with a negative number) provides this functionality. ====================================================================== Major changes between "less" versions 123 and 170 * New option -j allows target lines to be positioned anywhere on screen. * New option -S truncates displayed line at the screen width, rather than wrapping onto the next line. * New option -y limits amount of forward scroll. * New option -T specifies a "tags" file. * Non-printable, non-control characters are displayed in octal. Such characters, as well as control characters, are displayed in blinking mode. * New command -+ sets an option to its default. * New command -- sets an option to the opposite of its default. * Lesskey file may have a string appended to a key's action, which acts as though typed in after the command. * New commands ESC-^F and ESC-^B match arbitrary types of brackets. * New command F monitors a growing file (like "tail -f"). * New command | pipes a section of the input file into a shell command. * New command :x directly jumps to a file in the command line list. * Search commands have been enhanced and reorganized: n Repeat search, same direction. N Repeat search, opposite direction. ESC-/ Search forward thru file boundaries ESC-? Search backward thru file boundaries ESC-n Repeat search thru file boundaries, same direction. ESC-N Repeat search thru file boundaries, opposite direction. Special character * causes search to search thru file boundaries. Special character @ causes search to begin at start/end of file list. * Examining a new file adds it to the command line list. A list of files, or an expression which matches more than one file, may be examined; all of them are added to the command line list. * Environment variables LESSCHARSET and LESSCHARDEF can define a non-ASCII character set. * Partial support for MSDOS, including options -R for repainting screen on quit, -v/-V to select video mode, and -W to change window size. ====================================================================== Major changes between "less" versions 97 and 123 * New option (-N) causes line numbers to be displayed in the text of the file (like vi "set nu"). * New option (-?) prints help message immediately. * New option (-r) displays "raw" control characters, without mapping them to ^X notation. * New option (-f) forces less to open non-regular files (directories, etc). * New option (-k) can be used to specify lesskey files by name. * New option (-y) can be used to set a forward scroll limit (like -h sets a backward scroll limit). * File marks (set by the m command) are now preserved when a new file is edited. The ' command can thus be used to switch files. * New command ESC-/ searches all files (on the command line) for a pattern. * New command ESC-n repeats previous search, spanning files. * The N command has been changed to repeat the previous search in the reverse direction. The old N command is still available via :n. * New command ESC-N repeats previous search in the reverse direction and spanning files. * 8 bit characters are now supported. A new option (-g) can be used to strip off the eighth bit (the previous behavior). * Options which take a following string (like -t) may now optionally have a space between the option letter and the string. * Six new commands { } ( ) [ and ] can be used to match brackets of specific types, similar to vi % command. * New commands z and w move forward/backward one window and simultaneously set the window size. * Prompt string expansion now has %L for line number of the last line in the file, and %E for the name of the editor. Also, % escapes which refer to a line (b=bottom, t=top, etc.) can use j for the jump target line. * New environment variable LESSEDIT can be used to tailor the command string passed to the editor by the v command. * Examining a file which was previously examined will return to the same position in the file. * A "%" is expanded to the current filename and a "#" to the previous filename, in both shell commands and the E command. (Previously % worked only in shell commands and # worked only in the E command.) * New command ":ta" is equivalent to "-t". * New command "s" is equivalent to "-l". * The - command may be followed by "+X" to revert to the default for option X, or "-X" to get the opposite of the default. * Lesskey files may now include characters after the action as extra input to be parsed after the action; for example: "toggle-option X" to toggle a specific option X. + diff --git a/contrib/less/README b/contrib/less/README index 73329d63b87c..a456aa631ebe 100644 --- a/contrib/less/README +++ b/contrib/less/README @@ -1,238 +1,238 @@ - Less, version 409 + Less, version 415 - This is the distribution of less, version 409, released 12 Oct 2007. + This is the distribution of less, version 415, released 15 Nov 2007. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or modify it under the terms of either: 1. The GNU General Public License, as published by the Free Software Foundation; either version 2, or (at your option) any later version. A copy of this license is in the file COPYING. or 2. The Less License, in the file LICENSE. Please report any problems to bug-less@gnu.org or markn@greenwoodsoftware.com. See http://www.greenwoodsoftware.com/less for the latest info. You may also contact the author at: Mark Nudelman Greenwood Software PO Box 2402 El Granada, CA 94018 USA ========================================================================= This is the distribution of "less", a paginator similar to "more" or "pg". The formatted manual page is in less.man. The manual page nroff source is in less.nro. Major changes made since the last posted version are in NEWS. ======================================================================= INSTALLATION (Unix systems only): 1. Move the distributed source to its own directory and unpack it, if you have not already done so. 2. Type "sh configure". This will generate a Makefile and a defines.h. Warning: if you have a GNU sed, make sure it is version 2.05 or later. The file INSTALL describes the usage of the configure program in general. In addition, these options to configure are supported: --with-editor=program Specifies the default editor program used by the "v" command. The default is "vi". --with-regex=lib Specifies the regular expression library used by less for pattern matching. The default is "auto", which means the configure program finds a regular expression library automatically. Other values are: posix Use the POSIX-compatible regcomp. pcre Use the PCRE library. regcmp Use the regcmp library. re_comp Use the re_comp library. regcomp Use the V8-compatible regcomp. regcomp-local Use Henry Spencer's V8-compatible regcomp (source is supplied with less). --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 your system that configure might not have detected, you may fix the Makefile now. Take particular notice of the list of "terminal" libraries in the LIBS definition in the Makefile; these may need to be edited. The terminal libraries will be some subset of -lncurses -lcurses -ltermcap -ltermlib If you wish, you may edit defines.h to remove some optional features. If you choose not to include some features in your version, you may wish to edit the manual page "less.nro" and the help page "less.hlp" to remove the descriptions of the features which you are removing. If you edit less.hlp, you should run "make -f Makefile.aut help.c". 4. Type "make" and watch the fun. 5. If the make succeeds, it will generate the programs "less", "lesskey" and "lessecho" in your current directory. Test the generated programs. 6. When satisfied that it works, if you wish to install it in a public place, type "make install". The default install destinations are: Executables (less, lesskey, lessecho) in /usr/local/bin Documentation (less.nro, lesskey.nro) in /usr/local/man/man1 If you want to install any of these files elsewhere, define bindir and/or mandir to the appropriate directories. If you have any problems building or running "less", suggestions, complaints, etc., you may mail to the author at markn@greenwoodsoftware.com. Note to hackers: comments noting possible improvements are enclosed in double curly brackets {{ like this }}. ======================================================================= INSTALLATION (MS-DOS systems only, with Microsoft C, Borland C, or DJGPP) 1. Move the distributed source to its own directory. Depending on your compiler, you may need to convert the source to have CR-LF rather than LF as line terminators. 2. If you are using Microsoft C, rename MAKEFILE.DSU to MAKEFILE. If you are using Borland C, rename MAKEFILE.DSB to MAKEFILE. If you are using DJGPP, rename MAKEFILE.DSG to MAKEFILE. 3. Look at MAKEFILE to make sure that the definitions for CC and LIBDIR are correct. CC should be the name of your C compiler and LIBDIR should be the directory where the C libraries reside (for Microsoft C only). If these definitions need to be changed, you can either modify the definitions directly in MAKEFILE, or set your environment variables CC and/or LIBDIR to override the definitions in MAKEFILE. 4. If you wish, you may edit DEFINES.DS to remove some optional features. If you choose not to include some features in your version, you may wish to edit the manual page LESS.MAN and the help page HELP.C to remove the descriptions of the features which you are removing. 5. Run your "make" program and watch the fun. If your "make" requires a flag to import environment variables, you should use that flag. If your compiler runs out of memory, try running "make -n >cmds.bat" and then run cmds.bat. 6. If the make succeeds, it will generate the programs "LESS.EXE" and "LESSKEY.EXE" in your current directory. Test the generated programs. 7. When satisfied that it works, you may wish to install LESS.EXE and LESSKEY.EXE in a directory which is included in your PATH. ======================================================================= INSTALLATION (Windows-95, Windows-98 and Windows-NT systems only, with Borland C or Microsoft Visual C++) 1. Move the distributed source to its own directory. 2. If you are using Borland C, rename Makefile.wnb to Makefile. If you are using Microsoft Visual C++, rename Makefile.wnm to Makefile. 3. Check the Makefile to make sure the definitions look ok. 4. If you wish, you may edit defines.wn to remove some optional features. If you choose not to include some features in your version, you may wish to edit the manual page less.man and the help page help.c to remove the descriptions of the features which you are removing. 5. Type "make" and watch the fun. 6. If the make succeeds, it will generate the programs "less.exe" and "lesskey.exe" in your current directory. Test the generated programs. 7. When satisfied that it works, if you wish to install it in a public place, type "make install". See step 6 of the Unix installation instructions for details on how to change the default installation directories. ======================================================================= INSTALLATION (OS/2 systems only, with EMX C) 1. Move the distributed source to its own directory. 2. Rename Makefile.o2e to Makefile. 3. Check the Makefile to make sure the definitions look ok. 4. If you wish, you may edit defines.o2 to remove some optional features. If you choose not to include some features in your version, you may wish to edit the manual page less.man and the help page help.c to remove the descriptions of the features which you are removing. 5. Type "make" and watch the fun. 6. If the make succeeds, it will generate the programs "less.exe" and "lesskey.exe" in your current directory. Test the generated programs. 7. Make sure you have the emx runtime installed. You need the emx DLLs emx.dll and emxlibcs.dll and also the termcap database, termcap.dat. Make sure you have termcap.dat either in the default location or somewhere in a directory listed in the PATH or INIT environment variables. 8. When satisfied that it works, you may wish to install less.exe, lesskey.exe and scrsize.exe in a directory which is included in your PATH. scrsize.exe is required only if you use a terminal emulator such as xterm or rxvt. ======================================================================= INSTALLATION (OS-9 systems only, with Microware C or Ultra C) 1. Move the distributed source to its own directory. 2. If you are using Microware C, rename Makefile.o9c to Makefile. If you are using Ultra C, rename Makefile.o9u to Makefile. 3. Check the Makefile to make sure the definitions look ok. 4. If you wish, you may edit defines.o9 to remove some optional features. If you choose not to include some features in your version, you may wish to edit the manual page less.man and the help page help.c to remove the descriptions of the features which you are removing. 5. Type "dmake" and watch the fun. The standard OS-9 "make" will probably not work. If you don't have dmake, you can get a copy from os9archive.rtsi.com. 6. If the make succeeds, it will generate the programs "less" and "lesskey" in your current directory. Test the generated programs. 7. When satisfied that it works, if you wish to install it in a public place, type "dmake install". See step 6 of the Unix installation instructions for details on how to change the default installation directories. ======================================================================= ACKNOWLEDGMENTS: Some versions of the less distribution are packaged using Info-ZIP's compression utility. Info-ZIP's software is free and can be obtained as source code or executables from various anonymous-ftp sites, including ftp.uu.net:/pub/archiving/zip. diff --git a/contrib/less/ch.c b/contrib/less/ch.c index 2ac14d7a1a8e..eb607d593b01 100644 --- a/contrib/less/ch.c +++ b/contrib/less/ch.c @@ -1,866 +1,893 @@ /* * 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. * * For more information about less, or for information on how to * contact the author, see the README file. */ /* * Low level character input from the input file. * We use these special purpose routines which optimize moving * both forward and backward from the current read pointer. */ #include "less.h" #if MSDOS_COMPILER==WIN32C #include #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; /* * Pool of buffers holding the most recently used blocks of the input file. * The buffer pool is kept as a doubly-linked circular list, * in order from most- to least-recently used. * The circular list is anchored by the file state "thisfile". */ #define LBUFSIZE 8192 struct buf { struct buf *next, *prev; struct buf *hnext, *hprev; BLOCKNUM block; unsigned int datasize; unsigned char data[LBUFSIZE]; }; struct buflist { /* -- Following members must match struct buf */ struct buf *buf_next, *buf_prev; struct buf *buf_hnext, *buf_hprev; }; /* * The file state is maintained in a filestate structure. * A pointer to the filestate is kept in the ifile structure. */ #define BUFHASH_SIZE 64 struct filestate { struct buf *buf_next, *buf_prev; struct buflist hashtbl[BUFHASH_SIZE]; int file; int flags; POSITION fpos; int nbufs; BLOCKNUM block; unsigned int offset; POSITION fsize; }; #define ch_bufhead thisfile->buf_next #define ch_buftail thisfile->buf_prev #define ch_nbufs thisfile->nbufs #define ch_block thisfile->block #define ch_offset thisfile->offset #define ch_fpos thisfile->fpos #define ch_fsize thisfile->fsize #define ch_flags thisfile->flags #define ch_file thisfile->file #define END_OF_CHAIN ((struct buf *)&thisfile->buf_next) #define END_OF_HCHAIN(h) ((struct buf *)&thisfile->hashtbl[h]) #define BUFHASH(blk) ((blk) & (BUFHASH_SIZE-1)) #define FOR_BUFS_IN_CHAIN(h,bp) \ for (bp = thisfile->hashtbl[h].buf_hnext; \ bp != END_OF_HCHAIN(h); bp = bp->hnext) #define HASH_RM(bp) \ (bp)->hnext->hprev = (bp)->hprev; \ (bp)->hprev->hnext = (bp)->hnext; #define HASH_INS(bp,h) \ (bp)->hnext = thisfile->hashtbl[h].buf_hnext; \ (bp)->hprev = END_OF_HCHAIN(h); \ thisfile->hashtbl[h].buf_hnext->hprev = (bp); \ thisfile->hashtbl[h].buf_hnext = (bp); static struct filestate *thisfile; static int ch_ungotchar = -1; static int maxbufs = -1; extern int autobuf; extern int sigs; extern int secure; +extern int screen_trashed; +extern int follow_mode; extern constant char helpdata[]; extern constant int size_helpdata; extern IFILE curr_ifile; #if LOGFILE extern int logfile; extern char *namelogfile; #endif static int ch_addbuf(); /* * Get the character pointed to by the read pointer. * ch_get() is a macro which is more efficient to call * than fch_get (the function), in the usual case * that the block desired is at the head of the chain. */ #define ch_get() ((ch_block == ch_bufhead->block && \ ch_offset < ch_bufhead->datasize) ? \ ch_bufhead->data[ch_offset] : fch_get()) int fch_get() { register struct buf *bp; register int n; register int slept; register int h; POSITION pos; POSITION len; if (thisfile == NULL) return (EOI); slept = FALSE; /* * Look for a buffer holding the desired block. */ h = BUFHASH(ch_block); FOR_BUFS_IN_CHAIN(h, bp) { if (bp->block == ch_block) { if (ch_offset >= bp->datasize) /* * Need more data in this buffer. */ goto read_more; goto found; } } /* * Block is not in a buffer. * Take the least recently used buffer * and read the desired block into it. * If the LRU buffer has data in it, * then maybe allocate a new buffer. */ if (ch_buftail == END_OF_CHAIN || ch_buftail->block != -1) { /* * There is no empty buffer to use. * Allocate a new buffer if: * 1. We can't seek on this file and -b is not in effect; or * 2. We haven't allocated the max buffers for this file yet. */ if ((autobuf && !(ch_flags & CH_CANSEEK)) || (maxbufs < 0 || ch_nbufs < maxbufs)) if (ch_addbuf()) /* * Allocation failed: turn off autobuf. */ autobuf = OPT_OFF; } bp = ch_buftail; HASH_RM(bp); /* Remove from old hash chain. */ bp->block = ch_block; bp->datasize = 0; HASH_INS(bp, h); /* Insert into new hash chain. */ read_more: pos = (ch_block * LBUFSIZE) + bp->datasize; if ((len = ch_length()) != NULL_POSITION && pos >= len) /* * At end of file. */ return (EOI); if (pos != ch_fpos) { /* * Not at the correct position: must seek. * If input is a pipe, we're in trouble (can't seek on a pipe). * Some data has been lost: just return "?". */ if (!(ch_flags & CH_CANSEEK)) return ('?'); - if (lseek(ch_file, (off_t)pos, 0) == BAD_LSEEK) + if (lseek(ch_file, (off_t)pos, SEEK_SET) == BAD_LSEEK) { error("seek error", NULL_PARG); clear_eol(); return (EOI); } ch_fpos = pos; } /* * Read the block. * If we read less than a full block, that's ok. * We use partial block and pick up the rest next time. */ if (ch_ungotchar != -1) { bp->data[bp->datasize] = ch_ungotchar; n = 1; ch_ungotchar = -1; } else if (ch_flags & CH_HELPFILE) { bp->data[bp->datasize] = helpdata[ch_fpos]; n = 1; } else { n = iread(ch_file, &bp->data[bp->datasize], (unsigned int)(LBUFSIZE - bp->datasize)); } if (n == READ_INTR) return (EOI); if (n < 0) { #if MSDOS_COMPILER==WIN32C if (errno != EPIPE) #endif { error("read error", NULL_PARG); clear_eol(); } n = 0; } #if LOGFILE /* * If we have a log file, write the new data to it. */ if (!secure && logfile >= 0 && n > 0) write(logfile, (char *) &bp->data[bp->datasize], n); #endif ch_fpos += n; bp->datasize += n; /* * If we have read to end of file, set ch_fsize to indicate * the position of the end of file. */ if (n == 0) { ch_fsize = pos; if (ignore_eoi) { /* * We are ignoring EOF. * Wait a while, then try again. */ if (!slept) { PARG parg; parg.p_string = wait_message(); ierror("%s", &parg); } #if !MSDOS_COMPILER sleep(1); #else #if MSDOS_COMPILER==WIN32C Sleep(1000); #endif #endif slept = TRUE; + +#if 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); } found: if (ch_bufhead != bp) { /* * Move the buffer to the head of the buffer chain. * This orders the buffer chain, most- to least-recently used. */ bp->next->prev = bp->prev; bp->prev->next = bp->next; bp->next = ch_bufhead; bp->prev = END_OF_CHAIN; ch_bufhead->prev = bp; ch_bufhead = bp; /* * Move to head of hash chain too. */ HASH_RM(bp); HASH_INS(bp, h); } if (ch_offset >= bp->datasize) /* * After all that, we still don't have enough data. * Go back and try again. */ goto read_more; return (bp->data[ch_offset]); } /* * ch_ungetchar is a rather kludgy and limited way to push * a single char onto an input file descriptor. */ public void ch_ungetchar(c) int c; { if (c != -1 && ch_ungotchar != -1) error("ch_ungetchar overrun", NULL_PARG); ch_ungotchar = c; } #if LOGFILE /* * Close the logfile. * If we haven't read all of standard input into it, do that now. */ public void end_logfile() { static int tried = FALSE; if (logfile < 0) return; if (!tried && ch_fsize == NULL_POSITION) { tried = TRUE; ierror("Finishing logfile", NULL_PARG); while (ch_forw_get() != EOI) if (ABORT_SIGS()) break; } close(logfile); logfile = -1; namelogfile = NULL; } /* * Start a log file AFTER less has already been running. * Invoked from the - command; see toggle_option(). * Write all the existing buffered data to the log file. */ public void sync_logfile() { register struct buf *bp; int warned = FALSE; BLOCKNUM block; BLOCKNUM nblocks; nblocks = (ch_fpos + LBUFSIZE - 1) / LBUFSIZE; for (block = 0; block < nblocks; block++) { for (bp = ch_bufhead; ; bp = bp->next) { if (bp == END_OF_CHAIN) { if (!warned) { error("Warning: log file is incomplete", NULL_PARG); warned = TRUE; } break; } if (bp->block == block) { write(logfile, (char *) bp->data, bp->datasize); break; } } } } #endif /* * Determine if a specific block is currently in one of the buffers. */ static int buffered(block) BLOCKNUM block; { register struct buf *bp; register int h; h = BUFHASH(block); FOR_BUFS_IN_CHAIN(h, bp) { if (bp->block == block) return (TRUE); } return (FALSE); } /* * Seek to a specified position in the file. * Return 0 if successful, non-zero if can't seek there. */ public int ch_seek(pos) register POSITION pos; { BLOCKNUM new_block; POSITION len; if (thisfile == NULL) return (0); len = ch_length(); if (pos < ch_zero() || (len != NULL_POSITION && pos > len)) return (1); new_block = pos / LBUFSIZE; if (!(ch_flags & CH_CANSEEK) && pos != ch_fpos && !buffered(new_block)) { if (ch_fpos > pos) return (1); while (ch_fpos < pos) { if (ch_forw_get() == EOI) return (1); if (ABORT_SIGS()) return (1); } return (0); } /* * Set read pointer. */ ch_block = new_block; ch_offset = pos % LBUFSIZE; return (0); } /* * Seek to the end of the file. */ public int ch_end_seek() { POSITION len; if (thisfile == NULL) return (0); if (ch_flags & CH_CANSEEK) ch_fsize = filesize(ch_file); len = ch_length(); if (len != NULL_POSITION) return (ch_seek(len)); /* * Do it the slow way: read till end of data. */ while (ch_forw_get() != EOI) if (ABORT_SIGS()) return (1); return (0); } /* * Seek to the beginning of the file, or as close to it as we can get. * We may not be able to seek there if input is a pipe and the * beginning of the pipe is no longer buffered. */ public int ch_beg_seek() { register struct buf *bp, *firstbp; /* * Try a plain ch_seek first. */ if (ch_seek(ch_zero()) == 0) return (0); /* * Can't get to position 0. * Look thru the buffers for the one closest to position 0. */ firstbp = bp = ch_bufhead; if (bp == END_OF_CHAIN) return (1); while ((bp = bp->next) != END_OF_CHAIN) if (bp->block < firstbp->block) firstbp = bp; ch_block = firstbp->block; ch_offset = 0; return (0); } /* * Return the length of the file, if known. */ public POSITION ch_length() { if (thisfile == NULL) return (NULL_POSITION); if (ignore_eoi) return (NULL_POSITION); if (ch_flags & CH_HELPFILE) return (size_helpdata); return (ch_fsize); } /* * Return the current position in the file. */ public POSITION ch_tell() { if (thisfile == NULL) return (NULL_POSITION); return (ch_block * LBUFSIZE) + ch_offset; } /* * Get the current char and post-increment the read pointer. */ public int ch_forw_get() { register int c; if (thisfile == NULL) return (EOI); c = ch_get(); if (c == EOI) return (EOI); if (ch_offset < LBUFSIZE-1) ch_offset++; else { ch_block ++; ch_offset = 0; } return (c); } /* * Pre-decrement the read pointer and get the new current char. */ public int ch_back_get() { if (thisfile == NULL) return (EOI); if (ch_offset > 0) ch_offset --; else { if (ch_block <= 0) return (EOI); if (!(ch_flags & CH_CANSEEK) && !buffered(ch_block-1)) return (EOI); ch_block--; ch_offset = LBUFSIZE-1; } return (ch_get()); } /* * Set max amount of buffer space. * bufspace is in units of 1024 bytes. -1 mean no limit. */ public void ch_setbufspace(bufspace) int bufspace; { if (bufspace < 0) maxbufs = -1; else { maxbufs = ((bufspace * 1024) + LBUFSIZE-1) / LBUFSIZE; if (maxbufs < 1) maxbufs = 1; } } /* * Flush (discard) any saved file state, including buffer contents. */ public void ch_flush() { register struct buf *bp; if (thisfile == NULL) return; if (!(ch_flags & CH_CANSEEK)) { /* * If input is a pipe, we don't flush buffer contents, * since the contents can't be recovered. */ ch_fsize = NULL_POSITION; return; } /* * Initialize all the buffers. */ for (bp = ch_bufhead; bp != END_OF_CHAIN; bp = bp->next) bp->block = -1; /* * Figure out the size of the file, if we can. */ ch_fsize = filesize(ch_file); /* * Seek to a known position: the beginning of the file. */ ch_fpos = 0; ch_block = 0; /* ch_fpos / LBUFSIZE; */ ch_offset = 0; /* ch_fpos % LBUFSIZE; */ #if 1 /* * This is a kludge to workaround a Linux kernel bug: files in * /proc have a size of 0 according to fstat() but have readable * data. They are sometimes, but not always, seekable. * Force them to be non-seekable here. */ if (ch_fsize == 0) { ch_fsize = NULL_POSITION; ch_flags &= ~CH_CANSEEK; } #endif - if (lseek(ch_file, (off_t)0, 0) == BAD_LSEEK) + if (lseek(ch_file, (off_t)0, SEEK_SET) == BAD_LSEEK) { /* * Warning only; even if the seek fails for some reason, * there's a good chance we're at the beginning anyway. * {{ I think this is bogus reasoning. }} */ error("seek error to 0", NULL_PARG); } } /* * Allocate a new buffer. * The buffer is added to the tail of the buffer chain. */ static int ch_addbuf() { register struct buf *bp; /* * Allocate and initialize a new buffer and link it * onto the tail of the buffer list. */ bp = (struct buf *) calloc(1, sizeof(struct buf)); if (bp == NULL) return (1); ch_nbufs++; bp->block = -1; bp->next = END_OF_CHAIN; bp->prev = ch_buftail; ch_buftail->next = bp; ch_buftail = bp; HASH_INS(bp, 0); return (0); } /* * */ static void init_hashtbl() { register int h; for (h = 0; h < BUFHASH_SIZE; h++) { thisfile->hashtbl[h].buf_hnext = END_OF_HCHAIN(h); thisfile->hashtbl[h].buf_hprev = END_OF_HCHAIN(h); } } /* * Delete all buffers for this file. */ static void ch_delbufs() { register struct buf *bp; while (ch_bufhead != END_OF_CHAIN) { bp = ch_bufhead; - bp->next->prev = bp->prev;; + bp->next->prev = bp->prev; bp->prev->next = bp->next; free(bp); } ch_nbufs = 0; init_hashtbl(); } /* * Is it possible to seek on a file descriptor? */ public int seekable(f) int f; { #if MSDOS_COMPILER extern int fd0; if (f == fd0 && !isatty(fd0)) { /* * In MS-DOS, pipes are seekable. Check for * standard input, and pretend it is not seekable. */ return (0); } #endif - return (lseek(f, (off_t)1, 0) != BAD_LSEEK); + return (lseek(f, (off_t)1, SEEK_SET) != BAD_LSEEK); } /* * Initialize file state for a new file. */ public void ch_init(f, flags) int f; int flags; { /* * See if we already have a filestate for this file. */ thisfile = (struct filestate *) get_filestate(curr_ifile); if (thisfile == NULL) { /* * Allocate and initialize a new filestate. */ thisfile = (struct filestate *) calloc(1, sizeof(struct filestate)); thisfile->buf_next = thisfile->buf_prev = END_OF_CHAIN; thisfile->nbufs = 0; thisfile->flags = 0; thisfile->fpos = 0; thisfile->block = 0; thisfile->offset = 0; thisfile->file = -1; thisfile->fsize = NULL_POSITION; ch_flags = flags; init_hashtbl(); /* * Try to seek; set CH_CANSEEK if it works. */ if ((flags & CH_CANSEEK) && !seekable(f)) ch_flags &= ~CH_CANSEEK; set_filestate(curr_ifile, (void *) thisfile); } if (thisfile->file == -1) thisfile->file = f; ch_flush(); } /* * Close a filestate. */ public void ch_close() { int keepstate = FALSE; if (thisfile == NULL) return; if (ch_flags & (CH_CANSEEK|CH_POPENED|CH_HELPFILE)) { /* * We can seek or re-open, so we don't need to keep buffers. */ ch_delbufs(); } else keepstate = TRUE; if (!(ch_flags & CH_KEEPOPEN)) { /* * We don't need to keep the file descriptor open * (because we can re-open it.) * But don't really close it if it was opened via popen(), * because pclose() wants to close it. */ if (!(ch_flags & (CH_POPENED|CH_HELPFILE))) close(ch_file); ch_file = -1; } else keepstate = TRUE; if (!keepstate) { /* * We don't even need to keep the filestate structure. */ free(thisfile); thisfile = NULL; set_filestate(curr_ifile, (void *) NULL); } } /* * Return ch_flags for the current file. */ public int ch_getflags() { if (thisfile == NULL) return (0); return (ch_flags); } #if 0 public void ch_dump(struct filestate *fs) { struct buf *bp; unsigned char *s; if (fs == NULL) { printf(" --no filestate\n"); return; } printf(" file %d, flags %x, fpos %x, fsize %x, blk/off %x/%x\n", fs->file, fs->flags, fs->fpos, fs->fsize, fs->block, fs->offset); printf(" %d bufs:\n", fs->nbufs); for (bp = fs->buf_next; bp != (struct buf *)fs; bp = bp->next) { printf("%x: blk %x, size %x \"", bp, bp->block, bp->datasize); for (s = bp->data; s < bp->data + 30; s++) if (*s >= ' ' && *s < 0x7F) printf("%c", *s); else printf("."); printf("\"\n"); } } #endif diff --git a/contrib/less/configure b/contrib/less/configure index 3dbc604ebfef..1d3f57aa4ff3 100755 --- a/contrib/less/configure +++ b/contrib/less/configure @@ -1,8295 +1,8523 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for less 1. # # 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 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+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # 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_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 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=. case $as_dir in /*) 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 test "x$as_lineno_1" != "x$as_lineno_2" && 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 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 # 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 :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } 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 && 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 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' 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$$.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 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="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="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" 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` # # 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} # Identity of this package. PACKAGE_NAME='less' PACKAGE_TARNAME='less' PACKAGE_VERSION='1' PACKAGE_STRING='less 1' PACKAGE_BUGREPORT='' ac_unique_file="forwback.c" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #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 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= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' 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 ac_prev= continue fi 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_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -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 && { 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 ;; -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 && { 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=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -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 ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -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) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -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 ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute 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=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) 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' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null 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 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 || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then 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; }; } fi 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; }; } 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. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures less 1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --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] --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 _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of less 1:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-largefile omit support for large files Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-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 Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries 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. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue 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 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 || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF less configure 1 generated by GNU Autoconf 2.61 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 fi 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.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /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` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_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: 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. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _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 $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" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do 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 ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do 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 if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo 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.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -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 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;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $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 case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_config_headers="$ac_config_headers defines.h" # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi 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. set dummy ${ac_tool_prefix}cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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 fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 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. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.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; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { 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; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.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; } 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 { 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; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CC" && break done 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 See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (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); } { (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); } { (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 /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { echo "$as_me:$LINENO: checking for C compiler default output 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[^ ]*//'` # # 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 # 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 | *.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 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext # 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; } # 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' { (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 cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check 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 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 # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext { echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (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 conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$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 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (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_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi 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; } GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { 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 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 () { ; 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 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 core conftest.err conftest.$ac_objext conftest.$ac_ext fi 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 if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { echo "$as_me:$LINENO: checking for $CC option to accept 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_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* 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);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF 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 { (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_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # 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; } ;; *) 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 ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking for library containing strerror" >&5 echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6; } if test "${ac_cv_search_strerror+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS 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 strerror (); int main () { return strerror (); ; return 0; } _ACEOF 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" 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); } && { 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 sed 's/^/| /' conftest.$ac_ext >&5 fi 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; } ac_res=$ac_cv_search_strerror if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # 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 /* confdefs.h. */ _ACEOF 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 && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _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 # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer 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 /* confdefs.h. */ _ACEOF 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 && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _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 # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking for 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 # 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 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; } 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 /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no fi rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi { echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5 echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6; } if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5 echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;} { (exit 1); exit 1; }; } fi # 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 # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # 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; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { 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. 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 value is a relative name. INSTALL=$ac_install_sh fi fi { echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Checks for compilation model. # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then enableval=$enable_largefile; fi if test "$enable_largefile" != no; then { echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5 echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6; } if test "${ac_cv_sys_largefile_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then ac_save_CC=$CC while :; do # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. cat >conftest.$ac_ext <<_ACEOF /* 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, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (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 break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi 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); } && { 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 sed 's/^/| /' conftest.$ac_ext >&5 fi 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; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi { echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5 echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6; } if test "${ac_cv_sys_file_offset_bits+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else while :; do 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, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (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_sys_file_offset_bits=no; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* 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. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (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_sys_file_offset_bits=64; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi 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; } 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 ;; esac rm -f conftest* 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 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, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (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_sys_large_files=no; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* 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. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (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_sys_large_files=1; break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi 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; } case $ac_cv_sys_large_files in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGE_FILES $ac_cv_sys_large_files _ACEOF ;; esac rm -f conftest* fi fi # Checks for general libraries. +{ 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 /* 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_xcurses_initscr=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_xcurses_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_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 -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 /* 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_ncurses_initscr=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_ncurses_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_ncurses_initscr" >&5 echo "${ECHO_T}$ac_cv_lib_ncurses_initscr" >&6; } if test $ac_cv_lib_ncurses_initscr = yes; then have_ncurses=yes else have_ncurses=no fi { echo "$as_me:$LINENO: checking for initscr in -lcurses" >&5 echo $ECHO_N "checking for initscr in -lcurses... $ECHO_C" >&6; } if test "${ac_cv_lib_curses_initscr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lcurses $LIBS" cat >conftest.$ac_ext <<_ACEOF /* 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_curses_initscr=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_curses_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_curses_initscr" >&5 echo "${ECHO_T}$ac_cv_lib_curses_initscr" >&6; } if test $ac_cv_lib_curses_initscr = yes; then have_curses=yes else have_curses=no fi { echo "$as_me:$LINENO: checking for tgetent in -ltermcap" >&5 echo $ECHO_N "checking for tgetent in -ltermcap... $ECHO_C" >&6; } if test "${ac_cv_lib_termcap_tgetent+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ltermcap $LIBS" cat >conftest.$ac_ext <<_ACEOF /* 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 tgetent (); int main () { return tgetent (); ; 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_termcap_tgetent=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_termcap_tgetent=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_termcap_tgetent" >&5 echo "${ECHO_T}$ac_cv_lib_termcap_tgetent" >&6; } if test $ac_cv_lib_termcap_tgetent = yes; then have_termcap=yes else have_termcap=no fi { echo "$as_me:$LINENO: checking for tgetent in -ltermlib" >&5 echo $ECHO_N "checking for tgetent in -ltermlib... $ECHO_C" >&6; } if test "${ac_cv_lib_termlib_tgetent+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ltermlib $LIBS" cat >conftest.$ac_ext <<_ACEOF /* 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 tgetent (); int main () { return tgetent (); ; 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_termlib_tgetent=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_termlib_tgetent=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_termlib_tgetent" >&5 echo "${ECHO_T}$ac_cv_lib_termlib_tgetent" >&6; } if test $ac_cv_lib_termlib_tgetent = yes; then have_termlib=yes else have_termlib=no fi # Regular expressions (regcmp) are in -lgen on Solaris 2, # and in -lintl on SCO Unix. { echo "$as_me:$LINENO: checking for regcmp in -lgen" >&5 echo $ECHO_N "checking for regcmp in -lgen... $ECHO_C" >&6; } if test "${ac_cv_lib_gen_regcmp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lgen $LIBS" cat >conftest.$ac_ext <<_ACEOF /* 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 regcmp (); int main () { return regcmp (); ; 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_gen_regcmp=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_gen_regcmp=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_gen_regcmp" >&5 echo "${ECHO_T}$ac_cv_lib_gen_regcmp" >&6; } if test $ac_cv_lib_gen_regcmp = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBGEN 1 _ACEOF LIBS="-lgen $LIBS" fi { echo "$as_me:$LINENO: checking for regcmp in -lintl" >&5 echo $ECHO_N "checking for regcmp in -lintl... $ECHO_C" >&6; } if test "${ac_cv_lib_intl_regcmp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* 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 regcmp (); int main () { return regcmp (); ; 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_intl_regcmp=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_intl_regcmp=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_intl_regcmp" >&5 echo "${ECHO_T}$ac_cv_lib_intl_regcmp" >&6; } if test $ac_cv_lib_intl_regcmp = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBINTL 1 _ACEOF LIBS="-lintl $LIBS" fi { echo "$as_me:$LINENO: checking for regcmp in -lPW" >&5 echo $ECHO_N "checking for regcmp in -lPW... $ECHO_C" >&6; } if test "${ac_cv_lib_PW_regcmp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lPW $LIBS" cat >conftest.$ac_ext <<_ACEOF /* 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 regcmp (); int main () { return regcmp (); ; 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_PW_regcmp=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_PW_regcmp=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_PW_regcmp" >&5 echo "${ECHO_T}$ac_cv_lib_PW_regcmp" >&6; } if test $ac_cv_lib_PW_regcmp = yes; then cat >>confdefs.h <<_ACEOF #define HAVE_LIBPW 1 _ACEOF LIBS="-lPW $LIBS" fi # Checks for terminal libraries { echo "$as_me:$LINENO: checking for working terminal libraries" >&5 echo $ECHO_N "checking for working terminal libraries... $ECHO_C" >&6; } TERMLIBS= # Check for systems where curses is broken. curses_broken=0 if test x`uname -s` = "xHP-UX" >/dev/null 2>&1; then if test x`uname -r` = "xB.11.00" >/dev/null 2>&1; then curses_broken=1 fi if test x`uname -r` = "xB.11.11" >/dev/null 2>&1; then curses_broken=1 fi fi if test $curses_broken = 0; then + +# -- Try tinfo. +if test "x$TERMLIBS" = x; then + if test $have_tinfo = yes; then + TERMLIBS="-ltinfo" + 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 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 fi # -- Try ncurses. if test "x$TERMLIBS" = x; then if test $have_ncurses = yes; then TERMLIBS="-lncurses" SAVE_LIBS=$LIBS LIBS="$LIBS $TERMLIBS" cat >conftest.$ac_ext <<_ACEOF /* 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 curses. if test "x$TERMLIBS" = x; then if test $have_curses = yes; then TERMLIBS="-lcurses" SAVE_LIBS=$LIBS LIBS="$LIBS $TERMLIBS" cat >conftest.$ac_ext <<_ACEOF /* 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 curses & termcap. if test "x$TERMLIBS" = x; then if test $have_curses = yes; then if test $have_termcap = yes; then TERMLIBS="-lcurses -ltermcap" 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 fi fi # -- Try termcap. if test "x$TERMLIBS" = x; then if test $have_termcap = yes; then TERMLIBS="-ltermcap" 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 termlib. if test "x$TERMLIBS" = x; then if test $have_termlib = yes; then TERMLIBS="-lcurses -ltermlib" 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 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; } exit 1 fi { 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; } if test "${ac_cv_header_stdc+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 #include #include 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_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f 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 /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* 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 TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f 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>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (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 : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { 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 /* 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 { (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 eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi 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 _ACEOF fi 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 + +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 { 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 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; } cat >conftest.$ac_ext <<_ACEOF /* 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 { (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_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi 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 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$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 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: 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:$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 { 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" fi 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 cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi 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; } if test "${ac_cv_header_stat_broken+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 #if defined S_ISBLK && defined S_IFDIR extern char c1[S_ISBLK (S_IFDIR) ? -1 : 1]; #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 extern char c3[S_ISLNK (S_IFREG) ? -1 : 1]; #endif #if defined S_ISSOCK && defined S_IFREG extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1]; #endif _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_header_stat_broken=no else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stat_broken=yes fi 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 #define STAT_MACROS_BROKEN 1 _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; } if test "${ac_cv_c_const+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. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* SunOS 4.1.1 cc rejects this. */ 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}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++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}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; 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_c_const=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi 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; } if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const _ACEOF fi { 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 /* 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 ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; 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_off_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_off_t=no fi 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; } if test $ac_cv_type_off_t = yes; then : else cat >>confdefs.h <<_ACEOF #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; } if test "${ac_cv_type_size_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. */ $ac_includes_default typedef size_t ac__type_new_; int main () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; 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_size_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_size_t=no fi 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; } if test $ac_cv_type_size_t = yes; then : else cat >>confdefs.h <<_ACEOF #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; } if test "${ac_cv_header_time+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 #include int main () { if ((struct tm *) 0) return 0; ; 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_header_time=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_time=no fi 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; } if test $ac_cv_header_time = yes; then cat >>confdefs.h <<\_ACEOF #define TIME_WITH_SYS_TIME 1 _ACEOF fi # Autoheader templates for symbols defined later by AC_DEFINE. + + + + # Checks for identifiers. { 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 /* 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 ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; 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_off_t=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_type_off_t=no fi 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; } if test $ac_cv_type_off_t = yes; then : else cat >>confdefs.h <<_ACEOF #define off_t long int _ACEOF fi { echo "$as_me:$LINENO: checking for void" >&5 echo $ECHO_N "checking for void... $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. */ int main () { void *foo = 0; ; 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 { 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 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.$ac_ext { echo "$as_me:$LINENO: checking for const" >&5 echo $ECHO_N "checking for const... $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. */ int main () { const int foo = 0; ; 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 { 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 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.$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 /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include int main () { time_t t = 0; ; 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 { 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 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.$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 +int +main () +{ +struct stat s; dev_t dev = s.st_dev; ino_t ino = s.st_ino; + ; + 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 + { 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 +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.$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 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 _ACEOF 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 { 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 /* 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. 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 char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; 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 eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi 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 _ACEOF fi done # 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 () { memcpy(0,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 { 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); } && { 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 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_tcgetattr=no fi 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; } if test $ac_cv_func_tcgetattr = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_TERMIOS_FUNCS 1 _ACEOF fi { echo "$as_me:$LINENO: checking for fileno" >&5 echo $ECHO_N "checking for fileno... $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_STDIO_H #include #endif int main () { static int x; x = fileno(stdin); ; 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_FILENO 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 strerror" >&5 echo $ECHO_N "checking for strerror... $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_STDIO_H #include #endif #if HAVE_STRING_H #include #endif #if HAVE_ERRNO_H #include #endif int main () { static char *x; x = strerror(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_STRERROR 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 sys_errlist" >&5 echo $ECHO_N "checking for sys_errlist... $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. */ int main () { extern char *sys_errlist[]; static char **x; x = sys_errlist; ; 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_SYS_ERRLIST 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 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 () { if ((ac__type_new_ *) 0) return 0; if (sizeof (ac__type_new_)) return 0; ; 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_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 fi { echo "$as_me:$LINENO: checking for sigemptyset" >&5 echo $ECHO_N "checking for sigemptyset... $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 () { sigset_t s; sigemptyset(&s); ; 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_SIGEMPTYSET 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 have_errno=no { echo "$as_me:$LINENO: checking for errno" >&5 echo $ECHO_N "checking for errno... $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_ERRNO_H #include #endif int main () { static int x; x = errno; ; 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 - 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 sed 's/^/| /' conftest.$ac_ext >&5 fi 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 /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #if HAVE_ERRNO_H #include #endif int main () { extern int errno; static int x; x = errno; ; 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 - must define" >&5 echo "${ECHO_T}yes - must define" >&6; }; cat >>confdefs.h <<\_ACEOF #define HAVE_ERRNO 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define MUST_DEFINE_ERRNO 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 fi { echo "$as_me:$LINENO: checking for locale" >&5 echo $ECHO_N "checking for locale... $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 #include int main () { setlocale(LC_CTYPE,""); isprint(0); iscntrl(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_LOCALE 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 ctype functions" >&5 echo $ECHO_N "checking for ctype 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. */ #if HAVE_CTYPE_H #include #endif int main () { static int x; x = isupper(x); x = tolower(x); x = toupper(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_UPPER_LOWER 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 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; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #if HAVE_TERMIOS_H #include #endif #if HAVE_TERMCAP_H #include #endif int main () { ospeed = 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 - 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 sed 's/^/| /' conftest.$ac_ext >&5 fi 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 /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { extern short ospeed; ospeed = 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 - must define" >&5 echo "${ECHO_T}yes - must define" >&6; }; cat >>confdefs.h <<\_ACEOF #define HAVE_OSPEED 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define MUST_DEFINE_OSPEED 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 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; } # Select a regular expression library. WANT_REGEX=auto # Check whether --with-regex was given. if test "${with_regex+set}" = set; then withval=$with_regex; WANT_REGEX="$withval" fi if test $have_regex = no; then if test $WANT_REGEX = auto -o $WANT_REGEX = posix; then # Some versions of Solaris have a regcomp() function, but it doesn't work! # So we run a test program. If we're cross-compiling, do it the old way. if test "$cross_compiling" = yes; then have_posix_regex=unknown 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 main() { regex_t r; regmatch_t rm; char *text = "xabcy"; if (regcomp(&r, "abc", 0)) exit(1); if (regexec(&r, text, 1, &rm, 0)) exit(1); #ifndef __WATCOMC__ if (rm.rm_so != 1) exit(1); /* check for correct offset */ #else if (rm.rm_sp != text + 1) exit(1); /* check for correct offset */ #endif exit(0); } _ACEOF rm -f 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>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (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 have_posix_regex=yes else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) have_posix_regex=no fi 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; } cat >>confdefs.h <<\_ACEOF #define HAVE_POSIX_REGCOMP 1 _ACEOF have_regex=yes elif test $have_posix_regex = unknown; then 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 () { regex_t *r; regfree(r); ; 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: 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 sed 's/^/| /' conftest.$ac_ext >&5 fi 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; } 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; } 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 /* 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 pcre_compile (); int main () { return pcre_compile (); ; 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_pcre_pcre_compile=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_pcre_pcre_compile=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_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 #define HAVE_PCRE 1 _ACEOF LIBS="$LIBS -lpcre" have_regex=yes fi fi 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; } if test "${ac_cv_func_regcmp+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 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. 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 char regcmp (); /* 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 () { return regcmp (); ; 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_regcmp=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_regcmp=no fi 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; } 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 #define HAVE_REGCMP 1 _ACEOF have_regex=yes fi fi fi if test $have_regex = no; then if test $WANT_REGEX = auto -o $WANT_REGEX = regcomp; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include "regexp.h" int main () { regcomp(""); ; 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: 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 sed 's/^/| /' conftest.$ac_ext >&5 fi 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 #define HAVE_V8_REGCOMP 1 _ACEOF cat >>confdefs.h <<\_ACEOF #define HAVE_REGEXEC2 1 _ACEOF REGEX_O='regexp.$(O)' have_regex=yes fi 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; } if test "${ac_cv_func_re_comp+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 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. 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 char re_comp (); /* 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 () { return re_comp (); ; 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_re_comp=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_func_re_comp=no fi 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; } if test $ac_cv_func_re_comp = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_RE_COMP 1 _ACEOF have_regex=yes fi 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 #define NO_REGEX 1 _ACEOF fi # Check whether --with-editor was given. if test "${with_editor+set}" = set; then withval=$with_editor; cat >>confdefs.h <<_ACEOF #define EDIT_PGM "$withval" _ACEOF else cat >>confdefs.h <<\_ACEOF #define EDIT_PGM "vi" _ACEOF fi ac_config_files="$ac_config_files Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, 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 $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" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end 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 "$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 test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' 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_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 LTLIBOBJS=$ac_ltlibobjs : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be 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+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # 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_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 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 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 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 # 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 :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } 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 && 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 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' 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$$.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 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="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="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # 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. ac_log=" This file was extended by less $as_me 1, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number 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 --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ less config.status 1 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" 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." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) 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 CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; --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: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 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 "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 # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers fi # 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 || { 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. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # 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 _ACEOF 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 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 ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done 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 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_build_prefix$INSTALL ;; esac _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 _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b 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 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;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; :H) # # CONFIG_HEADER # _ACEOF # 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=' ,' 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. # (The regexp can be short, since the line contains either #define or #undef.) echo 's/ $// s,^[ #]*u.*,/* & */,' >>conftest.defines # 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 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"' "$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 conftest.tail echo "ac_result=$ac_in" >>$CONFIG_STATUS cat >>$CONFIG_STATUS <<\_ACEOF if test x"$ac_file" != x-; 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 rm -f $ac_file mv "$tmp/config.h" $ac_file fi else echo "/* $configure_input */" cat "$ac_result" fi rm -f "$tmp/out12" ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi diff --git a/contrib/less/configure.ac b/contrib/less/configure.ac index d738607ee30c..72d340729174 100644 --- a/contrib/less/configure.ac +++ b/contrib/less/configure.ac @@ -1,623 +1,652 @@ # Process this file with autoconf to produce a configure script. # 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. # # For more information about less, or for information on how to # contact the author, see the README file. # Autoconf initialization. AC_INIT(less, 1) AC_CONFIG_SRCDIR([forwback.c]) AC_CONFIG_HEADER([defines.h]) # Checks for programs. AC_PROG_CC AC_ISC_POSIX AC_PROG_GCC_TRADITIONAL AC_PROG_INSTALL # Checks for compilation model. 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]) AC_CHECK_LIB(termlib, tgetent, [have_termlib=yes], [have_termlib=no]) # Regular expressions (regcmp) are in -lgen on Solaris 2, # and in -lintl on SCO Unix. AC_CHECK_LIB(gen, regcmp) AC_CHECK_LIB(intl, regcmp) AC_CHECK_LIB(PW, regcmp) # Checks for terminal libraries AC_MSG_CHECKING([for working terminal libraries]) TERMLIBS= # Check for systems where curses is broken. curses_broken=0 if test x`uname -s` = "xHP-UX" >/dev/null 2>&1; then if test x`uname -r` = "xB.11.00" >/dev/null 2>&1; then curses_broken=1 fi if test x`uname -r` = "xB.11.11" >/dev/null 2>&1; then curses_broken=1 fi fi if test $curses_broken = 0; then + +# -- Try 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 TERMLIBS="-lxcurses" 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 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 TERMLIBS="-lncurses" 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 curses. if test "x$TERMLIBS" = x; then if test $have_curses = yes; then TERMLIBS="-lcurses" 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 curses & termcap. if test "x$TERMLIBS" = x; then if test $have_curses = yes; then if test $have_termcap = yes; then TERMLIBS="-lcurses -ltermcap" 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 fi fi # -- Try termcap. if test "x$TERMLIBS" = x; then if test $have_termcap = yes; then TERMLIBS="-ltermcap" 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 termlib. if test "x$TERMLIBS" = x; then if test $have_termlib = yes; then TERMLIBS="-lcurses -ltermlib" 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 if test "x$TERMLIBS" = x; then AC_MSG_RESULT(Cannot find terminal libraries - configure failed) exit 1 fi AC_MSG_RESULT(using $TERMLIBS) 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]) +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 AC_C_CONST AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_HEADER_TIME # Autoheader templates for symbols defined later by AC_DEFINE. AH_TEMPLATE([HAVE_POSIX_REGCOMP], [POSIX regcomp() and regex.h]) AH_TEMPLATE([HAVE_PCRE], [PCRE (Perl-compatible regular expression) library]) AH_TEMPLATE([HAVE_RE_COMP], [BSD re_comp()]) AH_TEMPLATE([HAVE_REGCMP], [System V regcmp()]) AH_TEMPLATE([HAVE_V8_REGCOMP], [Henry Spencer V8 regcomp() and regexp.h]) AH_TEMPLATE([NO_REGEX], [pattern matching is supported, but without metacharacters.]) AH_TEMPLATE([HAVE_REGEXEC2], []) 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], [Define HAVE_STRERROR if you have the strerror() function.]) AH_TEMPLATE([HAVE_FILENO], [Define HAVE_FILENO if you have the fileno() macro.]) AH_TEMPLATE([HAVE_ERRNO], [Define HAVE_ERRNO if you have the errno variable.]) AH_TEMPLATE([MUST_DEFINE_ERRNO], [Define MUST_DEFINE_ERRNO if you have errno but it is not define in errno.h.]) AH_TEMPLATE([HAVE_SYS_ERRLIST], [Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable.]) AH_TEMPLATE([HAVE_OSPEED], [Define HAVE_OSPEED if your termcap library has the ospeed variable.]) AH_TEMPLATE([MUST_DEFINE_OSPEED], [Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined in termcap.h.]) AH_TEMPLATE([HAVE_LOCALE], [Define HAVE_LOCALE if you have locale.h and setlocale.]) 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 AC_MSG_CHECKING(for void) AC_TRY_COMPILE(, [void *foo = 0;], [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_VOID)], [AC_MSG_RESULT(no)]) AC_MSG_CHECKING(for const) AC_TRY_COMPILE(, [const int foo = 0;], [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_CONST)], [AC_MSG_RESULT(no)]) 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 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)) AC_MSG_CHECKING(for fileno) AC_TRY_LINK([ #if HAVE_STDIO_H #include #endif], [static int x; x = fileno(stdin);], [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FILENO)], [AC_MSG_RESULT(no)]) AC_MSG_CHECKING(for strerror) AC_TRY_LINK([ #if HAVE_STDIO_H #include #endif #if HAVE_STRING_H #include #endif #if HAVE_ERRNO_H #include #endif], [static char *x; x = strerror(0);], [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRERROR)], [AC_MSG_RESULT(no)]) 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_CHECK_TYPES([sigset_t],,,[#include ]) AC_MSG_CHECKING(for sigemptyset) AC_TRY_LINK([ #include ], [sigset_t s; sigemptyset(&s);], [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SIGEMPTYSET)], [AC_MSG_RESULT(no)]) have_errno=no AC_MSG_CHECKING(for errno) AC_TRY_LINK([ #if HAVE_ERRNO_H #include #endif], [static int x; x = errno;], [AC_MSG_RESULT(yes - in errno.h); AC_DEFINE(HAVE_ERRNO) have_errno=yes]) if test $have_errno = no; then AC_TRY_LINK([ #if HAVE_ERRNO_H #include #endif], [extern int errno; static int x; x = errno;], [AC_MSG_RESULT(yes - must define); AC_DEFINE(HAVE_ERRNO) AC_DEFINE(MUST_DEFINE_ERRNO)], [AC_MSG_RESULT(no)]) fi AC_MSG_CHECKING(for locale) AC_TRY_LINK([#include #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 #include #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) AC_TRY_LINK([ #include #if HAVE_TERMIOS_H #include #endif #if HAVE_TERMCAP_H #include #endif], [ospeed = 0;], [AC_MSG_RESULT(yes - in termcap.h); AC_DEFINE(HAVE_OSPEED) have_ospeed=yes]) if test $have_ospeed = no; then AC_TRY_LINK(, [extern short ospeed; ospeed = 0;], [AC_MSG_RESULT(yes - must define); AC_DEFINE(HAVE_OSPEED) AC_DEFINE(MUST_DEFINE_OSPEED)], [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]], WANT_REGEX="$withval") if test $have_regex = no; then if test $WANT_REGEX = auto -o $WANT_REGEX = posix; then # Some versions of Solaris have a regcomp() function, but it doesn't work! # So we run a test program. If we're cross-compiling, do it the old way. AC_TRY_RUN([ #include #include main() { regex_t r; regmatch_t rm; char *text = "xabcy"; if (regcomp(&r, "abc", 0)) exit(1); if (regexec(&r, text, 1, &rm, 0)) exit(1); #ifndef __WATCOMC__ if (rm.rm_so != 1) exit(1); /* check for correct offset */ #else if (rm.rm_sp != text + 1) exit(1); /* check for correct offset */ #endif exit(0); }], have_posix_regex=yes, have_posix_regex=no, have_posix_regex=unknown) if test $have_posix_regex = yes; then AC_MSG_RESULT(using POSIX regcomp) AC_DEFINE(HAVE_POSIX_REGCOMP) have_regex=yes elif test $have_posix_regex = unknown; then AC_TRY_LINK([ #include #include ], [regex_t *r; regfree(r);], AC_MSG_RESULT(using POSIX regcomp) AC_DEFINE(HAVE_POSIX_REGCOMP) have_regex=yes) else AC_MSG_RESULT(no) fi fi fi if test $have_regex = no; then if test $WANT_REGEX = auto -o $WANT_REGEX = pcre; then AC_CHECK_LIB(pcre, pcre_compile, [AC_MSG_RESULT(using pcre); AC_DEFINE(HAVE_PCRE) LIBS="$LIBS -lpcre" have_regex=yes], []) fi fi if test $have_regex = no; then if test $WANT_REGEX = auto -o $WANT_REGEX = regcmp; then AC_CHECK_FUNC(regcmp, AC_MSG_RESULT(using regcmp); AC_DEFINE(HAVE_REGCMP) have_regex=yes) fi fi if test $have_regex = no; then if test $WANT_REGEX = auto -o $WANT_REGEX = regcomp; then AC_TRY_LINK([ #include "regexp.h"], [regcomp("");], AC_MSG_RESULT(using V8 regcomp); AC_DEFINE(HAVE_V8_REGCOMP) have_regex=yes) fi fi if test $have_regex = no && test -f ${srcdir}/regexp.c; then if test $WANT_REGEX = auto -o $WANT_REGEX = regcomp-local; then AC_MSG_RESULT(using V8 regcomp -- local source); AC_DEFINE(HAVE_V8_REGCOMP) AC_DEFINE(HAVE_REGEXEC2) REGEX_O='regexp.$(O)' AC_SUBST(REGEX_O) have_regex=yes fi fi if test $have_regex = no; then if test $WANT_REGEX = auto -o $WANT_REGEX = re_comp; then AC_MSG_RESULT(using re_comp); AC_CHECK_FUNC(re_comp, AC_DEFINE(HAVE_RE_COMP) have_regex=yes) fi fi if test $have_regex = no; then AC_MSG_RESULT(cannot find regular expression library); AC_DEFINE(NO_REGEX) fi AC_ARG_WITH(editor, [ --with-editor=PROGRAM use PROGRAM as the default editor [vi]], AC_DEFINE_UNQUOTED(EDIT_PGM, "$withval"), AC_DEFINE(EDIT_PGM, "vi")) AH_TOP([ /* Unix definition file for less. -*- C -*- * * This file has 3 sections: * User preferences. * Settings always true on Unix. * Settings automatically determined by configure. * * * * * * * WARNING * * * * * * * If you edit defines.h by hand, do "touch stamp-h" before you run make * so config.status doesn't overwrite your changes. */ /* User preferences. */ /* * 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 SECURE_COMPILE /* * SHELL_ESCAPE is 1 if you wish to allow shell escapes. * (This is possible only if your system supplies the system() function.) */ #define SHELL_ESCAPE (!SECURE) /* * EXAMINE is 1 if you wish to allow examining files by name from within less. */ #define EXAMINE (!SECURE) /* * TAB_COMPLETE_FILENAME is 1 if you wish to allow the TAB key * to complete filenames at prompts. */ #define TAB_COMPLETE_FILENAME (!SECURE) /* * CMD_HISTORY is 1 if you wish to allow keys to cycle through * previous commands at prompts. */ #define CMD_HISTORY 1 /* * HILITE_SEARCH is 1 if you wish to have search targets to be * displayed in standout mode. */ #define HILITE_SEARCH 1 /* * EDITOR is 1 if you wish to allow editor invocation (the "v" command). * (This is possible only if your system supplies the system() function.) * EDIT_PGM is the name of the (default) editor to be invoked. */ #define EDITOR (!SECURE) /* * TAGS is 1 if you wish to support tag files. */ #define TAGS (!SECURE) /* * USERFILE is 1 if you wish to allow a .less file to specify * user-defined key bindings. */ #define USERFILE (!SECURE) /* * GLOB is 1 if you wish to have shell metacharacters expanded in filenames. * This will generally work if your system provides the "popen" function * and the "echo" shell command. */ #define GLOB (!SECURE) /* * PIPEC is 1 if you wish to have the "|" command * which allows the user to pipe data into a shell command. */ #define PIPEC (!SECURE) /* * LOGFILE is 1 if you wish to allow the -l option (to create log files). */ #define LOGFILE (!SECURE) /* * GNU_OPTIONS is 1 if you wish to support the GNU-style command * line options --help and --version. */ #define GNU_OPTIONS 1 /* * ONLY_RETURN is 1 if you want RETURN to be the only input which * will continue past an error message. * Otherwise, any key will continue past an error message. */ #define ONLY_RETURN 0 /* * 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 * (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. */ /* * Define MSDOS_COMPILER if compiling under Microsoft C. */ #define MSDOS_COMPILER 0 /* * Pathname separator character. */ #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 . */ #define HAVE_SYS_TYPES_H 1 /* * Define if you have the header file. */ #undef HAVE_SGSTAT_H /* * HAVE_PERROR is 1 if your system has the perror() call. * (Actually, if it has sys_errlist, sys_nerr and errno.) */ #define HAVE_PERROR 1 /* * HAVE_TIME is 1 if your system has the time() call. */ #define HAVE_TIME 1 /* * HAVE_SHELL is 1 if your system supports a SHELL command interpreter. */ #define HAVE_SHELL 1 /* * Default shell metacharacters and meta-escape character. */ #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. */ #define CMDBUF_SIZE 512 /* Buffer for multichar commands */ #define UNGOT_SIZE 100 /* Max chars to unget() */ #define LINEBUF_SIZE 1024 /* Max size of line in input file */ #define OUTBUF_SIZE 1024 /* Output buffer */ #define PROMPT_SIZE 200 /* Max size of prompt string */ #define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */ #define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */ #define TAGLINE_SIZE 512 /* Max size of line in tags file */ #define TABSTOP_MAX 32 /* Max number of custom tab stops */ /* Settings automatically determined by configure. */ ]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT diff --git a/contrib/less/decode.c b/contrib/less/decode.c index 3007473ec91c..ac1668fa5a86 100644 --- a/contrib/less/decode.c +++ b/contrib/less/decode.c @@ -1,839 +1,839 @@ /* * 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. * * For more information about less, or for information on how to * contact the author, see the README file. */ /* * Routines to decode user commands. * * This is all table driven. * A command table is a sequence of command descriptors. * Each command descriptor is a sequence of bytes with the following format: * ...<0> * The characters c1,c2,...,cN are the command string; that is, * the characters which the user must type. * It is terminated by a null <0> byte. * The byte after the null byte is the action code associated * with the command string. * If an action byte is OR-ed with A_EXTRA, this indicates * that the option byte is followed by an extra string. * * There may be many command tables. * The first (default) table is built-in. * Other tables are read in from "lesskey" files. * All the tables are linked together and are searched in order. */ #include "less.h" #include "cmd.h" #include "lesskey.h" extern int erase_char, erase2_char, kill_char; extern int secure; #define SK(k) \ SK_SPECIAL_KEY, (k), 6, 1, 1, 1 /* * Command table is ordered roughly according to expected * frequency of use, so the common commands are near the beginning. */ static unsigned char cmdtable[] = { '\r',0, A_F_LINE, '\n',0, A_F_LINE, 'e',0, A_F_LINE, 'j',0, A_F_LINE, SK(SK_DOWN_ARROW),0, A_F_LINE, CONTROL('E'),0, A_F_LINE, CONTROL('N'),0, A_F_LINE, 'k',0, A_B_LINE, 'y',0, A_B_LINE, CONTROL('Y'),0, A_B_LINE, SK(SK_CONTROL_K),0, A_B_LINE, CONTROL('P'),0, A_B_LINE, SK(SK_UP_ARROW),0, A_B_LINE, 'J',0, A_FF_LINE, 'K',0, A_BF_LINE, 'Y',0, A_BF_LINE, 'd',0, A_F_SCROLL, CONTROL('D'),0, A_F_SCROLL, 'u',0, A_B_SCROLL, CONTROL('U'),0, A_B_SCROLL, ' ',0, A_F_SCREEN, 'f',0, A_F_SCREEN, CONTROL('F'),0, A_F_SCREEN, CONTROL('V'),0, A_F_SCREEN, SK(SK_PAGE_DOWN),0, A_F_SCREEN, 'b',0, A_B_SCREEN, CONTROL('B'),0, A_B_SCREEN, ESC,'v',0, A_B_SCREEN, SK(SK_PAGE_UP),0, A_B_SCREEN, 'z',0, A_F_WINDOW, 'w',0, A_B_WINDOW, ESC,' ',0, A_FF_SCREEN, 'F',0, A_F_FOREVER, 'R',0, A_FREPAINT, 'r',0, A_REPAINT, CONTROL('R'),0, A_REPAINT, CONTROL('L'),0, A_REPAINT, ESC,'u',0, A_UNDO_SEARCH, 'g',0, A_GOLINE, SK(SK_HOME),0, A_GOLINE, '<',0, A_GOLINE, ESC,'<',0, A_GOLINE, 'p',0, A_PERCENT, '%',0, A_PERCENT, ESC,'[',0, A_LSHIFT, ESC,']',0, A_RSHIFT, ESC,'(',0, A_LSHIFT, ESC,')',0, A_RSHIFT, SK(SK_RIGHT_ARROW),0, A_RSHIFT, SK(SK_LEFT_ARROW),0, A_LSHIFT, '{',0, A_F_BRACKET|A_EXTRA, '{','}',0, '}',0, A_B_BRACKET|A_EXTRA, '{','}',0, '(',0, A_F_BRACKET|A_EXTRA, '(',')',0, ')',0, A_B_BRACKET|A_EXTRA, '(',')',0, '[',0, A_F_BRACKET|A_EXTRA, '[',']',0, ']',0, A_B_BRACKET|A_EXTRA, '[',']',0, ESC,CONTROL('F'),0, A_F_BRACKET, ESC,CONTROL('B'),0, A_B_BRACKET, 'G',0, A_GOEND, ESC,'>',0, A_GOEND, '>',0, A_GOEND, SK(SK_END),0, A_GOEND, 'P',0, A_GOPOS, '0',0, A_DIGIT, '1',0, A_DIGIT, '2',0, A_DIGIT, '3',0, A_DIGIT, '4',0, A_DIGIT, '5',0, A_DIGIT, '6',0, A_DIGIT, '7',0, A_DIGIT, '8',0, A_DIGIT, '9',0, A_DIGIT, '.',0, A_DIGIT, '=',0, A_STAT, CONTROL('G'),0, A_STAT, ':','f',0, A_STAT, '/',0, A_F_SEARCH, '?',0, A_B_SEARCH, ESC,'/',0, A_F_SEARCH|A_EXTRA, '*',0, ESC,'?',0, A_B_SEARCH|A_EXTRA, '*',0, 'n',0, A_AGAIN_SEARCH, ESC,'n',0, A_T_AGAIN_SEARCH, 'N',0, A_REVERSE_SEARCH, ESC,'N',0, A_T_REVERSE_SEARCH, 'm',0, A_SETMARK, '\'',0, A_GOMARK, CONTROL('X'),CONTROL('X'),0, A_GOMARK, 'E',0, A_EXAMINE, ':','e',0, A_EXAMINE, CONTROL('X'),CONTROL('V'),0, A_EXAMINE, ':','n',0, A_NEXT_FILE, ':','p',0, A_PREV_FILE, 't',0, A_NEXT_TAG, 'T',0, A_PREV_TAG, ':','x',0, A_INDEX_FILE, ':','d',0, A_REMOVE_FILE, '-',0, A_OPT_TOGGLE, ':','t',0, A_OPT_TOGGLE|A_EXTRA, 't',0, 's',0, A_OPT_TOGGLE|A_EXTRA, 'o',0, '_',0, A_DISP_OPTION, '|',0, A_PIPE, 'v',0, A_VISUAL, '!',0, A_SHELL, '+',0, A_FIRSTCMD, 'H',0, A_HELP, 'h',0, A_HELP, SK(SK_F1),0, A_HELP, 'V',0, A_VERSION, 'q',0, A_QUIT, 'Q',0, A_QUIT, ':','q',0, A_QUIT, ':','Q',0, A_QUIT, 'Z','Z',0, A_QUIT }; static unsigned char edittable[] = { '\t',0, EC_F_COMPLETE, /* TAB */ '\17',0, EC_B_COMPLETE, /* BACKTAB */ SK(SK_BACKTAB),0, EC_B_COMPLETE, /* BACKTAB */ ESC,'\t',0, EC_B_COMPLETE, /* ESC TAB */ CONTROL('L'),0, EC_EXPAND, /* CTRL-L */ CONTROL('V'),0, EC_LITERAL, /* BACKSLASH */ CONTROL('A'),0, EC_LITERAL, /* BACKSLASH */ ESC,'l',0, EC_RIGHT, /* ESC l */ SK(SK_RIGHT_ARROW),0, EC_RIGHT, /* RIGHTARROW */ ESC,'h',0, EC_LEFT, /* ESC h */ SK(SK_LEFT_ARROW),0, EC_LEFT, /* LEFTARROW */ ESC,'b',0, EC_W_LEFT, /* ESC b */ ESC,SK(SK_LEFT_ARROW),0, EC_W_LEFT, /* ESC LEFTARROW */ SK(SK_CTL_LEFT_ARROW),0, EC_W_LEFT, /* CTRL-LEFTARROW */ ESC,'w',0, EC_W_RIGHT, /* ESC w */ ESC,SK(SK_RIGHT_ARROW),0, EC_W_RIGHT, /* ESC RIGHTARROW */ SK(SK_CTL_RIGHT_ARROW),0, EC_W_RIGHT, /* CTRL-RIGHTARROW */ ESC,'i',0, EC_INSERT, /* ESC i */ SK(SK_INSERT),0, EC_INSERT, /* INSERT */ ESC,'x',0, EC_DELETE, /* ESC x */ SK(SK_DELETE),0, EC_DELETE, /* DELETE */ ESC,'X',0, EC_W_DELETE, /* ESC X */ ESC,SK(SK_DELETE),0, EC_W_DELETE, /* ESC DELETE */ SK(SK_CTL_DELETE),0, EC_W_DELETE, /* CTRL-DELETE */ SK(SK_CTL_BACKSPACE),0, EC_W_BACKSPACE, /* CTRL-BACKSPACE */ ESC,'\b',0, EC_W_BACKSPACE, /* ESC BACKSPACE */ ESC,'0',0, EC_HOME, /* ESC 0 */ SK(SK_HOME),0, EC_HOME, /* HOME */ ESC,'$',0, EC_END, /* ESC $ */ SK(SK_END),0, EC_END, /* END */ ESC,'k',0, EC_UP, /* ESC k */ SK(SK_UP_ARROW),0, EC_UP, /* UPARROW */ ESC,'j',0, EC_DOWN, /* ESC j */ SK(SK_DOWN_ARROW),0, EC_DOWN, /* DOWNARROW */ }; /* * Structure to support a list of command tables. */ struct tablelist { struct tablelist *t_next; char *t_start; char *t_end; }; /* * List of command tables and list of line-edit tables. */ static struct tablelist *list_fcmd_tables = NULL; static struct tablelist *list_ecmd_tables = NULL; static struct tablelist *list_var_tables = NULL; static struct tablelist *list_sysvar_tables = NULL; /* * Expand special key abbreviations in a command table. */ static void expand_special_keys(table, len) char *table; int len; { register char *fm; register char *to; register int a; char *repl; int klen; for (fm = table; fm < table + len; ) { /* * Rewrite each command in the table with any * special key abbreviations expanded. */ for (to = fm; *fm != '\0'; ) { if (*fm != SK_SPECIAL_KEY) { *to++ = *fm++; continue; } /* * After SK_SPECIAL_KEY, next byte is the type * of special key (one of the SK_* contants), * and the byte after that is the number of bytes, * N, reserved by the abbreviation (including the * SK_SPECIAL_KEY and key type bytes). * Replace all N bytes with the actual bytes * output by the special key on this terminal. */ repl = special_key_str(fm[1]); klen = fm[2] & 0377; fm += klen; if (repl == NULL || (int) strlen(repl) > klen) repl = "\377"; while (*repl != '\0') *to++ = *repl++; } *to++ = '\0'; /* * Fill any unused bytes between end of command and * the action byte with A_SKIP. */ while (to <= fm) *to++ = A_SKIP; fm++; a = *fm++ & 0377; if (a & A_EXTRA) { while (*fm++ != '\0') continue; } } } /* * Initialize the command lists. */ public void init_cmds() { /* * Add the default command tables. */ add_fcmd_table((char*)cmdtable, sizeof(cmdtable)); add_ecmd_table((char*)edittable, sizeof(edittable)); #if USERFILE /* * For backwards compatibility, * try to add tables in the OLD system lesskey file. */ #ifdef BINDIR add_hometable(NULL, BINDIR "/.sysless", 1); #endif /* * Try to add the tables in the system lesskey file. */ add_hometable("LESSKEY_SYSTEM", LESSKEYFILE_SYS, 1); /* * Try to add the tables in the standard lesskey file "$HOME/.less". */ add_hometable("LESSKEY", LESSKEYFILE, 0); #endif } /* * Add a command table. */ static int add_cmd_table(tlist, buf, len) struct tablelist **tlist; char *buf; int len; { register struct tablelist *t; if (len == 0) return (0); /* * Allocate a tablelist structure, initialize it, * and link it into the list of tables. */ if ((t = (struct tablelist *) calloc(1, sizeof(struct tablelist))) == NULL) { return (-1); } expand_special_keys(buf, len); t->t_start = buf; t->t_end = buf + len; t->t_next = *tlist; *tlist = t; return (0); } /* * Add a command table. */ public void add_fcmd_table(buf, len) char *buf; int len; { if (add_cmd_table(&list_fcmd_tables, buf, len) < 0) error("Warning: some commands disabled", NULL_PARG); } /* * Add an editing command table. */ public void add_ecmd_table(buf, len) char *buf; int len; { if (add_cmd_table(&list_ecmd_tables, buf, len) < 0) error("Warning: some edit commands disabled", NULL_PARG); } /* * Add an environment variable table. */ static void add_var_table(tlist, buf, len) struct tablelist **tlist; char *buf; int len; { if (add_cmd_table(tlist, buf, len) < 0) error("Warning: environment variables from lesskey file unavailable", NULL_PARG); } /* * Search a single command table for the command string in cmd. */ static int cmd_search(cmd, table, endtable, sp) char *cmd; char *table; char *endtable; char **sp; { register char *p; register char *q; register int a; *sp = NULL; for (p = table, q = cmd; p < endtable; p++, q++) { if (*p == *q) { /* * Current characters match. * If we're at the end of the string, we've found it. * Return the action code, which is the character * after the null at the end of the string * in the command table. */ if (*p == '\0') { a = *++p & 0377; while (a == A_SKIP) a = *++p & 0377; if (a == A_END_LIST) { /* * We get here only if the original * cmd string passed in was empty (""). * I don't think that can happen, * but just in case ... */ return (A_UINVALID); } /* * Check for an "extra" string. */ if (a & A_EXTRA) { *sp = ++p; a &= ~A_EXTRA; } return (a); } } else if (*q == '\0') { /* * Hit the end of the user's command, * but not the end of the string in the command table. * The user's command is incomplete. */ return (A_PREFIX); } else { /* * Not a match. * Skip ahead to the next command in the * command table, and reset the pointer * to the beginning of the user's command. */ if (*p == '\0' && p[1] == A_END_LIST) { /* * A_END_LIST is a special marker that tells * us to abort the cmd search. */ return (A_UINVALID); } while (*p++ != '\0') continue; while (*p == A_SKIP) p++; if (*p & A_EXTRA) while (*++p != '\0') continue; q = cmd-1; } } /* * No match found in the entire command table. */ return (A_INVALID); } /* * Decode a command character and return the associated action. * The "extra" string, if any, is returned in sp. */ static int cmd_decode(tlist, cmd, sp) struct tablelist *tlist; char *cmd; char **sp; { register struct tablelist *t; register int action = A_INVALID; /* * Search thru all the command tables. * Stop when we find an action which is not A_INVALID. */ for (t = tlist; t != NULL; t = t->t_next) { action = cmd_search(cmd, t->t_start, t->t_end, sp); if (action != A_INVALID) break; } if (action == A_UINVALID) action = A_INVALID; return (action); } /* * Decode a command from the cmdtables list. */ public int fcmd_decode(cmd, sp) char *cmd; char **sp; { return (cmd_decode(list_fcmd_tables, cmd, sp)); } /* * Decode a command from the edittables list. */ public int ecmd_decode(cmd, sp) char *cmd; char **sp; { return (cmd_decode(list_ecmd_tables, cmd, sp)); } /* * Get the value of an environment variable. * Looks first in the lesskey file, then in the real environment. */ public char * lgetenv(var) char *var; { int a; char *s; a = cmd_decode(list_var_tables, var, &s); if (a == EV_OK) return (s); s = getenv(var); if (s != NULL && *s != '\0') return (s); a = cmd_decode(list_sysvar_tables, var, &s); if (a == EV_OK) return (s); return (NULL); } #if USERFILE /* * Get an "integer" from a lesskey file. * Integers are stored in a funny format: * two bytes, low order first, in radix KRADIX. */ static int gint(sp) char **sp; { int n; n = *(*sp)++; n += *(*sp)++ * KRADIX; return (n); } /* * Process an old (pre-v241) lesskey file. */ static int old_lesskey(buf, len) char *buf; int len; { /* * Old-style lesskey file. * The file must end with either * ...,cmd,0,action * or ...,cmd,0,action|A_EXTRA,string,0 * So the last byte or the second to last byte must be zero. */ if (buf[len-1] != '\0' && buf[len-2] != '\0') return (-1); add_fcmd_table(buf, len); return (0); } /* * Process a new (post-v241) lesskey file. */ static int new_lesskey(buf, len, sysvar) char *buf; int len; int sysvar; { char *p; register int c; register int n; /* * New-style lesskey file. * Extract the pieces. */ if (buf[len-3] != C0_END_LESSKEY_MAGIC || buf[len-2] != C1_END_LESSKEY_MAGIC || buf[len-1] != C2_END_LESSKEY_MAGIC) return (-1); p = buf + 4; for (;;) { c = *p++; switch (c) { case CMD_SECTION: n = gint(&p); add_fcmd_table(p, n); p += n; break; case EDIT_SECTION: n = gint(&p); add_ecmd_table(p, n); p += n; break; case VAR_SECTION: n = gint(&p); add_var_table((sysvar) ? &list_sysvar_tables : &list_var_tables, p, n); p += n; break; case END_SECTION: return (0); default: /* * Unrecognized section type. */ return (-1); } } } /* * Set up a user command table, based on a "lesskey" file. */ public int lesskey(filename, sysvar) char *filename; int sysvar; { register char *buf; register POSITION len; register long n; register int f; if (secure) return (1); /* * Try to open the lesskey file. */ filename = shell_unquote(filename); f = open(filename, OPEN_READ); free(filename); if (f < 0) return (1); /* * Read the file into a buffer. * We first figure out the size of the file and allocate space for it. * {{ Minimal error checking is done here. * A garbage .less file will produce strange results. * To avoid a large amount of error checking code here, we * rely on the lesskey program to generate a good .less file. }} */ len = filesize(f); if (len == NULL_POSITION || len < 3) { /* * Bad file (valid file must have at least 3 chars). */ close(f); return (-1); } if ((buf = (char *) calloc((int)len, sizeof(char))) == NULL) { 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); return (-1); } n = read(f, buf, (unsigned int) len); close(f); if (n != len) { free(buf); return (-1); } /* * Figure out if this is an old-style (before version 241) * or new-style lesskey file format. */ if (buf[0] != C0_LESSKEY_MAGIC || buf[1] != C1_LESSKEY_MAGIC || buf[2] != C2_LESSKEY_MAGIC || buf[3] != C3_LESSKEY_MAGIC) return (old_lesskey(buf, (int)len)); return (new_lesskey(buf, (int)len, sysvar)); } /* * Add the standard lesskey file "$HOME/.less" */ public void add_hometable(envname, def_filename, sysvar) char *envname; char *def_filename; int sysvar; { char *filename; PARG parg; if (envname != NULL && (filename = lgetenv(envname)) != NULL) filename = save(filename); else if (sysvar) filename = save(def_filename); else filename = homefile(def_filename); if (filename == NULL) return; if (lesskey(filename, sysvar) < 0) { parg.p_string = filename; error("Cannot use lesskey file \"%s\"", &parg); } free(filename); } #endif /* * See if a char is a special line-editing command. */ public int editchar(c, flags) int c; int flags; { int action; int nch; char *s; char usercmd[MAX_CMDLEN+1]; /* * An editing character could actually be a sequence of characters; * for example, an escape sequence sent by pressing the uparrow key. * To match the editing string, we use the command decoder * but give it the edit-commands command table * This table is constructed to match the user's keyboard. */ if (c == erase_char || c == erase2_char) return (EC_BACKSPACE); if (c == kill_char) return (EC_LINEKILL); /* * Collect characters in a buffer. * Start with the one we have, and get more if we need them. */ nch = 0; do { if (nch > 0) c = getcc(); usercmd[nch] = c; usercmd[nch+1] = '\0'; nch++; action = ecmd_decode(usercmd, &s); } while (action == A_PREFIX); if (flags & EC_NORIGHTLEFT) { switch (action) { case EC_RIGHT: case EC_LEFT: action = A_INVALID; break; } } #if CMD_HISTORY if (flags & EC_NOHISTORY) { /* * The caller says there is no history list. * Reject any history-manipulation action. */ switch (action) { case EC_UP: case EC_DOWN: action = A_INVALID; break; } } #endif #if TAB_COMPLETE_FILENAME if (flags & EC_NOCOMPLETE) { /* * The caller says we don't want any filename completion cmds. * Reject them. */ switch (action) { case EC_F_COMPLETE: case EC_B_COMPLETE: case EC_EXPAND: action = A_INVALID; break; } } #endif if ((flags & EC_PEEK) || action == A_INVALID) { /* * We're just peeking, or we didn't understand the command. * Unget all the characters we read in the loop above. * This does NOT include the original character that was * passed in as a parameter. */ while (nch > 1) { ungetcc(usercmd[--nch]); } } else { if (s != NULL) ungetsc(s); } return action; } diff --git a/contrib/less/defines.ds b/contrib/less/defines.ds index 9138b4215468..c98dcffc35b1 100644 --- a/contrib/less/defines.ds +++ b/contrib/less/defines.ds @@ -1,397 +1,400 @@ /* * 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. * * For more information about less, or for information on how to * contact the author, see the README file. */ /* DOS definition file for less. */ /* * This file has 2 sections: * User preferences. * Settings always true for MS-DOS systems. */ /* User preferences. */ /* * SECURE is 1 if you wish to disable a bunch of features in order to * be safe to run by unprivileged users. */ #define SECURE 0 /* * SHELL_ESCAPE is 1 if you wish to allow shell escapes. * (This is possible only if your system supplies the system() function.) */ #define SHELL_ESCAPE (!SECURE) /* * EXAMINE is 1 if you wish to allow examining files by name from within less. */ #define EXAMINE (!SECURE) /* * TAB_COMPLETE_FILENAME is 1 if you wish to allow the TAB key * to complete filenames at prompts. */ #define TAB_COMPLETE_FILENAME (!SECURE) /* * CMD_HISTORY is 1 if you wish to allow keys to cycle through * previous commands at prompts. */ #define CMD_HISTORY 1 /* * HILITE_SEARCH is 1 if you wish to have search targets to be * displayed in standout mode. */ #define HILITE_SEARCH 1 /* * EDITOR is 1 if you wish to allow editor invocation (the "v" command). * (This is possible only if your system supplies the system() function.) * EDIT_PGM is the name of the (default) editor to be invoked. */ #define EDITOR (!SECURE) #define EDIT_PGM "vi" /* * TAGS is 1 if you wish to support tag files. */ #define TAGS (!SECURE) /* * USERFILE is 1 if you wish to allow a .less file to specify * user-defined key bindings. */ #define USERFILE (!SECURE) /* * GLOB is 1 if you wish to have shell metacharacters expanded in filenames. * This will generally work if your system provides the "popen" function * and the "echo" shell command. */ #ifdef __DJGPP__ #define GLOB (!SECURE) #else #define GLOB 0 #endif /* * PIPEC is 1 if you wish to have the "|" command * which allows the user to pipe data into a shell command. */ #ifdef __DJGPP__ #define PIPEC (!SECURE) #else #define PIPEC 0 #endif /* * LOGFILE is 1 if you wish to allow the -l option (to create log files). */ #define LOGFILE (!SECURE) /* * GNU_OPTIONS is 1 if you wish to support the GNU-style command * line options --help and --version. */ #define GNU_OPTIONS 1 /* * ONLY_RETURN is 1 if you want RETURN to be the only input which * will continue past an error message. * Otherwise, any key will continue past an error message. */ #define ONLY_RETURN 0 /* * 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 * (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. */ /* * Define MSDOS_COMPILER if compiling for MS-DOS. */ #ifdef __DJGPP__ #define MSDOS_COMPILER DJGPPC #else #ifdef __BORLANDC__ #define MSDOS_COMPILER BORLANDC #else #define MSDOS_COMPILER MSOFTC #endif #endif /* * Pathname separator character. */ #define PATHNAME_SEP "\\" /* * HAVE_SYS_TYPES_H is 1 if your system has . */ #define HAVE_SYS_TYPES_H 1 /* * Define if you have the header file. */ #define HAVE_SGSTAT_H 0 /* * HAVE_PERROR is 1 if your system has the perror() call. * (Actually, if it has sys_errlist, sys_nerr and errno.) */ #define HAVE_PERROR 1 /* * HAVE_TIME is 1 if your system has the time() call. */ #define HAVE_TIME 1 /* * HAVE_SHELL is 1 if your system supports a SHELL command interpreter. */ #define HAVE_SHELL 0 /* * Default shell metacharacters and meta-escape character. */ #define DEF_METACHARS "; *?\t\n'\"()<>|&" #define DEF_METAESCAPE "" /* * HAVE_DUP is 1 if your system has the dup() call. */ #define HAVE_DUP 1 /* * Sizes of various buffers. */ #define CMDBUF_SIZE 512 /* Buffer for multichar commands */ #define UNGOT_SIZE 100 /* Max chars to unget() */ #define LINEBUF_SIZE 1024 /* Max size of line in input file */ #define OUTBUF_SIZE 1024 /* Output buffer */ #define PROMPT_SIZE 200 /* Max size of prompt string */ #define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */ #define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */ #define TAGLINE_SIZE 512 /* Max size of line in tags file */ #define TABSTOP_MAX 32 /* Max number of custom tab stops */ /* Define to `long' if doesn't define. */ #if MSDOS_COMPILER==BORLANDC #define off_t long #endif /* Define if you need to in order for stat and other things to work. */ /* #undef _POSIX_SOURCE */ /* Define as the return type of signal handlers (int or void). */ #define RETSIGTYPE void /* * Regular expression library. * Define exactly one of the following to be 1: * HAVE_POSIX_REGCOMP: POSIX regcomp() and regex.h * HAVE_RE_COMP: BSD re_comp() * HAVE_REGCMP: System V regcmp() * HAVE_V8_REGCOMP: Henry Spencer V8 regcomp() and regexp.h * NO_REGEX: pattern matching is supported, but without metacharacters. */ /* #undef HAVE_POSIX_REGCOMP */ /* #undef HAVE_RE_COMP */ /* #undef HAVE_REGCMP */ /* #undef HAVE_V8_REGCOMP */ #if MSDOS_COMPILER==DJGPPC #define HAVE_POSIX_REGCOMP 1 #else #define NO_REGEX 1 #endif /* Define HAVE_VOID if your compiler supports the "void" type. */ #define HAVE_VOID 1 /* Define HAVE_CONST if your compiler supports the "const" modifier. */ #define HAVE_CONST 1 /* Define HAVE_TIME_T if your system supports the "time_t" type. */ #define HAVE_TIME_T 1 /* Define HAVE_STRERROR if you have the strerror() function. */ #define HAVE_STRERROR 1 /* Define HAVE_FILENO if you have the fileno() macro. */ #define HAVE_FILENO 1 /* Define HAVE_ERRNO if you have the errno variable */ /* Define MUST_DEFINE_ERRNO if you have errno but it is not defined * in errno.h */ #if MSDOS_COMPILER==MSOFTC || MSDOS_COMPILER==DJGPPC #define HAVE_ERRNO 1 #define MUST_DEFINE_ERRNO 0 #else #define HAVE_ERRNO 1 #define MUST_DEFINE_ERRNO 1 #endif /* Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable */ #define HAVE_SYS_ERRLIST 1 /* Define HAVE_OSPEED if your termcap library has the ospeed variable */ /* Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined * in termcap.h. */ #define HAVE_OSPEED 0 #define MUST_DEFINE_OSPEED 0 /* Define HAVE_LOCALE if you have locale.h and setlocale. */ #define HAVE_LOCALE 0 /* Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr */ #define HAVE_TERMIOS_FUNCS 0 /* Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower */ #define HAVE_UPPER_LOWER 1 /* Define if you have the _setjmp function. */ #if MSDOS_COMPILER==MSOFTC || MSDOS_COMPILER==DJGPPC #define HAVE__SETJMP 0 #else #define HAVE__SETJMP 1 #endif /* Define if you have the memcpy function. */ #define HAVE_MEMCPY 1 /* Define if you have the popen function. */ #if MSDOS_COMPILER==DJGPPC #define HAVE_POPEN 1 #else #define HAVE_POPEN 0 #endif /* Define if you have the sigsetmask function. */ #define HAVE_SIGSETMASK 0 /* Define if you have the sigprocmask function. */ #define HAVE_SIGPROCMASK 0 /* Define if you have the sigset_t type and sigemptyset macro */ #define HAVE_SIGSET_T 0 #define HAVE_SIGEMPTYSET 0 /* Define if you have the stat function. */ #define HAVE_STAT 1 /* Define if you have the strchr function. */ #define HAVE_STRCHR 1 /* 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 /* Define if you have the header file. */ #define HAVE_FCNTL_H 1 /* Define if you have the header file. */ #define HAVE_LIMITS_H 1 /* Define if you have the header file. */ #define HAVE_STDIO_H 1 /* Define if you have the header file. */ #define HAVE_STDLIB_H 1 /* Define if you have the header file. */ #define HAVE_STRING_H 1 /* Define if you have the header file. */ #define HAVE_SYS_IOCTL_H 0 /* Define if you have the header file. */ #define HAVE_SYS_PTEM_H 0 /* Define if you have the header file. */ #define HAVE_SYS_STREAM_H 0 /* Define if you have the header file. */ #define HAVE_TERMCAP_H 0 /* Define if you have the header file. */ #define HAVE_TERMIO_H 0 /* Define if you have the header file. */ #define HAVE_TERMIOS_H 0 /* Define if you have the header file. */ #define HAVE_TIME_H 1 /* Define if you have the header file. */ #if MSDOS_COMPILER==DJGPPC #define HAVE_UNISTD_H 1 #else #define HAVE_UNISTD_H 0 #endif /* Define if you have the header file. */ #if MSDOS_COMPILER==MSOFTC #define HAVE_VALUES_H 0 #else #define HAVE_VALUES_H 1 #endif #if MSDOS_COMPILER == MSOFTC && _MSC_VER >= 700 /* * The names of these things changed in Microsoft C version 7.0. */ #define videoconfig _videoconfig #define rccoord _rccoord #define O_RDONLY _O_RDONLY #define O_WRONLY _O_WRONLY #define O_APPEND _O_APPEND #define O_BINARY _O_BINARY #define O_TEXT _O_TEXT #define find_t _find_t #define stat _stat #define S_IFMT _S_IFMT #define S_IFDIR _S_IFDIR #define S_IFREG _S_IFREG #define dup _dup #define open _open #define lseek _lseek #define write _write #define creat _creat #define fstat _fstat #define isatty _isatty #define close _close #define read _read #define ungetch _ungetch #define kbhit _kbhit #define getch _getch #endif diff --git a/contrib/less/defines.h.in b/contrib/less/defines.h.in index c476a51e10b8..8da1baeceda5 100644 --- a/contrib/less/defines.h.in +++ b/contrib/less/defines.h.in @@ -1,411 +1,420 @@ /* defines.h.in. Generated from configure.ac by autoheader. */ /* Unix definition file for less. -*- C -*- * * This file has 3 sections: * User preferences. * Settings always true on Unix. * Settings automatically determined by configure. * * * * * * * WARNING * * * * * * * If you edit defines.h by hand, do "touch stamp-h" before you run make * so config.status doesn't overwrite your changes. */ /* User preferences. */ /* * 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 SECURE_COMPILE /* * SHELL_ESCAPE is 1 if you wish to allow shell escapes. * (This is possible only if your system supplies the system() function.) */ #define SHELL_ESCAPE (!SECURE) /* * EXAMINE is 1 if you wish to allow examining files by name from within less. */ #define EXAMINE (!SECURE) /* * TAB_COMPLETE_FILENAME is 1 if you wish to allow the TAB key * to complete filenames at prompts. */ #define TAB_COMPLETE_FILENAME (!SECURE) /* * CMD_HISTORY is 1 if you wish to allow keys to cycle through * previous commands at prompts. */ #define CMD_HISTORY 1 /* * HILITE_SEARCH is 1 if you wish to have search targets to be * displayed in standout mode. */ #define HILITE_SEARCH 1 /* * EDITOR is 1 if you wish to allow editor invocation (the "v" command). * (This is possible only if your system supplies the system() function.) * EDIT_PGM is the name of the (default) editor to be invoked. */ #define EDITOR (!SECURE) /* * TAGS is 1 if you wish to support tag files. */ #define TAGS (!SECURE) /* * USERFILE is 1 if you wish to allow a .less file to specify * user-defined key bindings. */ #define USERFILE (!SECURE) /* * GLOB is 1 if you wish to have shell metacharacters expanded in filenames. * This will generally work if your system provides the "popen" function * and the "echo" shell command. */ #define GLOB (!SECURE) /* * PIPEC is 1 if you wish to have the "|" command * which allows the user to pipe data into a shell command. */ #define PIPEC (!SECURE) /* * LOGFILE is 1 if you wish to allow the -l option (to create log files). */ #define LOGFILE (!SECURE) /* * GNU_OPTIONS is 1 if you wish to support the GNU-style command * line options --help and --version. */ #define GNU_OPTIONS 1 /* * ONLY_RETURN is 1 if you want RETURN to be the only input which * will continue past an error message. * Otherwise, any key will continue past an error message. */ #define ONLY_RETURN 0 /* * 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 * (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. */ /* * Define MSDOS_COMPILER if compiling under Microsoft C. */ #define MSDOS_COMPILER 0 /* * Pathname separator character. */ #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 . */ #define HAVE_SYS_TYPES_H 1 /* * Define if you have the header file. */ #undef HAVE_SGSTAT_H /* * HAVE_PERROR is 1 if your system has the perror() call. * (Actually, if it has sys_errlist, sys_nerr and errno.) */ #define HAVE_PERROR 1 /* * HAVE_TIME is 1 if your system has the time() call. */ #define HAVE_TIME 1 /* * HAVE_SHELL is 1 if your system supports a SHELL command interpreter. */ #define HAVE_SHELL 1 /* * Default shell metacharacters and meta-escape character. */ #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. */ #define CMDBUF_SIZE 512 /* Buffer for multichar commands */ #define UNGOT_SIZE 100 /* Max chars to unget() */ #define LINEBUF_SIZE 1024 /* Max size of line in input file */ #define OUTBUF_SIZE 1024 /* Output buffer */ #define PROMPT_SIZE 200 /* Max size of prompt string */ #define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */ #define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */ #define TAGLINE_SIZE 512 /* Max size of line in tags file */ #define TABSTOP_MAX 32 /* Max number of custom tab stops */ /* Settings automatically determined by configure. */ /* Define EDIT_PGM to your editor. */ #undef EDIT_PGM /* Define HAVE_CONST if your compiler supports the "const" modifier. */ #undef HAVE_CONST /* Define to 1 if you have the header file. */ #undef HAVE_CTYPE_H /* Define HAVE_ERRNO if you have the errno variable. */ #undef HAVE_ERRNO /* Define to 1 if you have the header file. */ #undef HAVE_ERRNO_H /* Define to 1 if you have the `fchmod' function. */ #undef HAVE_FCHMOD /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define HAVE_FILENO if you have the fileno() macro. */ #undef HAVE_FILENO /* Define to 1 if you have the `fsync' function. */ #undef HAVE_FSYNC /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `gen' library (-lgen). */ #undef HAVE_LIBGEN /* Define to 1 if you have the `intl' library (-lintl). */ #undef HAVE_LIBINTL /* Define to 1 if you have the `PW' library (-lPW). */ #undef HAVE_LIBPW /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define HAVE_LOCALE if you have locale.h and setlocale. */ #undef HAVE_LOCALE /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define HAVE_OSPEED if your termcap library has the ospeed variable. */ #undef HAVE_OSPEED /* PCRE (Perl-compatible regular expression) library */ #undef HAVE_PCRE /* Define to 1 if you have the `popen' function. */ #undef HAVE_POPEN /* POSIX regcomp() and regex.h */ #undef HAVE_POSIX_REGCOMP /* System V regcmp() */ #undef HAVE_REGCMP /* */ #undef HAVE_REGEXEC2 /* BSD re_comp() */ #undef HAVE_RE_COMP /* Define HAVE_SIGEMPTYSET if you have the sigemptyset macro. */ #undef HAVE_SIGEMPTYSET /* Define to 1 if you have the `sigprocmask' function. */ #undef HAVE_SIGPROCMASK /* Define to 1 if you have the `sigsetmask' function. */ #undef HAVE_SIGSETMASK /* Define to 1 if the system has the type `sigset_t'. */ #undef HAVE_SIGSET_T /* Define to 1 if you have the `snprintf' function. */ #undef HAVE_SNPRINTF /* Define to 1 if you have the `stat' function. */ #undef HAVE_STAT +/* Define HAVE_STAT_INO if your struct stat has st_ino and st_dev. */ +#undef HAVE_STAT_INO + /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDIO_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define HAVE_STRERROR if you have the strerror() function. */ #undef HAVE_STRERROR /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `system' function. */ #undef HAVE_SYSTEM /* Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable. */ #undef HAVE_SYS_ERRLIST /* Define to 1 if you have the header file. */ #undef HAVE_SYS_IOCTL_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STREAM_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_TERMCAP_H /* Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr. */ #undef HAVE_TERMIOS_FUNCS /* Define to 1 if you have the header file. */ #undef HAVE_TERMIOS_H /* Define to 1 if you have the header file. */ #undef HAVE_TERMIO_H /* Define to 1 if you have the header file. */ #undef HAVE_TIME_H /* Define HAVE_TIME_T if your system supports the "time_t" type. */ #undef HAVE_TIME_T /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower. */ #undef HAVE_UPPER_LOWER /* Henry Spencer V8 regcomp() and regexp.h */ #undef HAVE_V8_REGCOMP /* Define to 1 if you have the header file. */ #undef HAVE_VALUES_H /* Define HAVE_VOID if your compiler supports the "void" type. */ #undef HAVE_VOID +/* Define HAVE_WCTYPE if you have iswupper, iswlower, towupper, towlower. */ +#undef HAVE_WCTYPE + +/* Define to 1 if you have the header file. */ +#undef HAVE_WCTYPE_H + /* Define to 1 if you have the `_setjmp' function. */ #undef HAVE__SETJMP /* Define MUST_DEFINE_ERRNO if you have errno but it is not define in errno.h. */ #undef MUST_DEFINE_ERRNO /* Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined in termcap.h. */ #undef MUST_DEFINE_OSPEED /* pattern matching is supported, but without metacharacters. */ #undef NO_REGEX /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* Define SECURE_COMPILE=1 to build a secure version of less. */ #undef SECURE_COMPILE /* Define to 1 if the `S_IS*' macros in do not work properly. */ #undef STAT_MACROS_BROKEN /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `long int' if does not define. */ #undef off_t /* Define to `unsigned int' if does not define. */ #undef size_t diff --git a/contrib/less/defines.o2 b/contrib/less/defines.o2 index 78da093f3fbd..544003809a69 100644 --- a/contrib/less/defines.o2 +++ b/contrib/less/defines.o2 @@ -1,325 +1,328 @@ /* * 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. * * For more information about less, or for information on how to * contact the author, see the README file. */ /* OS/2 definition file for less. */ /* * This file has 2 sections: * User preferences. * Settings always true for the emx compiler for OS/2 systems. */ /* User preferences. */ /* * SECURE is 1 if you wish to disable a bunch of features in order to * be safe to run by unprivileged users. */ #define SECURE 0 /* * SHELL_ESCAPE is 1 if you wish to allow shell escapes. * (This is possible only if your system supplies the system() function.) */ #define SHELL_ESCAPE (!SECURE) /* * EXAMINE is 1 if you wish to allow examining files by name from within less. */ #define EXAMINE (!SECURE) /* * TAB_COMPLETE_FILENAME is 1 if you wish to allow the TAB key * to complete filenames at prompts. */ #define TAB_COMPLETE_FILENAME (!SECURE) /* * CMD_HISTORY is 1 if you wish to allow keys to cycle through * previous commands at prompts. */ #define CMD_HISTORY 1 /* * HILITE_SEARCH is 1 if you wish to have search targets to be * displayed in standout mode. */ #define HILITE_SEARCH 1 /* * EDITOR is 1 if you wish to allow editor invocation (the "v" command). * (This is possible only if your system supplies the system() function.) * EDIT_PGM is the name of the (default) editor to be invoked. */ #define EDITOR (!SECURE) #define EDIT_PGM "vi" /* * TAGS is 1 if you wish to support tag files. */ #define TAGS (!SECURE) /* * USERFILE is 1 if you wish to allow a .less file to specify * user-defined key bindings. */ #define USERFILE (!SECURE) /* * GLOB is 1 if you wish to have shell metacharacters expanded in filenames. * This will generally work if your system provides the "popen" function * and the "echo" shell command. */ #define GLOB (!SECURE) /* * PIPEC is 1 if you wish to have the "|" command * which allows the user to pipe data into a shell command. */ #define PIPEC (!SECURE) /* * LOGFILE is 1 if you wish to allow the -l option (to create log files). */ #define LOGFILE (!SECURE) /* * GNU_OPTIONS is 1 if you wish to support the GNU-style command * line options --help and --version. */ #define GNU_OPTIONS 1 /* * ONLY_RETURN is 1 if you want RETURN to be the only input which * will continue past an error message. * Otherwise, any key will continue past an error message. */ #define ONLY_RETURN 0 /* * 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 * (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. */ #define OS2 1 /* * Pathname separator character. */ #define PATHNAME_SEP "\\" /* * HAVE_SYS_TYPES_H is 1 if your system has . */ #define HAVE_SYS_TYPES_H 1 /* * Define if you have the header file. */ #define HAVE_SGSTAT_H 0 /* * HAVE_PERROR is 1 if your system has the perror() call. * (Actually, if it has sys_errlist, sys_nerr and errno.) */ #define HAVE_PERROR 1 /* * HAVE_TIME is 1 if your system has the time() call. */ #define HAVE_TIME 1 /* * HAVE_SHELL is 1 if your system supports a SHELL command interpreter. */ #define HAVE_SHELL 0 /* * Default shell metacharacters and meta-escape character. */ #define DEF_METACHARS "; *?\t\n'\"()<>|&" #define DEF_METAESCAPE "" /* * HAVE_DUP is 1 if your system has the dup() call. */ #define HAVE_DUP 1 /* * Sizes of various buffers. */ #define CMDBUF_SIZE 512 /* Buffer for multichar commands */ #define UNGOT_SIZE 100 /* Max chars to unget() */ #define LINEBUF_SIZE 1024 /* Max size of line in input file */ #define OUTBUF_SIZE 1024 /* Output buffer */ #define PROMPT_SIZE 200 /* Max size of prompt string */ #define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */ #define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */ #define TAGLINE_SIZE 512 /* Max size of line in tags file */ #define TABSTOP_MAX 32 /* Max number of custom tab stops */ /* Define to `long' if doesn't define. */ /* #define off_t long */ /* Define if you need to in order for stat and other things to work. */ /* #undef _POSIX_SOURCE */ /* Define as the return type of signal handlers (int or void). */ #define RETSIGTYPE void /* * Regular expression library. * Define exactly one of the following to be 1: * HAVE_POSIX_REGCOMP: POSIX regcomp() and regex.h * HAVE_RE_COMP: BSD re_comp() * HAVE_REGCMP: System V regcmp() * HAVE_V8_REGCOMP: Henry Spencer V8 regcomp() and regexp.h * NO_REGEX: pattern matching is supported, but without metacharacters. */ /* #undef HAVE_POSIX_REGCOMP */ /* #undef HAVE_RE_COMP */ /* #undef HAVE_REGCMP */ #define HAVE_V8_REGCOMP 1 /* #undef NO_REGEX */ #define HAVE_REGEXEC2 1 /* Define HAVE_VOID if your compiler supports the "void" type. */ #define HAVE_VOID 1 /* Define HAVE_CONST if your compiler supports the "const" modifier. */ #define HAVE_CONST 1 /* Define HAVE_TIME_T if your system supports the "time_t" type. */ #define HAVE_TIME_T 1 /* Define HAVE_STRERROR if you have the strerror() function. */ #define HAVE_STRERROR 1 /* Define HAVE_FILENO if you have the fileno() macro. */ #define HAVE_FILENO 1 /* Define HAVE_ERRNO if you have the errno variable */ /* Define MUST_DEFINE_ERRNO if you have errno but it is not define * in errno.h */ #define HAVE_ERRNO 1 /* #undef MUST_DEFINE_ERRNO */ /* Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable */ #define HAVE_SYS_ERRLIST 1 /* Define HAVE_OSPEED if your termcap library has the ospeed variable */ #define HAVE_OSPEED 1 /* Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined * in termcap.h. */ #define MUST_DEFINE_OSPEED 0 /* Define HAVE_LOCALE if you have locale.h and setlocale. */ #define HAVE_LOCALE 1 /* Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr */ #define HAVE_TERMIOS_FUNCS 1 /* Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower */ #define HAVE_UPPER_LOWER 1 /* Define if you have the _setjmp function. */ #define HAVE__SETJMP 0 /* Define if you have the memcpy function. */ #define HAVE_MEMCPY 1 /* Define if you have the popen function. */ #define HAVE_POPEN 1 /* Define if you have the sigsetmask function. */ #define HAVE_SIGSETMASK 0 /* Define if you have the sigprocmask function. */ #define HAVE_SIGPROCMASK 1 /* Define if you have the sigset_t type and sigemptyset macro */ #define HAVE_SIGSET_T 1 #define HAVE_SIGEMPTYSET 1 /* Define if you have the stat function. */ #define HAVE_STAT 1 /* Define if you have the strchr function. */ #define HAVE_STRCHR 1 /* Define if you have the strstr function. */ #define HAVE_STRSTR 1 /* 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 /* Define if you have the header file. */ #define HAVE_FCNTL_H 1 /* Define if you have the header file. */ #define HAVE_LIMITS_H 1 /* Define if you have the header file. */ #define HAVE_STDIO_H 1 /* Define if you have the header file. */ #define HAVE_STDLIB_H 1 /* Define if you have the header file. */ #define HAVE_STRING_H 1 /* Define if you have the header file. */ #define HAVE_SYS_IOCTL_H 1 /* Define if you have the header file. */ #define HAVE_SYS_PTEM_H 0 /* Define if you have the header file. */ #define HAVE_SYS_STREAM_H 0 /* Define if you have the header file. */ #define HAVE_TERMCAP_H 1 /* Define if you have the header file. */ #define HAVE_TERMIO_H 1 /* Define if you have the header file. */ #define HAVE_TERMIOS_H 1 /* Define if you have the header file. */ #define HAVE_TIME_H 1 /* Define if you have the header file. */ #define HAVE_UNISTD_H 1 /* Define if you have the header file. */ #define HAVE_VALUES_H 0 diff --git a/contrib/less/defines.o9 b/contrib/less/defines.o9 index 179e3777b360..50955ba1046a 100644 --- a/contrib/less/defines.o9 +++ b/contrib/less/defines.o9 @@ -1,337 +1,340 @@ /* * 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. * * For more information about less, or for information on how to * contact the author, see the README file. */ /* OS/9 definition file for less. */ /* * This file has 2 sections: * User preferences. * Settings always true for OS-9 systems. */ /* User preferences. */ /* * SECURE is 1 if you wish to disable a bunch of features in order to * be safe to run by unprivileged users. */ #define SECURE 0 /* * SHELL_ESCAPE is 1 if you wish to allow shell escapes. * (This is possible only if your system supplies the system() function.) */ #define SHELL_ESCAPE (!SECURE) /* * EXAMINE is 1 if you wish to allow examining files by name from within less. */ #define EXAMINE (!SECURE) /* * TAB_COMPLETE_FILENAME is 1 if you wish to allow the TAB key * to complete filenames at prompts. */ #define TAB_COMPLETE_FILENAME 1 /* * CMD_HISTORY is 1 if you wish to allow keys to cycle through * previous commands at prompts. */ #define CMD_HISTORY 1 /* * HILITE_SEARCH is 1 if you wish to have search targets to be * displayed in standout mode. */ #define HILITE_SEARCH 1 /* * EDITOR is 1 if you wish to allow editor invocation (the "v" command). * (This is possible only if your system supplies the system() function.) * EDIT_PGM is the name of the (default) editor to be invoked. */ #define EDITOR (!SECURE) #define EDIT_PGM "umacs" /* * TAGS is 1 if you wish to support tag files. */ #define TAGS (!SECURE) /* * USERFILE is 1 if you wish to allow a .less file to specify * user-defined key bindings. */ #define USERFILE (!SECURE) /* * GLOB is 1 if you wish to have shell metacharacters expanded in filenames. * This will generally work if your system provides the "popen" function * and the "echo" shell command. */ #define GLOB (!SECURE) /* * PIPEC is 1 if you wish to have the "|" command * which allows the user to pipe data into a shell command. */ #define PIPEC (!SECURE) /* * LOGFILE is 1 if you wish to allow the -l option (to create log files). */ #define LOGFILE (!SECURE) /* * GNU_OPTIONS is 1 if you wish to support the GNU-style command * line options --help and --version. */ #define GNU_OPTIONS 1 /* * ONLY_RETURN is 1 if you want RETURN to be the only input which * will continue past an error message. * Otherwise, any key will continue past an error message. */ #define ONLY_RETURN 0 /* * 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 * (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. */ /* This is not needed; it is defined by the compiler. */ /* #define _OSK 1 */ #define OS2 0 #define MSDOS_COMPILER 0 /* * Pathname separator character. */ #define PATHNAME_SEP "/" /* * HAVE_SYS_TYPES_H is 1 if your system has . */ #define HAVE_SYS_TYPES_H 0 /* * Define if you have the header file. */ #define HAVE_SGSTAT_H 1 /* * HAVE_PERROR is 1 if your system has the perror() call. * (Actually, if it has sys_errlist, sys_nerr and errno.) */ #if _OSK_MWC32 #define HAVE_PERROR 0 #else #define HAVE_PERROR 1 #endif /* * HAVE_TIME is 1 if your system has the time() call. */ #define HAVE_TIME 1 /* * HAVE_SHELL is 1 if your system supports a SHELL command interpreter. */ #define HAVE_SHELL 0 /* * Default shell metacharacters and meta-escape character. */ #define DEF_METACHARS "; \t\n'\"()<>|&^`#\\" #define DEF_METAESCAPE "\\" /* * HAVE_DUP is 1 if your system has the dup() call. */ #define HAVE_DUP 0 /* * Sizes of various buffers. */ #define CMDBUF_SIZE 512 /* Buffer for multichar commands */ #define UNGOT_SIZE 100 /* Max chars to unget() */ #define LINEBUF_SIZE 1024 /* Max size of line in input file */ #define OUTBUF_SIZE 1024 /* Output buffer */ #define PROMPT_SIZE 200 /* Max size of prompt string */ #define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */ #define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */ #define TAGLINE_SIZE 512 /* Max size of line in tags file */ #define TABSTOP_MAX 32 /* Max number of custom tab stops */ /* Define to `long' if doesn't define. */ #define off_t long /* Define if you need to in order for stat and other things to work. */ #define _POSIX_SOURCE 0 /* Define as the return type of signal handlers (int or void). */ #if _OSK_MWC32 #define RETSIGTYPE int #else #define RETSIGTYPE void #endif /* * Regular expression library. * Define exactly one of the following to be 1: * HAVE_POSIX_REGCOMP: POSIX regcomp() and regex.h * HAVE_RE_COMP: BSD re_comp() * HAVE_REGCMP: System V regcmp() * HAVE_V8_REGCOMP: Henry Spencer V8 regcomp() and regexp.h * NO_REGEX: pattern matching is supported, but without metacharacters. */ #define HAVE_POSIX_REGCOMP 0 #define HAVE_RE_COMP 0 #define HAVE_REGCMP 0 #define HAVE_V8_REGCOMP 1 #define NO_REGEX 0 #define HAVE_REGEXEC2 1 /* Define HAVE_VOID if your compiler supports the "void" type. */ #define HAVE_VOID 1 /* Define HAVE_CONST if your compiler supports the "const" modifier. */ #define HAVE_CONST 0 /* Define HAVE_TIME_T if your system supports the "time_t" type. */ #define HAVE_TIME_T 1 /* Define HAVE_STRERROR if you have the strerror() function. */ #define HAVE_STRERROR 0 /* Define HAVE_FILENO if you have the fileno() macro. */ #define HAVE_FILENO 1 /* Define HAVE_ERRNO if you have the errno variable */ /* Define MUST_DEFINE_ERRNO if you have errno but it is not define * in errno.h */ #define HAVE_ERRNO 1 #define MUST_DEFINE_ERRNO 0 /* Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable */ #define HAVE_SYS_ERRLIST 0 /* Define HAVE_OSPEED if your termcap library has the ospeed variable */ /* Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined * in termcap.h. */ #define HAVE_OSPEED 0 #define MUST_DEFINE_OSPEED 0 /* Define HAVE_LOCALE if you have locale.h and setlocale. */ #define HAVE_LOCALE 0 /* Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr */ #define HAVE_TERMIOS_FUNCS 0 /* Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower */ #define HAVE_UPPER_LOWER 1 /* Define if you have the _setjmp function. */ #define HAVE__SETJMP 1 /* Define if you have the memcpy function. */ #define HAVE_MEMCPY 1 /* Define if you have the popen function. */ #define HAVE_POPEN 1 /* Define if you have the sigsetmask function. */ #define HAVE_SIGSETMASK 0 /* Define if you have the sigprocmask function. */ #define HAVE_SIGPROCMASK 0 /* Define if you have the sigset_t type and sigemptyset macro */ #define HAVE_SIGSET_T 0 #define HAVE_SIGEMPTYSET 0 /* Define if you have the stat function. */ #define HAVE_STAT 0 /* Define if you have the strchr function. */ #define HAVE_STRCHR 0 /* 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 /* Define if you have the header file. */ #define HAVE_FCNTL_H 0 /* Define if you have the header file. */ #define HAVE_LIMITS_H 0 /* Define if you have the header file. */ #define HAVE_STDIO_H 1 /* Define if you have the header file. */ #define HAVE_STRING_H 1 /* Define if you have the header file. */ #if _OSK_MWC32 #define HAVE_STDLIB_H 0 #else #define HAVE_STDLIB_H 1 #endif /* Define if you have the header file. */ #define HAVE_SYS_IOCTL_H 0 /* Define if you have the header file. */ #define HAVE_SYS_PTEM_H 0 /* Define if you have the header file. */ #define HAVE_SYS_STREAM_H 0 /* Define if you have the header file. */ #define HAVE_TERMCAP_H 1 /* Define if you have the header file. */ #define HAVE_TERMIO_H 0 /* Define if you have the header file. */ #define HAVE_TERMIOS_H 0 /* Define if you have the header file. */ #define HAVE_TIME_H 1 /* Define if you have the header file. */ #define HAVE_UNISTD_H 0 /* Define if you have the header file. */ #define HAVE_VALUES_H 0 diff --git a/contrib/less/defines.wn b/contrib/less/defines.wn index ef04f3b8b53f..7c3194c832b9 100644 --- a/contrib/less/defines.wn +++ b/contrib/less/defines.wn @@ -1,330 +1,333 @@ /* * 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. * * For more information about less, or for information on how to * contact the author, see the README file. */ /* Windows definition file for less. */ /* * This file has 2 sections: * User preferences. * Settings always true for Windows systems. */ /* User preferences. */ /* * SECURE is 1 if you wish to disable a bunch of features in order to * be safe to run by unprivileged users. */ #define SECURE 0 /* * SHELL_ESCAPE is 1 if you wish to allow shell escapes. * (This is possible only if your system supplies the system() function.) */ #define SHELL_ESCAPE (!SECURE) /* * EXAMINE is 1 if you wish to allow examining files by name from within less. */ #define EXAMINE (!SECURE) /* * TAB_COMPLETE_FILENAME is 1 if you wish to allow the TAB key * to complete filenames at prompts. */ #define TAB_COMPLETE_FILENAME (!SECURE) /* * CMD_HISTORY is 1 if you wish to allow keys to cycle through * previous commands at prompts. */ #define CMD_HISTORY 1 /* * HILITE_SEARCH is 1 if you wish to have search targets to be * displayed in standout mode. */ #define HILITE_SEARCH 1 /* * EDITOR is 1 if you wish to allow editor invocation (the "v" command). * (This is possible only if your system supplies the system() function.) * EDIT_PGM is the name of the (default) editor to be invoked. */ #define EDITOR (!SECURE) #define EDIT_PGM "edit" /* * TAGS is 1 if you wish to support tag files. */ #define TAGS (!SECURE) /* * USERFILE is 1 if you wish to allow a .less file to specify * user-defined key bindings. */ #define USERFILE (!SECURE) /* * GLOB is 1 if you wish to have shell metacharacters expanded in filenames. * This will generally work if your system provides the "popen" function * and the "echo" shell command. */ #define GLOB 0 /* * PIPEC is 1 if you wish to have the "|" command * which allows the user to pipe data into a shell command. */ #define PIPEC 1 /* * LOGFILE is 1 if you wish to allow the -l option (to create log files). */ #define LOGFILE (!SECURE) /* * GNU_OPTIONS is 1 if you wish to support the GNU-style command * line options --help and --version. */ #define GNU_OPTIONS 1 /* * ONLY_RETURN is 1 if you want RETURN to be the only input which * will continue past an error message. * Otherwise, any key will continue past an error message. */ #define ONLY_RETURN 0 /* * 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 * (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. */ #define MSDOS_COMPILER WIN32C /* * Pathname separator character. */ #define PATHNAME_SEP "\\" /* * HAVE_SYS_TYPES_H is 1 if your system has . */ #define HAVE_SYS_TYPES_H 1 /* * Define if you have the header file. */ #define HAVE_SGSTAT_H 0 /* * HAVE_PERROR is 1 if your system has the perror() call. * (Actually, if it has sys_errlist, sys_nerr and errno.) */ #define HAVE_PERROR 1 /* * HAVE_TIME is 1 if your system has the time() call. */ #define HAVE_TIME 1 /* * HAVE_SHELL is 1 if your system supports a SHELL command interpreter. */ #define HAVE_SHELL 0 /* * Default shell metacharacters and meta-escape character. */ #define DEF_METACHARS "; *?\t\n'\"()<>|&" #define DEF_METAESCAPE "" /* * HAVE_DUP is 1 if your system has the dup() call. */ #define HAVE_DUP 1 /* * Sizes of various buffers. */ #define CMDBUF_SIZE 512 /* Buffer for multichar commands */ #define UNGOT_SIZE 100 /* Max chars to unget() */ #define LINEBUF_SIZE 1024 /* Max size of line in input file */ #define OUTBUF_SIZE 1024 /* Output buffer */ #define PROMPT_SIZE 200 /* Max size of prompt string */ #define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */ #define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */ #define TAGLINE_SIZE 512 /* Max size of line in tags file */ #define TABSTOP_MAX 32 /* Max number of custom tab stops */ /* Define to `long' if doesn't define. */ /* #define off_t long */ /* Define if you need to in order for stat and other things to work. */ /* #undef _POSIX_SOURCE */ /* Define as the return type of signal handlers (int or void). */ #define RETSIGTYPE void /* * Regular expression library. * Define exactly one of the following to be 1: * HAVE_POSIX_REGCOMP: POSIX regcomp() and regex.h * HAVE_RE_COMP: BSD re_comp() * HAVE_REGCMP: System V regcmp() * HAVE_V8_REGCOMP: Henry Spencer V8 regcomp() and regexp.h * NO_REGEX: pattern matching is supported, but without metacharacters. */ /* #undef HAVE_POSIX_REGCOMP */ /* #undef HAVE_RE_COMP */ /* #undef HAVE_REGCMP */ #define HAVE_V8_REGCOMP 1 /* #undef NO_REGEX */ #define HAVE_REGEXEC2 1 /* Define HAVE_VOID if your compiler supports the "void" type. */ #define HAVE_VOID 1 /* Define HAVE_CONST if your compiler supports the "const" modifier. */ #define HAVE_CONST 1 /* Define HAVE_TIME_T if your system supports the "time_t" type. */ #define HAVE_TIME_T 1 /* Define HAVE_STRERROR if you have the strerror() function. */ #define HAVE_STRERROR 1 /* Define HAVE_FILENO if you have the fileno() macro. */ #define HAVE_FILENO 1 /* Define HAVE_ERRNO if you have the errno variable */ /* Define MUST_DEFINE_ERRNO if you have errno but it is not define * in errno.h */ #define HAVE_ERRNO 1 #define MUST_DEFINE_ERRNO 1 /* Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable */ #define HAVE_SYS_ERRLIST 1 /* Define HAVE_OSPEED if your termcap library has the ospeed variable */ #define HAVE_OSPEED 0 /* Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined * in termcap.h. */ #define MUST_DEFINE_OSPEED 0 /* Define HAVE_LOCALE if you have locale.h and setlocale. */ #define HAVE_LOCALE 0 /* Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr */ #define HAVE_TERMIOS_FUNCS 0 /* Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower */ #define HAVE_UPPER_LOWER 1 /* Define if you have the _setjmp function. */ #define HAVE__SETJMP 1 /* Define if you have the memcpy function. */ #define HAVE_MEMCPY 1 /* Define if you have the popen function. */ #define HAVE_POPEN 1 /* Define if you have the sigsetmask function. */ #define HAVE_SIGSETMASK 0 /* Define if you have the sigprocmask function. */ #define HAVE_SIGPROCMASK 0 /* Define if you have the sigset_t type and sigemptyset macro */ #define HAVE_SIGSET_T 0 #define HAVE_SIGEMPTYSET 0 /* Define if you have the stat function. */ #define HAVE_STAT 1 /* Define if you have the strchr function. */ #define HAVE_STRCHR 1 /* 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 /* Define if you have the header file. */ #define HAVE_FCNTL_H 1 /* Define if you have the header file. */ #define HAVE_LIMITS_H 0 /* Define if you have the header file. */ #define HAVE_STDIO_H 1 /* Define if you have the header file. */ #define HAVE_STRING_H 1 /* Define if you have the header file. */ #define HAVE_STDLIB_H 1 /* Define if you have the header file. */ #define HAVE_SYS_IOCTL_H 0 /* Define if you have the header file. */ #define HAVE_SYS_PTEM_H 0 /* Define if you have the header file. */ #define HAVE_SYS_STREAM_H 0 /* Define if you have the header file. */ #define HAVE_TERMCAP_H 0 /* Define if you have the header file. */ #define HAVE_TERMIO_H 0 /* Define if you have the header file. */ #define HAVE_TERMIOS_H 0 /* Define if you have the header file. */ #define HAVE_TIME_H 1 /* Define if you have the header file. */ #define HAVE_UNISTD_H 0 /* Define if you have the header file. */ #ifdef _MSC_VER #define HAVE_VALUES_H 0 #else #define HAVE_VALUES_H 1 #endif #define popen _popen #define pclose _pclose diff --git a/contrib/less/edit.c b/contrib/less/edit.c index 908f29e18d28..e2e30f2d7af3 100644 --- a/contrib/less/edit.c +++ b/contrib/less/edit.c @@ -1,787 +1,818 @@ /* * 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. * * For more information about less, or for information on how to * contact the author, see the README file. */ #include "less.h" +#if HAVE_STAT +#include +#endif public int fd0 = 0; extern int new_file; extern int errmsgs; extern int cbufs; extern char *every_first_cmd; extern int any_display; extern int force_open; extern int is_tty; extern int sigs; extern IFILE curr_ifile; extern IFILE old_ifile; extern struct scrpos initial_scrpos; extern void constant *ml_examine; #if SPACES_IN_FILENAMES extern char openquote; extern char closequote; #endif #if LOGFILE extern int logfile; 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; /* * Textlist functions deal with a list of words separated by spaces. * init_textlist sets up a textlist structure. * forw_textlist uses that structure to iterate thru the list of * words, returning each one as a standard null-terminated string. * back_textlist does the same, but runs thru the list backwards. */ public void init_textlist(tlist, str) struct textlist *tlist; char *str; { char *s; #if SPACES_IN_FILENAMES int meta_quoted = 0; int delim_quoted = 0; char *esc = get_meta_escape(); int esclen = strlen(esc); #endif tlist->string = skipsp(str); tlist->endstring = tlist->string + strlen(tlist->string); for (s = str; s < tlist->endstring; s++) { #if SPACES_IN_FILENAMES if (meta_quoted) { meta_quoted = 0; } else if (esclen > 0 && s + esclen < tlist->endstring && strncmp(s, esc, esclen) == 0) { meta_quoted = 1; s += esclen - 1; } else if (delim_quoted) { if (*s == closequote) delim_quoted = 0; } else /* (!delim_quoted) */ { if (*s == openquote) delim_quoted = 1; else if (*s == ' ') *s = '\0'; } #else if (*s == ' ') *s = '\0'; #endif } } public char * forw_textlist(tlist, prev) struct textlist *tlist; char *prev; { char *s; /* * prev == NULL means return the first word in the list. * Otherwise, return the word after "prev". */ if (prev == NULL) s = tlist->string; else s = prev + strlen(prev); if (s >= tlist->endstring) return (NULL); while (*s == '\0') s++; if (s >= tlist->endstring) return (NULL); return (s); } public char * back_textlist(tlist, prev) struct textlist *tlist; char *prev; { char *s; /* * prev == NULL means return the last word in the list. * Otherwise, return the word before "prev". */ if (prev == NULL) s = tlist->endstring; else if (prev <= tlist->string) return (NULL); else s = prev - 1; while (*s == '\0') s--; if (s <= tlist->string) return (NULL); while (s[-1] != '\0' && s > tlist->string) s--; return (s); } /* * Close the current input file. */ static void close_file() { struct scrpos scrpos; if (curr_ifile == NULL_IFILE) return; /* * Save the current position so that we can return to * the same position if we edit this file again. */ get_scrpos(&scrpos); if (scrpos.pos != NULL_POSITION) { store_pos(curr_ifile, &scrpos); lastmark(); } /* * Close the file descriptor, unless it is a pipe. */ ch_close(); /* * If we opened a file using an alternate name, * do special stuff to close it. */ if (curr_altfilename != NULL) { close_altfile(curr_altfilename, get_filename(curr_ifile), curr_altpipe); free(curr_altfilename); curr_altfilename = NULL; } curr_ifile = NULL_IFILE; +#if HAVE_STAT_INO + curr_ino = curr_dev = 0; +#endif } /* * Edit a new file (given its name). * Filename == "-" means standard input. * Filename == NULL means just close the current file. */ public int edit(filename) char *filename; { if (filename == NULL) return (edit_ifile(NULL_IFILE)); return (edit_ifile(get_ifile(filename, curr_ifile))); } /* * Edit a new file (given its IFILE). * ifile == NULL means just close the current file. */ public int edit_ifile(ifile) IFILE ifile; { int f; int answer; int no_display; int chflags; char *filename; char *open_filename; char *qopen_filename; char *alt_filename; void *alt_pipe; IFILE was_curr_ifile; PARG parg; if (ifile == curr_ifile) { /* * Already have the correct file open. */ return (0); } /* * We must close the currently open file now. * This is necessary to make the open_altfile/close_altfile pairs * nest properly (or rather to avoid nesting at all). * {{ Some stupid implementations of popen() mess up if you do: * fA = popen("A"); fB = popen("B"); pclose(fA); pclose(fB); }} */ #if LOGFILE end_logfile(); #endif was_curr_ifile = save_curr_ifile(); if (curr_ifile != NULL_IFILE) { chflags = ch_getflags(); close_file(); if ((chflags & CH_HELPFILE) && held_ifile(was_curr_ifile) <= 1) { /* * Don't keep the help file in the ifile list. */ del_ifile(was_curr_ifile); was_curr_ifile = old_ifile; } } if (ifile == NULL_IFILE) { /* * No new file to open. * (Don't set old_ifile, because if you call edit_ifile(NULL), * you're supposed to have saved curr_ifile yourself, * and you'll restore it if necessary.) */ unsave_ifile(was_curr_ifile); return (0); } filename = save(get_filename(ifile)); /* * See if LESSOPEN specifies an "alternate" file to open. */ alt_pipe = NULL; alt_filename = open_altfile(filename, &f, &alt_pipe); open_filename = (alt_filename != NULL) ? alt_filename : filename; qopen_filename = shell_unquote(open_filename); chflags = 0; if (alt_pipe != NULL) { /* * The alternate "file" is actually a pipe. * f has already been set to the file descriptor of the pipe * in the call to open_altfile above. * Keep the file descriptor open because it was opened * via popen(), and pclose() wants to close it. */ chflags |= CH_POPENED; } else if (strcmp(open_filename, "-") == 0) { /* * Use standard input. * Keep the file descriptor open because we can't reopen it. */ f = fd0; chflags |= CH_KEEPOPEN; /* * Must switch stdin to BINARY mode. */ SET_BINARY(f); #if MSDOS_COMPILER==DJGPPC /* * Setting stdin to binary by default causes * Ctrl-C to not raise SIGINT. We must undo * that side-effect. */ __djgpp_set_ctrl_c(1); #endif } else if (strcmp(open_filename, FAKE_HELPFILE) == 0) { f = -1; chflags |= CH_HELPFILE; } else if ((parg.p_string = bad_file(open_filename)) != NULL) { /* * It looks like a bad file. Don't try to open it. */ error("%s", &parg); free(parg.p_string); err1: if (alt_filename != NULL) { close_altfile(alt_filename, filename, alt_pipe); free(alt_filename); } del_ifile(ifile); free(qopen_filename); free(filename); /* * 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) { /* * Got an error trying to open it. */ parg.p_string = errno_message(filename); error("%s", &parg); free(parg.p_string); goto err1; } else { chflags |= CH_CANSEEK; if (!force_open && !opened(ifile) && bin_file(f)) { /* * Looks like a binary file. * Ask user if we should proceed. */ parg.p_string = filename; answer = query("\"%s\" may be a binary file. See it anyway? ", &parg); if (answer != 'y' && answer != 'Y') { close(f); goto err1; } } } - free(qopen_filename); /* * Get the new ifile. * Get the saved position for the file. */ if (was_curr_ifile != NULL_IFILE) { old_ifile = was_curr_ifile; unsave_ifile(was_curr_ifile); } curr_ifile = ifile; curr_altfilename = alt_filename; curr_altpipe = alt_pipe; set_open(curr_ifile); /* File has been opened */ get_pos(curr_ifile, &initial_scrpos); new_file = TRUE; ch_init(f, chflags); if (!(chflags & CH_HELPFILE)) { #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; if (is_tty) { /* * Output is to a real tty. */ /* * Indicate there is nothing displayed yet. */ pos_clear(); clr_linenum(); #if HILITE_SEARCH clr_hilite(); #endif cmd_addhist(ml_examine, filename); if (no_display && errmsgs > 0) { /* * We displayed some messages on error output * (file descriptor 2; see error() function). * Before erasing the screen contents, * display the file name and wait for a keystroke. */ parg.p_string = filename; error("%s", &parg); } } free(filename); return (0); } /* * Edit a space-separated list of files. * For each filename in the list, enter it into the ifile list. * Then edit the first one. */ public int edit_list(filelist) char *filelist; { IFILE save_ifile; char *good_filename; char *filename; char *gfilelist; char *gfilename; struct textlist tl_files; struct textlist tl_gfiles; save_ifile = save_curr_ifile(); good_filename = NULL; /* * Run thru each filename in the list. * Try to glob the filename. * If it doesn't expand, just try to open the filename. * If it does expand, try to open each name in that list. */ init_textlist(&tl_files, filelist); filename = NULL; while ((filename = forw_textlist(&tl_files, filename)) != NULL) { gfilelist = lglob(filename); init_textlist(&tl_gfiles, gfilelist); gfilename = NULL; while ((gfilename = forw_textlist(&tl_gfiles, gfilename)) != NULL) { if (edit(gfilename) == 0 && good_filename == NULL) good_filename = get_filename(curr_ifile); } free(gfilelist); } /* * Edit the first valid filename in the list. */ if (good_filename == NULL) { unsave_ifile(save_ifile); return (1); } if (get_ifile(good_filename, curr_ifile) == curr_ifile) { /* * Trying to edit the current file; don't reopen it. */ unsave_ifile(save_ifile); return (0); } reedit_ifile(save_ifile); return (edit(good_filename)); } /* * Edit the first file in the command line (ifile) list. */ public int edit_first() { curr_ifile = NULL_IFILE; return (edit_next(1)); } /* * Edit the last file in the command line (ifile) list. */ public int edit_last() { curr_ifile = NULL_IFILE; return (edit_prev(1)); } /* * Edit the n-th next or previous file in the command line (ifile) list. */ static int edit_istep(h, n, dir) IFILE h; int n; int dir; { IFILE next; /* * Skip n filenames, then try to edit each filename. */ for (;;) { next = (dir > 0) ? next_ifile(h) : prev_ifile(h); if (--n < 0) { if (edit_ifile(h) == 0) break; } if (next == NULL_IFILE) { /* * Reached end of the ifile list. */ return (1); } if (ABORT_SIGS()) { /* * Interrupt breaks out, if we're in a long * list of files that can't be opened. */ return (1); } h = next; } /* * Found a file that we can edit. */ return (0); } static int edit_inext(h, n) IFILE h; int n; { return (edit_istep(h, n, +1)); } public int edit_next(n) int n; { return edit_istep(curr_ifile, n, +1); } static int edit_iprev(h, n) IFILE h; int n; { return (edit_istep(h, n, -1)); } public int edit_prev(n) int n; { return edit_istep(curr_ifile, n, -1); } /* * Edit a specific file in the command line (ifile) list. */ public int edit_index(n) int n; { IFILE h; h = NULL_IFILE; do { if ((h = next_ifile(h)) == NULL_IFILE) { /* * Reached end of the list without finding it. */ return (1); } } while (get_index(h) != n); return (edit_ifile(h)); } public IFILE save_curr_ifile() { if (curr_ifile != NULL_IFILE) hold_ifile(curr_ifile, 1); return (curr_ifile); } public void unsave_ifile(save_ifile) IFILE save_ifile; { if (save_ifile != NULL_IFILE) hold_ifile(save_ifile, -1); } /* * Reedit the ifile which was previously open. */ public void reedit_ifile(save_ifile) IFILE save_ifile; { IFILE next; IFILE prev; /* * Try to reopen the ifile. * Note that opening it may fail (maybe the file was removed), * in which case the ifile will be deleted from the list. * So save the next and prev ifiles first. */ unsave_ifile(save_ifile); next = next_ifile(save_ifile); prev = prev_ifile(save_ifile); if (edit_ifile(save_ifile) == 0) return; /* * If can't reopen it, open the next input file in the list. */ if (next != NULL_IFILE && edit_inext(next, 0) == 0) return; /* * If can't open THAT one, open the previous input file in the list. */ if (prev != NULL_IFILE && edit_iprev(prev, 0) == 0) return; /* * If can't even open that, we're stuck. Just quit. */ quit(QUIT_ERROR); } + public void +reopen_curr_ifile() +{ + IFILE save_ifile = save_curr_ifile(); + close_file(); + reedit_ifile(save_ifile); +} + /* * Edit standard input. */ public int edit_stdin() { if (isatty(fd0)) { error("Missing filename (\"less --help\" for help)", NULL_PARG); quit(QUIT_OK); } return (edit("-")); } /* * Copy a file directly to standard output. * Used if standard output is not a tty. */ public void cat_file() { register int c; while ((c = ch_forw_get()) != EOI) putchr(c); flush(); } #if LOGFILE /* * If the user asked for a log file and our input file * is standard input, create the log file. * We take care not to blindly overwrite an existing file. */ public void use_logfile(filename) char *filename; { register int exists; register int answer; PARG parg; if (ch_getflags() & CH_CANSEEK) /* * Can't currently use a log file on a file that can seek. */ return; /* * {{ We could use access() here. }} */ filename = shell_unquote(filename); exists = open(filename, OPEN_READ); close(exists); exists = (exists >= 0); /* * Decide whether to overwrite the log file or append to it. * If it doesn't exist we "overwrite" it. */ if (!exists || force_logfile) { /* * Overwrite (or create) the log file. */ answer = 'O'; } else { /* * Ask user what to do. */ parg.p_string = filename; answer = query("Warning: \"%s\" exists; Overwrite, Append or Don't log? ", &parg); } loop: switch (answer) { case 'O': case 'o': /* * Overwrite: create the file. */ logfile = creat(filename, 0644); break; case 'A': case 'a': /* * 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; } break; case 'D': case 'd': /* * Don't do anything. */ free(filename); return; case 'q': quit(QUIT_OK); /*NOTREACHED*/ default: /* * Eh? */ answer = query("Overwrite, Append, or Don't log? (Type \"O\", \"A\", \"D\" or \"q\") ", NULL_PARG); goto loop; } if (logfile < 0) { /* * Error in opening logfile. */ parg.p_string = filename; error("Cannot write to \"%s\"", &parg); free(filename); return; } free(filename); SET_BINARY(logfile); } #endif diff --git a/contrib/less/filename.c b/contrib/less/filename.c index ea3120fbbd89..aa45b764dab5 100644 --- a/contrib/less/filename.c +++ b/contrib/less/filename.c @@ -1,1048 +1,1048 @@ /* * 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. * * For more information about less, or for information on how to * contact the author, see the README file. */ /* * Routines to mess around with filenames (and files). * Much of this is very OS dependent. */ #include "less.h" #include "lglob.h" #if MSDOS_COMPILER #include #if MSDOS_COMPILER==WIN32C && !defined(_MSC_VER) #include #endif #if MSDOS_COMPILER==DJGPPC #include #include #define _MAX_PATH PATH_MAX #endif #endif #ifdef _OSK #include #ifndef _OSK_MWC32 #include #endif #endif #if OS2 #include #endif #if HAVE_STAT #include #ifndef S_ISDIR #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #endif #ifndef S_ISREG #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) #endif #endif extern int force_open; extern int secure; extern int use_lessopen; extern int ctldisp; extern IFILE curr_ifile; extern IFILE old_ifile; #if SPACES_IN_FILENAMES extern char openquote; extern char closequote; #endif /* * Remove quotes around a filename. */ public char * shell_unquote(str) char *str; { char *name; char *p; name = p = (char *) ecalloc(strlen(str)+1, sizeof(char)); if (*str == openquote) { str++; while (*str != '\0') { if (*str == closequote) { if (str[1] != closequote) break; str++; } *p++ = *str++; } } else { char *esc = get_meta_escape(); int esclen = strlen(esc); while (*str != '\0') { if (esclen > 0 && strncmp(str, esc, esclen) == 0) str += esclen; *p++ = *str++; } } *p = '\0'; return (name); } /* * Get the shell's escape character. */ public char * get_meta_escape() { char *s; s = lgetenv("LESSMETAESCAPE"); if (s == NULL) s = DEF_METAESCAPE; return (s); } /* * Get the characters which the shell considers to be "metacharacters". */ static char * metachars() { static char *mchars = NULL; if (mchars == NULL) { mchars = lgetenv("LESSMETACHARS"); if (mchars == NULL) mchars = DEF_METACHARS; } return (mchars); } /* * Is this a shell metacharacter? */ static int metachar(c) char c; { return (strchr(metachars(), c) != NULL); } /* * Insert a backslash before each metacharacter in a string. */ public char * shell_quote(s) char *s; { char *p; char *newstr; int len; char *esc = get_meta_escape(); int esclen = strlen(esc); int use_quotes = 0; int have_quotes = 0; /* * Determine how big a string we need to allocate. */ len = 1; /* Trailing null byte */ for (p = s; *p != '\0'; p++) { len++; if (*p == openquote || *p == closequote) have_quotes = 1; if (metachar(*p)) { if (esclen == 0) { /* * We've got a metachar, but this shell * doesn't support escape chars. Use quotes. */ use_quotes = 1; } else { /* * Allow space for the escape char. */ len += esclen; } } } if (use_quotes) { if (have_quotes) /* * We can't quote a string that contains quotes. */ return (NULL); len = strlen(s) + 3; } /* * Allocate and construct the new string. */ newstr = p = (char *) ecalloc(len, sizeof(char)); if (use_quotes) { SNPRINTF3(newstr, len, "%c%s%c", openquote, s, closequote); } else { while (*s != '\0') { if (metachar(*s)) { /* * Add the escape char. */ strcpy(p, esc); p += esclen; } *p++ = *s++; } *p = '\0'; } return (newstr); } /* * Return a pathname that points to a specified file in a specified directory. * Return NULL if the file does not exist in the directory. */ static char * dirfile(dirname, filename) char *dirname; char *filename; { char *pathname; char *qpathname; int len; int f; if (dirname == NULL || *dirname == '\0') return (NULL); /* * Construct the full pathname. */ len= strlen(dirname) + strlen(filename) + 2; pathname = (char *) calloc(len, sizeof(char)); if (pathname == NULL) return (NULL); SNPRINTF3(pathname, len, "%s%s%s", dirname, PATHNAME_SEP, filename); /* * Make sure the file exists. */ qpathname = shell_unquote(pathname); f = open(qpathname, OPEN_READ); if (f < 0) { free(pathname); pathname = NULL; } else { close(f); } free(qpathname); return (pathname); } /* * Return the full pathname of the given file in the "home directory". */ public char * homefile(filename) char *filename; { register char *pathname; /* * Try $HOME/filename. */ pathname = dirfile(lgetenv("HOME"), filename); if (pathname != NULL) return (pathname); #if OS2 /* * Try $INIT/filename. */ pathname = dirfile(lgetenv("INIT"), filename); if (pathname != NULL) return (pathname); #endif #if MSDOS_COMPILER || OS2 /* * Look for the file anywhere on search path. */ pathname = (char *) calloc(_MAX_PATH, sizeof(char)); #if MSDOS_COMPILER==DJGPPC { char *res = searchpath(filename); if (res == 0) *pathname = '\0'; else strcpy(pathname, res); } #else _searchenv(filename, "PATH", pathname); #endif if (*pathname != '\0') return (pathname); free(pathname); #endif return (NULL); } /* * Expand a string, substituting any "%" with the current filename, * and any "#" with the previous filename. * But a string of N "%"s is just replaced with N-1 "%"s. * Likewise for a string of N "#"s. * {{ This is a lot of work just to support % and #. }} */ public char * fexpand(s) char *s; { register char *fr, *to; register int n; register char *e; IFILE ifile; #define fchar_ifile(c) \ ((c) == '%' ? curr_ifile : \ (c) == '#' ? old_ifile : NULL_IFILE) /* * Make one pass to see how big a buffer we * need to allocate for the expanded string. */ n = 0; for (fr = s; *fr != '\0'; fr++) { switch (*fr) { case '%': case '#': if (fr > s && fr[-1] == *fr) { /* * Second (or later) char in a string * of identical chars. Treat as normal. */ n++; } else if (fr[1] != *fr) { /* * Single char (not repeated). Treat specially. */ ifile = fchar_ifile(*fr); if (ifile == NULL_IFILE) n++; else n += strlen(get_filename(ifile)); } /* * Else it is the first char in a string of * identical chars. Just discard it. */ break; default: n++; break; } } e = (char *) ecalloc(n+1, sizeof(char)); /* * Now copy the string, expanding any "%" or "#". */ to = e; for (fr = s; *fr != '\0'; fr++) { switch (*fr) { case '%': case '#': if (fr > s && fr[-1] == *fr) { *to++ = *fr; } else if (fr[1] != *fr) { ifile = fchar_ifile(*fr); if (ifile == NULL_IFILE) *to++ = *fr; else { strcpy(to, get_filename(ifile)); to += strlen(to); } } break; default: *to++ = *fr; break; } } *to = '\0'; return (e); } #if TAB_COMPLETE_FILENAME /* * Return a blank-separated list of filenames which "complete" * the given string. */ public char * fcomplete(s) char *s; { char *fpat; char *qs; if (secure) return (NULL); /* * Complete the filename "s" by globbing "s*". */ #if MSDOS_COMPILER && (MSDOS_COMPILER == MSOFTC || MSDOS_COMPILER == BORLANDC) /* * But in DOS, we have to glob "s*.*". * But if the final component of the filename already has * a dot in it, just do "s*". * (Thus, "FILE" is globbed as "FILE*.*", * but "FILE.A" is globbed as "FILE.A*"). */ { char *slash; int len; for (slash = s+strlen(s)-1; slash > s; slash--) if (*slash == *PATHNAME_SEP || *slash == '/') break; len = strlen(s) + 4; fpat = (char *) ecalloc(len, sizeof(char)); if (strchr(slash, '.') == NULL) SNPRINTF1(fpat, len, "%s*.*", s); else SNPRINTF1(fpat, len, "%s*", s); } #else { int len = strlen(s) + 2; fpat = (char *) ecalloc(len, sizeof(char)); SNPRINTF1(fpat, len, "%s*", s); } #endif qs = lglob(fpat); s = shell_unquote(qs); if (strcmp(s,fpat) == 0) { /* * The filename didn't expand. */ free(qs); qs = NULL; } free(s); free(fpat); return (qs); } #endif /* * Try to determine if a file is "binary". * This is just a guess, and we need not try too hard to make it accurate. */ public int bin_file(f) int f; { int i; int n; 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++) { 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); } /* * Try to determine the size of a file by seeking to the end. */ static POSITION seek_filesize(f) int 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); } /* * Read a string from a file. * Return a pointer to the string in memory. */ static char * readfd(fd) FILE *fd; { int len; int ch; char *buf; char *p; /* * Make a guess about how many chars in the string * and allocate a buffer to hold it. */ len = 100; buf = (char *) ecalloc(len, sizeof(char)); for (p = buf; ; p++) { if ((ch = getc(fd)) == '\n' || ch == EOF) break; if (p - buf >= len-1) { /* * The string is too big to fit in the buffer we have. * Allocate a new buffer, twice as big. */ len *= 2; *p = '\0'; p = (char *) ecalloc(len, sizeof(char)); strcpy(p, buf); free(buf); buf = p; p = buf + strlen(buf); } *p = ch; } *p = '\0'; return (buf); } #if HAVE_POPEN FILE *popen(); /* * Execute a shell command. * Return a pointer to a pipe connected to the shell command's standard output. */ static FILE * shellcmd(cmd) char *cmd; { FILE *fd; #if HAVE_SHELL char *shell; shell = lgetenv("SHELL"); if (shell != NULL && *shell != '\0') { char *scmd; char *esccmd; /* * Read the output of <$SHELL -c cmd>. * Escape any metacharacters in the command. */ esccmd = shell_quote(cmd); if (esccmd == NULL) { fd = popen(cmd, "r"); } else { 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); } } else #endif { fd = popen(cmd, "r"); } /* * Redirection in `popen' might have messed with the * standard devices. Restore binary input mode. */ SET_BINARY(0); return (fd); } #endif /* HAVE_POPEN */ /* * Expand a filename, doing any system-specific metacharacter substitutions. */ public char * lglob(filename) char *filename; { char *gfilename; char *ofilename; ofilename = fexpand(filename); if (secure) return (ofilename); filename = shell_unquote(ofilename); #ifdef DECL_GLOB_LIST { /* * The globbing function returns a list of names. */ int length; char *p; char *qfilename; DECL_GLOB_LIST(list) GLOB_LIST(filename, list); if (GLOB_LIST_FAILED(list)) { free(filename); return (ofilename); } length = 1; /* Room for trailing null byte */ for (SCAN_GLOB_LIST(list, p)) { INIT_GLOB_LIST(list, p); qfilename = shell_quote(p); if (qfilename != NULL) { length += strlen(qfilename) + 1; free(qfilename); } } gfilename = (char *) ecalloc(length, sizeof(char)); for (SCAN_GLOB_LIST(list, p)) { INIT_GLOB_LIST(list, p); qfilename = shell_quote(p); if (qfilename != NULL) { sprintf(gfilename + strlen(gfilename), "%s ", qfilename); free(qfilename); } } /* * Overwrite the final trailing space with a null terminator. */ *--p = '\0'; GLOB_LIST_DONE(list); } #else #ifdef DECL_GLOB_NAME { /* * The globbing function returns a single name, and * is called multiple times to walk thru all names. */ register char *p; register int len; register int n; char *pathname; char *qpathname; DECL_GLOB_NAME(fnd,drive,dir,fname,ext,handle) GLOB_FIRST_NAME(filename, &fnd, handle); if (GLOB_FIRST_FAILED(handle)) { free(filename); return (ofilename); } _splitpath(filename, drive, dir, fname, ext); len = 100; gfilename = (char *) ecalloc(len, sizeof(char)); p = gfilename; do { n = strlen(drive) + strlen(dir) + strlen(fnd.GLOB_NAME) + 1; pathname = (char *) ecalloc(n, sizeof(char)); SNPRINTF3(pathname, n, "%s%s%s", drive, dir, fnd.GLOB_NAME); qpathname = shell_quote(pathname); free(pathname); if (qpathname != NULL) { n = strlen(qpathname); while (p - gfilename + n + 2 >= len) { /* * No room in current buffer. * Allocate a bigger one. */ len *= 2; *p = '\0'; p = (char *) ecalloc(len, sizeof(char)); strcpy(p, gfilename); free(gfilename); gfilename = p; p = gfilename + strlen(gfilename); } strcpy(p, qpathname); free(qpathname); p += n; *p++ = ' '; } } while (GLOB_NEXT_NAME(handle, &fnd) == 0); /* * Overwrite the final trailing space with a null terminator. */ *--p = '\0'; GLOB_NAME_DONE(handle); } #else #if HAVE_POPEN { /* * We get the shell to glob the filename for us by passing * an "echo" command to the shell and reading its output. */ FILE *fd; char *s; char *lessecho; char *cmd; char *esc; int len; esc = get_meta_escape(); if (strlen(esc) == 0) esc = "-"; esc = shell_quote(esc); if (esc == NULL) { free(filename); return (ofilename); } lessecho = lgetenv("LESSECHO"); if (lessecho == NULL || *lessecho == '\0') lessecho = "lessecho"; /* * Invoke lessecho, and read its output (a globbed list of filenames). */ 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); sprintf(cmd + strlen(cmd), "-- %s", ofilename); fd = shellcmd(cmd); free(cmd); if (fd == NULL) { /* * Cannot create the pipe. * Just return the original (fexpanded) filename. */ free(filename); return (ofilename); } gfilename = readfd(fd); pclose(fd); if (*gfilename == '\0') { free(gfilename); free(filename); return (ofilename); } } #else /* * No globbing functions at all. Just use the fexpanded filename. */ gfilename = save(filename); #endif #endif #endif free(filename); free(ofilename); return (gfilename); } /* * See if we should open a "replacement file" * instead of the file we're about to open. */ public char * open_altfile(filename, pf, pfd) char *filename; int *pf; void **pfd; { #if !HAVE_POPEN return (NULL); #else char *lessopen; char *cmd; int len; FILE *fd; #if HAVE_FILENO int returnfd = 0; #endif if (!use_lessopen || secure) return (NULL); ch_ungetchar(-1); if ((lessopen = lgetenv("LESSOPEN")) == NULL) return (NULL); if (strcmp(filename, "-") == 0) return (NULL); if (*lessopen == '|') { /* * If LESSOPEN starts with a |, it indicates * a "pipe preprocessor". */ #if HAVE_FILENO lessopen++; returnfd = 1; #else error("LESSOPEN pipe is not supported", NULL_PARG); return (NULL); #endif } 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) { /* * Cannot create the pipe. */ return (NULL); } #if HAVE_FILENO if (returnfd) { int f; char c; /* * Read one char to see if the pipe will produce any data. * If it does, push the char back on the pipe. */ f = fileno(fd); SET_BINARY(f); if (read(f, &c, 1) != 1) { /* * Pipe is empty. This means there is no alt file. */ pclose(fd); return (NULL); } ch_ungetchar(c); *pfd = (void *) fd; *pf = f; return (save("-")); } #endif cmd = readfd(fd); pclose(fd); if (*cmd == '\0') /* * Pipe is empty. This means there is no alt file. */ return (NULL); return (cmd); #endif /* HAVE_POPEN */ } /* * Close a replacement file. */ public void close_altfile(altfilename, filename, pipefd) char *altfilename; char *filename; void *pipefd; { #if HAVE_POPEN char *lessclose; FILE *fd; char *cmd; int len; if (secure) return; if (pipefd != NULL) { #if OS2 /* * The pclose function of OS/2 emx sometimes fails. * Send SIGINT to the piped process before closing it. */ kill(((FILE*)pipefd)->_pid, SIGINT); #endif pclose((FILE*) pipefd); } if ((lessclose = lgetenv("LESSCLOSE")) == NULL) return; 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) pclose(fd); #endif } /* * Is the specified file a directory? */ public int is_dir(filename) char *filename; { int isdir = 0; filename = shell_unquote(filename); #if HAVE_STAT { int r; struct stat statbuf; r = stat(filename, &statbuf); isdir = (r >= 0 && S_ISDIR(statbuf.st_mode)); } #else #ifdef _OSK { register int f; f = open(filename, S_IREAD | S_IFDIR); if (f >= 0) close(f); isdir = (f >= 0); } #endif #endif free(filename); return (isdir); } /* * Returns NULL if the file can be opened and * is an ordinary file, otherwise an error message * (if it cannot be opened or is a directory, etc.) */ public char * bad_file(filename) char *filename; { register char *m = NULL; filename = shell_unquote(filename); if (!force_open && is_dir(filename)) { static char is_a_dir[] = " is a directory"; m = (char *) ecalloc(strlen(filename) + sizeof(is_a_dir), sizeof(char)); strcpy(m, filename); strcat(m, is_a_dir); } else { #if HAVE_STAT int r; struct stat statbuf; r = stat(filename, &statbuf); if (r < 0) { m = errno_message(filename); } else if (force_open) { m = NULL; } else if (!S_ISREG(statbuf.st_mode)) { static char not_reg[] = " is not a regular file (use -f to see it)"; m = (char *) ecalloc(strlen(filename) + sizeof(not_reg), sizeof(char)); strcpy(m, filename); strcat(m, not_reg); } #endif } free(filename); return (m); } /* * Return the size of a file, as cheaply as possible. * In Unix, we can stat the file. */ public POSITION filesize(f) int f; { #if HAVE_STAT struct stat statbuf; if (fstat(f, &statbuf) >= 0) return ((POSITION) statbuf.st_size); #else #ifdef _OSK long size; if ((size = (long) _gs_size(f)) >= 0) return ((POSITION) size); #endif #endif return (seek_filesize(f)); } /* * */ public char * shell_coption() { return ("-c"); } diff --git a/contrib/less/funcs.h b/contrib/less/funcs.h index a4a0c7c2d9f0..649598ee48c0 100644 --- a/contrib/less/funcs.h +++ b/contrib/less/funcs.h @@ -1,269 +1,270 @@ public char * save (); public VOID_POINTER ecalloc (); public char * skipsp (); public int sprefix (); public void quit (); public void raw_mode (); public void scrsize (); public char * special_key_str (); public void get_term (); public void init (); public void deinit (); public void home (); public void add_line (); 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 (); public void bell (); public void clear (); public void clear_eol (); public void clear_bot (); 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 match_brac (); public void ch_ungetchar (); public void end_logfile (); public void sync_logfile (); public int ch_seek (); public int ch_end_seek (); public int ch_beg_seek (); public POSITION ch_length (); public POSITION ch_tell (); public int ch_forw_get (); public int ch_back_get (); public void ch_setbufspace (); public void ch_flush (); public int seekable (); public void ch_init (); public void ch_close (); public int ch_getflags (); public void ch_dump (); public void init_charset (); 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 (); public int len_cmdbuf (); public void set_mlist (); public void cmd_addhist (); public void cmd_accept (); 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 (); public void ungetcc (); public void ungetsc (); public void commands (); public void init_cmds (); public void add_fcmd_table (); public void add_ecmd_table (); public int fcmd_decode (); public int ecmd_decode (); public char * lgetenv (); public int lesskey (); public void add_hometable (); public int editchar (); public void init_textlist (); public char * forw_textlist (); public char * back_textlist (); public int edit (); public int edit_ifile (); public int edit_list (); public int edit_first (); public int edit_last (); public int edit_next (); public int edit_prev (); public int edit_index (); 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 (); public char * shell_unquote (); public char * get_meta_escape (); public char * shell_quote (); public char * homefile (); public char * fexpand (); public char * fcomplete (); public int bin_file (); public char * lglob (); public char * open_altfile (); public void close_altfile (); public int is_dir (); public char * bad_file (); public POSITION filesize (); public char * shell_coption (); public void squish_check (); public void forw (); public void back (); public void forward (); public void backward (); public int get_back_scroll (); public void del_ifile (); public IFILE next_ifile (); public IFILE prev_ifile (); public IFILE getoff_ifile (); public int nifile (); public IFILE get_ifile (); public char * get_filename (); public int get_index (); public void store_pos (); public void get_pos (); public void set_open (); public int opened (); public void hold_ifile (); public int held_ifile (); public void * get_filestate (); public void set_filestate (); public void if_dump (); public POSITION forw_line (); public POSITION back_line (); public void set_attnpos (); public void jump_forw (); public void jump_back (); public void repaint (); public void jump_percent (); 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 (); public POSITION forw_raw_line (); public POSITION back_raw_line (); public void clr_linenum (); public void add_lnum (); public LINENUM find_linenum (); public POSITION find_pos (); public LINENUM currline (); public void lsystem (); public int pipe_mark (); public int pipe_data (); public void init_mark (); public int badmark (); public void setmark (); public void lastmark (); public void gomark (); public POSITION markpos (); public void unmark (); 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 (); public void opt_p (); public void opt__P (); public void opt_b (); public void opt_i (); public void opt__V (); public void opt_D (); public void opt_x (); public void opt_quote (); public void opt_query (); public int get_swindow (); public void scan_option (); public void toggle_option (); public int single_char_option (); public char * opt_prompt (); 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 (); public int iread (); public void intread (); public long get_time (); public char * errno_message (); public int percentage (); public POSITION percent_pos (); public int os9_signal (); public void put_line (); public void flush (); public int putchr (); public void putstr (); public void get_return (); public void error (); public void ierror (); public int query (); public POSITION position (); public void add_forw_pos (); public void add_back_pos (); public void pos_clear (); public void pos_init (); public int onscreen (); public int empty_screen (); public int empty_lines (); public void get_scrpos (); public int adjsline (); public void init_prompt (); public char * pr_expand (); public char * eq_message (); public char * pr_string (); public char * wait_message (); public void repaint_hilite (); public void clear_attn (); public void undo_search (); public void clr_hilite (); public int is_hilited (); public void chg_caseless (); public void chg_hilite (); public int search (); public void prep_hilite (); public RETSIGTYPE winch (); public RETSIGTYPE winch (); public void init_signals (); public void psignals (); public void cleantags (); public int gettagtype (); public void findtag (); public POSITION tagsearch (); public char * nexttag (); public char * prevtag (); public int ntags (); public int curr_tag (); public int edit_tagfile (); public void open_getchr (); public void close_getchr (); public int getchr (); diff --git a/contrib/less/less.man b/contrib/less/less.man index 773c7b9ccb51..f9dda92259c0 100644 --- a/contrib/less/less.man +++ b/contrib/less/less.man @@ -1,1547 +1,1557 @@ LESS(1) LESS(1) NAME less - opposite of more 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.) 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 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. 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. 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. 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. ESC-SPACE 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 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. 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. 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 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. 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 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 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. 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). (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. (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, and may contain a decimal point. P Go to the line containing byte offset N in the file. { 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. } 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 brack- ets. ] Like }, but applies to square brackets rather than curly brack- ets. 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. ' (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 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: ^N or ! 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 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, 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 cur- rent screen, but don't move to the first match (KEEP current position). ^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 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 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 command line list. ^F or @ 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. ^R As in forward searches. ESC-/pattern Same as "/*". ESC-?pattern Same as "?*". 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 direction. 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. 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 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 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 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. :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 more details about tags. 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. - 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. -+ 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 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. __ (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. V Prints the version number of less being run. q or Q or :q or :Q or ZZ Exits less. 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 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 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 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. 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. 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 sh: LESS="-options"; export LESS 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 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: LESS="-Dn9.1$-Ds4.1" -? or --help 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 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). -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 is 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 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 file 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. -C or --CLEAR-SCREEN 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 less on a dumb terminal. -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 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 less to automatically exit the first time it reaches end- of-file. -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 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 less to automatically exit if the entire file can be dis- played on the first screen. -g or --hilite-search 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. -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 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 pattern contains uppercase letters. -jn or --jump-target=n 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 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. 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 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 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. -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. -L or --no-lessopen 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 less to prompt verbosely (like more), with the percent into the file. By default, less prompts with a colon. -M or --LONG-PROMPT Causes less to prompt even more verbosely than more. -n or --line-numbers 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 beginning of each line in the display. -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. -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 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. -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. -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. -Q or --QUIET or --SILENT 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, 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 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 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 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. -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. -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 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. 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 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 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 line after any forward movement command larger than one line. -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 continue 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 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. - -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 + 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 + 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- + 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 + 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 + dow to 20 lines. If the screen is resized to 40 lines, the scrolling window automatically changes to 36 lines. -"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 + 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 + 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 + 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. -# or --shift 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 + 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. + --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. + + --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. 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. (The bracketed forms do not work in the MS-DOS version.) Any of these special keys may be entered lit- erally by preceding it with the "literal" character, either ^V or ^A. A backslash itself may also be entered literally by entering two back- slashes. LEFTARROW [ ESC-h ] Move the cursor one space to the left. 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 cur- sor one word to the left. ^RIGHTARROW [ ESC-w or ESC-RIGHTARROW ] (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. END [ ESC-$ ] 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 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. ^DELETE [ ESC-X or ESC-DELETE ] (That is, CONTROL and DELETE simultaneously.) Delete the word under the cursor. UPARROW [ ESC-k ] Retrieve the previous command line. 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 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. ^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 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. 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, 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. 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. 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 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 less view them directly: lessopen.sh: #! /bin/sh case "$1" in *.Z) uncompress - if [ -s /tmp/less.$$ ]; then echo /tmp/less.$$ else rm -f /tmp/less.$$ fi ;; esac lessclose.sh: #! /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. For example, on many Unix systems, this script will work like the pre- vious example scripts: lesspipe.sh: #! /bin/sh case "$1" in *.Z) uncompress -c $1 2>/dev/null ;; 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 "-". 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). binary characters 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: 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. latin1 Same as iso8859. latin9 Same as iso8859. dos Selects a character set appropriate for MS-DOS. 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 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 computers. 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. windows Selects a character set appropriate for Microsoft Windows (cp 1251). In special cases, it may be desired to tailor less to use a character set other than the ones definable by LESSCHARSET. In this case, the environment variable LESSCHARDEF can be used to define a character set. It should be set to a string where each character in the string repre- sents 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 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. ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b 9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b. IBM-1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc 191.b iso8859 8bcccbcc18b95.33b. koi8-r 8bcccbcc18b95.b128. latin1 8bcccbcc18b95.33b. next 8bcccbcc18b95.bb125.bb 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 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 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 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. 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: %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. + 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. %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. %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 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 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. %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. %m Replaced by the total number of input files. %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. %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 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 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. ?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). ?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). ?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. ?m True if there is more than one input file. ?n True if this is the first prompt in a new input file. ?pX True if the percent into the current input file, based on byte offsets, 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). 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 "Stan- dard input". ?f%f .?ltLine %lt:?pt%pt\%:?btByte %bt:-... 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, 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 ?f%f .?n?m(file %i of %m) ..?ltlines %lt-%lb?L/%L. : byte %bB?s/%s. .?e(END) ?x- Next\: %x.:?pB%pB\%..%t And here is the default message produced by the = command: ?f%f .?m(file %i of %m) .?ltlines %lt-%lb?L/%L. . 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 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 variable can be changed to modify this default. 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 | the pipe command :e the examine command. v the editing command s -o log files -k use of lesskey files -t use of tags files metacharacters in filenames, such as * filename completion (TAB, ^L) Less can also be compiled to be permanently in "secure" mode. 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. 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.) 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). HOMEDRIVE, HOMEPATH 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). LANG Language for determining the character set. LC_CTYPE Language for determining the character set. LESS Options which are passed to less automatically. LESSANSIENDCHARS 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. LESSCHARDEF Defines a character set. LESSCHARSET Selects a predefined character set. LESSCLOSE Command line to invoke the (optional) input-postprocessor. LESSECHO 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 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 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. LESSKEY_SYSTEM Name of the default system-wide lesskey(1) file. LESSMETACHARS List of characters which are considered "metacharacters" by the shell. LESSMETAESCAPE 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-preprocessor. LESSSECURE Runs less in "secure" mode. See discussion under SECURITY. LESSSEPARATOR String to be appended to a directory name in filename comple- tion. LESSUTFBINFMT Format for displaying non-printable Unicode code points. LESS_IS_MORE Emulate the more (1) command. 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.) 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. TERM The type of terminal on which less is being run. VISUAL The name of the editor (used for the v command). SEE ALSO lesskey(1) WARNINGS The = command and prompts (unless changed by -P) report the line num- bers 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. On certain older terminals (the so-called "magic cookie" terminals), search highlighting will cause an erroneous display. On such termi- nals, search highlighting is disabled by default to avoid possible problems. When searching in a binary file, text which follows a null byte may not be found. This problem does not occur when searching with regular expressions turned off via ^R, and also does not occur when less is compiled to use the PCRE regular expression library. - In certain cases, when search highlighting is enabled and a search pat- - tern begins with a ^, more text than the matching string may be high- - lighted. (This problem does not occur when less is compiled to use the - POSIX regular expression package.) + 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.) On some systems, setlocale claims that ASCII characters 0 thru 31 are control characters rather than binary characters. This causes 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). This manual is too long. See http://www.greenwoodsoftware.com/less for the latest list of known bugs in less. COPYRIGHT Copyright (C) 1984-2007 Mark Nudelman 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. 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. AUTHOR Mark Nudelman Send bug reports or comments to the above address or to bug-less@gnu.org. For more information, see the less homepage at http://www.greenwoodsoftware.com/less. - Version 409: 12 Oct 2007 LESS(1) + Version 415: 15 Nov 2007 LESS(1) diff --git a/contrib/less/less.nro b/contrib/less/less.nro index 483e194449c6..d2261811c409 100644 --- a/contrib/less/less.nro +++ b/contrib/less/less.nro @@ -1,1676 +1,1689 @@ -.TH LESS 1 "Version 409: 12 Oct 2007" +.TH LESS 1 "Version 415: 15 Nov 2007" .SH NAME less \- opposite of more .SH SYNOPSIS .B "less \-?" .br .B "less \-\-help" .br .B "less \-V" .br .B "less \-\-version" .br .B "less [\-[+]aBcCdeEfFgGiIJKLmMnNqQrRsSuUVwWX~]" .br .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]" .br .B " [\-T \fItagsfile\fP] [\-x \fItab\fP,...] [\-y \fIlines\fP] [\-[z] \fIlines\fP]" .br .B " [\-# \fIshift\fP] [+[+]\fIcmd\fP] [\-\-] [\fIfilename\fP]..." .br (See the OPTIONS section for alternate option syntax with long option names.) .SH DESCRIPTION .I Less is a program similar to .I more (1), but which allows backward movement in the file as well as forward movement. Also, .I 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 .I vi (1). .I 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.) .PP Commands are based on both .I more and .I vi. Commands may be preceded by a decimal number, called N in the descriptions below. The number is used by some commands, as indicated. .SH 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". .IP "h or H" 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). 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" Like SPACE, but if N is specified, it becomes the new window size. .IP "ESC-SPACE" Like SPACE, but scrolls a full screenful, even if it reaches end-of-file in the process. .IP "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. .IP "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. .IP "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. .IP "w" Like ESC-v, but if N is specified, it becomes the new window size. .IP "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. .IP "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. .IP "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 option (chop lines) were in effect. .IP "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. .IP "r or ^R or ^L" Repaint the screen. .IP R Repaint the screen, discarding any buffered input. Useful if the file is changing while it is being viewed. .IP "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.) .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.) .IP "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.) .IP "p or %" Go to a position N percent into the file. 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, 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. .IP "}" 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. .IP "(" Like {, but applies to parentheses rather than curly brackets. .IP ")" Like }, but applies to parentheses rather than curly brackets. .IP "[" Like {, but applies to square brackets rather than curly brackets. .IP "]" Like }, but applies to square brackets rather than curly brackets. .IP "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. .IP "ESC-^B" Followed by two characters, acts like }, but uses the two characters 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. .IP m Followed by any lowercase letter, marks the current position with that letter. .IP "'" (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. .IP "^X^X" Same as single quote. .IP /pattern 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 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). .sp 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: .RS .IP "^N or !" Search for lines which do NOT match the pattern. .IP "^E or *" 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. .IP "^F or @" 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. .IP "^K" Highlight any text which matches the pattern on the current screen, but don't move to the first match (KEEP current position). .IP "^R" Don't interpret regular expression metacharacters; that is, do a simple textual comparison. .RE .IP ?pattern 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. .sp Certain characters are special as in the / command: .RS .IP "^N or !" Search for lines which do NOT match the pattern. .IP "^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 command line list. .IP "^F or @" 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. .IP "^K" As in forward searches. .IP "^R" As in forward searches. .RE .IP "ESC-/pattern" Same as "/*". .IP "ESC-?pattern" Same as "?*". .IP n Repeat previous search, for N-th line containing the last pattern. If the previous search was modified 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. .IP N Repeat previous search, but in the reverse direction. .IP "ESC-n" Repeat previous search, but crossing file boundaries. The effect is as if the previous search were modified by *. .IP "ESC-N" Repeat previous search, but in the reverse direction and crossing file boundaries. .IP "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.) .IP ":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 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). .IP "^X^V or E" Same as :e. Warning: some systems use ^V as a special literalization character. On such systems, you may not be able to use ^V. .IP ":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. .IP ":p" Examine the previous file in the command line list. If a number N is specified, the N-th previous file is examined. .IP ":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. .IP ":d" Remove the current file from the list of files. .IP "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. .IP "T" Go to the previous tag, if there were more than one matches for the current tag. .IP "= 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. .IP \- 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 setting is printed and nothing is changed. .IP \-\- 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. .IP \-+ 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 "\-+\fIX\fP" command does the same thing as "\-+\fIX\fP" on the command line.) This does not work for string-valued options. .IP \-\-+ Like the \-+ command, but takes a long option name rather than a single option letter. .IP \-! 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. .IP \-\-! Like the \-! command, but takes a long option name rather than a single option letter. .IP _ (Underscore.) Followed by one of the command line option letters, this will print a message describing the current setting of that option. The setting of the option is not changed. .IP __ (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. .IP +cmd Causes the specified cmd to be executed each time a new file is examined. For example, +G causes .I less to initially display each file starting at the end rather than the beginning. .IP V Prints the version number of .I less being run. .IP "q or Q or :q or :Q or ZZ" Exits .I less. .PP The following four commands may or may not be valid, depending on your particular installation. .PP .IP 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 LESSEDIT under the section on PROMPTS below. .IP "! 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 environment variable SHELL, or defaults to "sh". On MS-DOS and OS/2 systems, the shell is the normal command processor. .IP "| 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. .IP "s filename" Save the input to a file. This only works if the input is a pipe, not an ordinary file. .PP .SH OPTIONS Command line options are described below. Most options may be changed while .I less is running, via the "\-" command. .PP 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 letter capitalized; the remainder of the name may be in either case. 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 .I less is invoked, you might tell .I csh: .sp setenv LESS "-options" .sp or if you use .I sh: .sp LESS="-options"; export LESS .sp On MS-DOS, you don't need the quotes, but you should replace any percent signs in the options string by double percent signs. .sp 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 "\-+". .sp 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: .sp LESS="-Dn9.1$-Ds4.1" .sp .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" 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" 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 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" 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 erroneous display, since only the most recently viewed part of the file is kept in memory; any earlier data is lost. .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" 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 .I less on a dumb terminal. .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 being set: n=normal, s=standout, d=bold, u=underlined, k=blink. \fIcolor\fP 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 \fIN\fP is the same as \fIN.0\fP. .IP "\-e or \-\-quit-at-eof" Causes .I less to automatically exit 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" Causes .I less to automatically exit the first time it reaches end-of-file. .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. 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" 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 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" 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" 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 the pattern contains uppercase letters. .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 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. 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 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 on the screen. .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" Causes .I less to open and interpret the named file as a .I 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 .I lesskey file. .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. .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" Causes .I less to prompt verbosely (like \fImore\fP), with the percent into the file. By default, .I less prompts with a colon. .IP "\-M or \-\-LONG-PROMPT" Causes .I less to prompt even more verbosely than .I more. .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. 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" 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" Causes .I 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, .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 file without asking for confirmation. .sp If no log file has been specified, 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 .I less. .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" 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 .I less 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. .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 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. .IP "\-Q or \-\-QUIET or \-\-SILENT" Causes totally "quiet" operation: the terminal bell is never rung. .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, .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 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 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 .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. 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" 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, 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 .I ctags (1) or an equivalent command. If the environment variable LESSGLOBALTAGS is set, it is taken to be 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 .I less (using the \- command) as a way of examining a new file. The command ":t" is equivalent to specifying \-t from within .I less. .IP "\-T\fItagsfile\fP or \-\-tag-file=\fItagsfile\fP" Specifies a tags file to be used instead of "tags". .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" Causes backspaces, tabs and carriage returns to be treated as control characters; that is, they are handled as specified by the \-r option. .sp 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. .IP "\-V or \-\-version" Displays the version number of .I less. .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, 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 forward movement command larger than one line. .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 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" 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" 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 screen if desired. By default, any forward movement causes scrolling. .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 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 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" 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). .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" 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 "\-\-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 "+". .IP + If a command line option begins with \fB+\fP, the remainder of that option is taken to be an initial command to .I less. For example, +G tells .I 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 initial command for every file. .SH "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), 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.) 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. .IP "LEFTARROW [ ESC-h ]" Move the cursor one space to the left. .IP "RIGHTARROW [ ESC-l ]" Move the cursor one space to the right. .IP "^LEFTARROW [ ESC-b or ESC-LEFTARROW ]" (That is, CONTROL and LEFTARROW simultaneously.) Move the cursor one word to the left. .IP "^RIGHTARROW [ ESC-w or ESC-RIGHTARROW ]" (That is, CONTROL and RIGHTARROW simultaneously.) Move the cursor one word to the right. .IP "HOME [ ESC-0 ]" Move the cursor to the beginning of the line. .IP "END [ ESC-$ ]" Move the cursor to the end of the line. .IP "BACKSPACE" Delete the character to the left of the cursor, or cancel the command if the command line is empty. .IP "DELETE or [ ESC-x ]" Delete the character under the cursor. .IP "^BACKSPACE [ ESC-BACKSPACE ]" (That is, CONTROL and BACKSPACE simultaneously.) Delete the word to the left of the cursor. .IP "^DELETE [ ESC-X or ESC-DELETE ]" (That is, CONTROL and DELETE simultaneously.) Delete the word under the cursor. .IP "UPARROW [ ESC-k ]" Retrieve the previous command line. .IP "DOWNARROW [ ESC-j ]" Retrieve the next command line. .IP "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 "\e" is appended.) The environment variable LESSSEPARATOR can be used to specify a different character to append to a directory name. .IP "BACKTAB [ ESC-TAB ]" Like, TAB, but cycles in the reverse direction thru the matching filenames. .IP "^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). .IP "^U (Unix and OS/2) or ESC (MS-DOS)" Delete the entire command line, or cancel the command if the command line is empty. If you have changed your line-kill character in Unix to something other than ^U, that character is used instead of ^U. .SH "KEY BINDINGS" You may define your own .I less commands by using the program .I 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 .I lesskey to change the line-editing keys (see LINE EDITING), and to set environment variables. If the environment variable LESSKEY is set, .I less uses that as the name of the lesskey file. Otherwise, .I less looks in a standard place for the lesskey file: On Unix systems, .I less looks for a lesskey file called "$HOME/.less". On MS-DOS and Windows systems, .I 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, .I 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 .I lesskey manual page for more details. .P 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, .I less uses that as the name of the system-wide lesskey file. Otherwise, .I 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 .I 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:\e_sysless. On OS/2 systems, the system-wide lesskey file is c:\esysless.ini. .SH "INPUT PREPROCESSOR" You may define an "input preprocessor" for .I less. Before .I 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 simply an executable 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, .I less will display the original filename as the name of the current file. .PP 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 filename, .I less 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 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. .PP When .I less 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 original name of the file and the second with the name of the replacement file, which was output by LESSOPEN. .PP For example, on many Unix systems, these two scripts will allow you to keep files in compressed format, but still let .I less view them directly: .PP lessopen.sh: .br #! /bin/sh .br case "$1" in .br *.Z) uncompress -\c $1 >/tmp/less.$$ 2>/dev/null .br if [ \-s /tmp/less.$$ ]; then .br echo /tmp/less.$$ .br else .br rm \-f /tmp/less.$$ .br fi .br ;; .br esac .PP lessclose.sh: .br #! /bin/sh .br rm $2 .PP 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. .PP It is also possible to set up an input preprocessor to pipe the file data directly to .I less, 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 .I 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. .PP For example, on many Unix systems, this script will work like the previous example scripts: .PP lesspipe.sh: .br #! /bin/sh .br case "$1" in .br *.Z) uncompress \-c $1 2>/dev/null .br ;; .br esac .br .PP 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 "\-". .SH "NATIONAL CHARACTER SETS" There are three types of characters in the input file: .IP "normal characters" can be displayed directly to the screen. .IP "control characters" should not be displayed directly, but are expected to be found in ordinary text files (such as backspace and tab). .IP "binary characters" should not be displayed directly and are not expected to be found in text files. .PP 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: .IP 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. .IP iso8859 Selects an ISO 8859 character set. This is the same as ASCII, except characters between 160 and 255 are treated as normal characters. .IP latin1 Same as iso8859. .IP latin9 Same as iso8859. .IP dos Selects a character set appropriate for MS-DOS. .IP ebcdic Selects an EBCDIC character set. .IP 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 LESSCHARSET=IBM-1047 or LC_CTYPE=en_US in your environment. .IP koi8-r Selects a Russian character set. .IP next 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 .I less to use a character set other than the ones definable by LESSCHARSET. In this case, the environment 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 number 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 character set.) .PP This table shows the value of LESSCHARDEF which is equivalent to each of the possible values for LESSCHARSET: .sp ascii\ 8bcccbcc18b95.b .br dos\ \ \ 8bcccbcc12bc5b95.b. .br ebcdic 5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b .br \ \ \ \ \ \ 9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b. .br IBM-1047 4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc .br \ \ \ \ \ \ 191.b .br iso8859 8bcccbcc18b95.33b. .br koi8-r 8bcccbcc18b95.b128. .br latin1 8bcccbcc18b95.33b. .br next\ \ 8bcccbcc18b95.bb125.bb .PP 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. .PP If that string is not found, but your system supports the .I setlocale interface, .I less will use setlocale to determine the character set. setlocale is controlled by setting the LANG or LC_CTYPE environment variables. .PP Finally, if the .I setlocale interface is also not available, the default character set is latin1. .PP 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 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 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. 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 personalized prompt strings. .sp A percent sign followed by a single character is expanded according to what the following character is: .IP "%b\fIX\fP" Replaced by the byte offset into the current input file. The b is followed by a single character (shown as \fIX\fP 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. .IP "%B" Replaced by the size of the current input file. .IP "%c" Replaced by the column number of the text appearing in the first column of the screen. .IP "%d\fIX\fP" Replaced by the page number of a line in the input file. The line to be used is determined by the \fIX\fP, as with the %b option. .IP "%D" Replaced by the number of pages in the input file, or equivalently, the page number of the last line in the input file. .IP "%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. .IP "%f" Replaced by the name of the current input file. .IP "%i" Replaced by the index of the current file in the list of input files. .IP "%l\fIX\fP" Replaced by the line number of a line in the input file. The line to be used is determined by the \fIX\fP, as with the %b option. .IP "%L" Replaced by the line number of the last line in the input file. .IP "%m" Replaced by the total number of input files. .IP "%p\fIX\fP" Replaced by the percent into the current input file, based on byte offsets. The line used is determined by the \fIX\fP as with the %b option. .IP "%P\fIX\fP" Replaced by the percent into the current input file, based on line numbers. The line used is determined by the \fIX\fP as with the %b option. .IP "%s" Same as %B. .IP "%t" Causes any trailing spaces to be removed. Usually used at the end of the string, but may appear anywhere. .IP "%x" Replaced by the name of the next input file in the list. .PP If any item is unknown (for example, the file size if input is a pipe), a question mark is printed instead. .PP 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 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: .IP "?a" True if any characters have been included in the prompt so far. .IP "?b\fIX\fP" True if the byte offset of the specified line is known. .IP "?B" True if the size of current input file is known. .IP "?c" True if the text is horizontally shifted (%c is not zero). .IP "?d\fIX\fP" True if the page number of the specified line is known. .IP "?e" True if at end-of-file. .IP "?f" True if there is an input filename (that is, if input is not a pipe). .IP "?l\fIX\fP" True if the line number of the specified line is known. .IP "?L" True if the line number of the last line in the file is known. .IP "?m" True if there is more than one input file. .IP "?n" True if this is the first prompt in a new input file. .IP "?p\fIX\fP" True if the percent into the current input file, based on byte offsets, of the specified line is known. .IP "?P\fIX\fP" True if the percent into the current input file, based on line numbers, of the specified line is known. .IP "?s" Same as "?B". .IP "?x" True if there is a next input file (that is, if the current input file is not the last one). .PP 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. .PP Some examples: .sp ?f%f:Standard input. .sp This prompt prints the filename, if known; otherwise the string "Standard input". .sp ?f%f .?ltLine %lt:?pt%pt\e%:?btByte %bt:-... .sp This prompt would print the filename, if known. The filename 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. .sp ?n?f%f\ .?m(file\ %i\ of\ %m)\ ..?e(END)\ ?x-\ Next\e:\ %x..%t .sp 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 reference, here are the defaults for the other two prompts (\-m and \-M respectively). Each is broken into two lines here for readability only. .nf .sp ?n?f%f\ .?m(file\ %i\ of\ %m)\ ..?e(END)\ ?x-\ Next\e:\ %x.: ?pB%pB\e%:byte\ %bB?s/%s...%t .sp ?f%f\ .?n?m(file\ %i\ of\ %m)\ ..?ltlines\ %lt-%lb?L/%L.\ : byte\ %bB?s/%s.\ .?e(END)\ ?x-\ Next\e:\ %x.:?pB%pB\e%..%t .sp .fi And here is the default message produced by the = command: .nf .sp ?f%f\ .?m(file\ %i\ of\ %m)\ .?ltlines\ %lt-%lb?L/%L.\ . byte\ %bB?s/%s.\ ?e(END)\ :?pB%pB\e%..%t .fi .PP 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: .nf .sp %E\ ?lm+%lm.\ %f .sp .fi 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. .SH SECURITY When the environment variable LESSSECURE is set to 1, .I less runs in a "secure" mode. This means these features are disabled: .RS .IP "!" the shell command .IP "|" the pipe command .IP ":e" the examine command. .IP "v" the editing command .IP "s \-o" log files .IP "\-k" use of lesskey files .IP "\-t" use of tags files .IP " " metacharacters in filenames, such as * .IP " " filename completion (TAB, ^L) .RE .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 .I 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. .IP 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.) .IP EDITOR The name of the editor (used for the v command). .IP HOME Name of the user's home directory (used to find a lesskey file on Unix and OS/2 systems). .IP "HOMEDRIVE, HOMEPATH" Concatenation of the HOMEDRIVE and HOMEPATH environment variables is the name of the user's home directory if the HOME variable is not set (only in the Windows version). .IP INIT Name of the user's init directory (used to find a lesskey file on OS/2 systems). .IP LANG Language for determining the character set. .IP LC_CTYPE Language for determining the character set. .IP LESS Options which are passed to .I less automatically. .IP LESSANSIENDCHARS 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 Defines a character set. .IP LESSCHARSET Selects a predefined character set. .IP LESSCLOSE Command line to invoke the (optional) input-postprocessor. .IP LESSECHO Name of the lessecho program (default "lessecho"). The lessecho program is needed to expand metacharacters, such as * and ?, in filenames on Unix systems. .IP LESSEDIT 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. 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 Name of the default system-wide lesskey(1) file. .IP LESSMETACHARS List of characters which are considered "metacharacters" by the shell. .IP LESSMETAESCAPE Prefix which less will add before each metacharacter in a command sent to the shell. If LESSMETAESCAPE is an empty string, commands containing metacharacters will not be passed to the shell. .IP LESSOPEN Command line to invoke the (optional) input-preprocessor. .IP LESSSECURE 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. (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.) .IP PATH User's search path (used to find a lesskey file on MS-DOS and OS/2 systems). .IP SHELL The shell used to execute the ! command, as well as to expand filenames. .IP TERM The type of terminal on which .I less is being run. .IP VISUAL 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 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 When searching in a binary file, text which follows a null byte may not be found. This problem does not occur when searching with regular expressions turned off via ^R, and also does not occur when .I less is compiled to use the PCRE regular expression library. .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 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 This manual is too long. .PP See http://www.greenwoodsoftware.com/less for the latest list of known bugs in less. .SH COPYRIGHT 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 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 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. .PP less 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. .SH AUTHOR .PP Mark Nudelman .br 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/contrib/less/lessecho.man b/contrib/less/lessecho.man index 588f70aaaa0d..98bbf677c351 100644 --- a/contrib/less/lessecho.man +++ b/contrib/less/lessecho.man @@ -1,49 +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 409: 12 Oct 2007 LESSECHO(1) + Version 415: 15 Nov 2007 LESSECHO(1) diff --git a/contrib/less/lessecho.nro b/contrib/less/lessecho.nro index d9dd628cb041..d31b83d05495 100644 --- a/contrib/less/lessecho.nro +++ b/contrib/less/lessecho.nro @@ -1,47 +1,47 @@ -.TH LESSECHO 1 "Version 409: 12 Oct 2007" +.TH LESSECHO 1 "Version 415: 15 Nov 2007" .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/contrib/less/lesskey.man b/contrib/less/lesskey.man index f951ea4e5c5c..8f77d55cda53 100644 --- a/contrib/less/lesskey.man +++ b/contrib/less/lesskey.man @@ -1,360 +1,360 @@ LESSKEY(1) LESSKEY(1) NAME lesskey - specify key bindings for less SYNOPSIS lesskey [-o output] [--] [input] lesskey [--output=output] [--] [input] lesskey -V lesskey --version 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 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 sections. Each section starts with a line that identifies the type of section. Possible sections are: #command Defines new command keys. #line-edit Defines new line-editing keys. #env Defines environment variables. Blank lines and lines which start with a pound sign (#) are ignored, except for the special section header lines. 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] 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 \e ESCAPE \n NEWLINE \r RETURN \t TAB \ku UP ARROW \kd DOWN ARROW \kr RIGHT ARROW \kl LEFT ARROW \kU PAGE UP \kD PAGE DOWN \kh HOME \ke END \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. 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. EXAMPLE The following input file describes the set of default command keys used by less: #command \r forw-line \n forw-line e forw-line j forw-line \kd forw-line ^E forw-line ^N forw-line k back-line y back-line ^Y back-line ^K back-line ^P back-line J forw-line-force K back-line-force Y back-line-force d forw-scroll ^D forw-scroll u back-scroll ^U back-scroll \40 forw-screen f forw-screen ^F forw-screen ^V forw-screen \kD forw-screen b back-screen ^B back-screen \ev back-screen \kU back-screen z forw-window w back-window \e\40 forw-screen-force F forw-forever R repaint-flush r repaint ^R repaint ^L repaint \eu undo-hilite g goto-line \kh goto-line < goto-line \e< goto-line p percent % percent \e[ left-scroll \e] right-scroll \e( left-scroll \e) right-scroll { forw-bracket {} } back-bracket {} ( forw-bracket () ) back-bracket () [ forw-bracket [] ] back-bracket [] \e^F forw-bracket \e^B back-bracket G goto-end \e> goto-end > goto-end \ke goto-end = status ^G status :f status / forw-search ? back-search \e/ forw-search * \e? back-search * n repeat-search \en repeat-search-all N reverse-search \eN reverse-search-all m set-mark ' goto-mark ^X^X goto-mark E examine :e examine ^X^V examine :n next-file :p prev-file t next-tag T prev-tag :x index-file :d remove-file - toggle-option :t toggle-option t s toggle-option o _ display-option | pipe v visual ! shell + firstcmd H help h help V version 0 digit 1 digit 2 digit 3 digit 4 digit 5 digit 6 digit 7 digit 8 digit 9 digit q quit Q quit :q quit :Q quit ZZ quit 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. 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. LINE EDITING SECTION The line-editing section begins with the line: #line-edit 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. EXAMPLE The following input file describes the set of default line-editing keys used by less: #line-edit \t forw-complete \17 back-complete \e\t back-complete ^L expand ^V literal ^A literal \el right \kr right \eh left \kl left \eb word-left \e\kl word-left \ew word-right \e\kr word-right \ei insert \ex delete \kx delete \eX word-delete \ekx word-delete \e\b word-backspace \e0 home \kh home \e$ end \ke end \ek up \ku up \ej down 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 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. EXAMPLE The following input file sets the -i option whenever less is run, and specifies the character set to be "latin1": #env LESS = -i LESSCHARSET = latin1 SEE ALSO less(1) 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. COPYRIGHT Copyright (C) 2000-2007 Mark Nudelman 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 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. AUTHOR Mark Nudelman Send bug reports or comments to the above address or to bug- less@gnu.org. - Version 409: 12 Oct 2007 LESSKEY(1) + Version 415: 15 Nov 2007 LESSKEY(1) diff --git a/contrib/less/lesskey.nro b/contrib/less/lesskey.nro index afc358694300..a757bab7efad 100644 --- a/contrib/less/lesskey.nro +++ b/contrib/less/lesskey.nro @@ -1,384 +1,384 @@ -.TH LESSKEY 1 "Version 409: 12 Oct 2007" +.TH LESSKEY 1 "Version 415: 15 Nov 2007" .SH NAME lesskey \- specify key bindings for less .SH SYNOPSIS .B "lesskey [-o output] [--] [input]" .br .B "lesskey [--output=output] [--] [input]" .br .B "lesskey -V" .br .B "lesskey --version" .SH DESCRIPTION .I Lesskey is used to specify a set of key bindings to be used by .I 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 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 .I 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, .I lesskey will overwrite it. .PP The -V or --version option causes .I lesskey to print its version number and immediately exit. If -V or --version is present, other options and arguments are ignored. .PP The input file consists of one or more .I sections. Each section starts with a line that identifies the type of section. Possible sections are: .IP #command Defines new command keys. .IP #line-edit Defines new line-editing keys. .IP #env Defines environment variables. .PP Blank lines and lines which start with a pound sign (#) are ignored, except for the special section header lines. .SH "COMMAND SECTION" The command section begins with the line .sp #command .sp 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: .sp \fIstring\fP \fIaction\fP [extra-string] .sp Whitespace is any sequence of one or more spaces and/or tabs. The \fIstring\fP is the command key(s) which invoke the action. The \fIstring\fP may be a single command key, or a sequence of up to 15 keys. The \fIaction\fP is the name of the less action, from the list below. The characters in the \fIstring\fP 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 characters specifies input characters as follows: .IP \eb BACKSPACE .IP \ee ESCAPE .IP \en NEWLINE .IP \er RETURN .IP \et TAB .IP \eku UP ARROW .IP \ekd DOWN ARROW .IP \ekr RIGHT ARROW .IP \ekl LEFT ARROW .IP \ekU PAGE UP .IP \ekD PAGE DOWN .IP \ekh HOME .IP \eke END .IP \ekx DELETE .PP 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. .PP An action may be followed by an "extra" string. When such a command is entered while running .I less, the action is performed, and then the extra string is parsed, just as if it were typed in to .I 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 .I less quits, first character of the extra string is used as its exit status. .SH EXAMPLE The following input file describes the set of default command keys used by less: .sp .nf #command \er forw-line \en forw-line e forw-line j forw-line \ekd forw-line ^E forw-line ^N forw-line k back-line y back-line ^Y back-line ^K back-line ^P back-line J forw-line-force K back-line-force Y back-line-force d forw-scroll ^D forw-scroll u back-scroll ^U back-scroll \e40 forw-screen f forw-screen ^F forw-screen ^V forw-screen \ekD forw-screen b back-screen ^B back-screen \eev back-screen \ekU back-screen z forw-window w back-window \ee\e40 forw-screen-force F forw-forever R repaint-flush r repaint ^R repaint ^L repaint \eeu undo-hilite g goto-line \ekh goto-line < goto-line \ee< goto-line p percent % percent \ee[ left-scroll \ee] right-scroll \ee( left-scroll \ee) right-scroll { forw-bracket {} } back-bracket {} ( forw-bracket () ) back-bracket () [ forw-bracket [] ] back-bracket [] \ee^F forw-bracket \ee^B back-bracket G goto-end \ee> goto-end > goto-end \eke goto-end = status ^G status :f status / forw-search ? back-search \ee/ forw-search * \ee? back-search * n repeat-search \een repeat-search-all N reverse-search \eeN reverse-search-all m set-mark ' goto-mark ^X^X goto-mark E examine :e examine ^X^V examine :n next-file :p prev-file t next-tag T prev-tag :x index-file :d remove-file - toggle-option :t toggle-option t s toggle-option o _ display-option | pipe v visual ! shell + firstcmd H help h help V version 0 digit 1 digit 2 digit 3 digit 4 digit 5 digit 6 digit 7 digit 8 digit 9 digit q quit Q quit :q quit :Q quit ZZ quit .fi .sp .SH PRECEDENCE Commands specified by .I lesskey 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 .I 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: .sp #stop .sp This will cause all default commands to be ignored. The #stop line should be the last line in that section of the file. .PP 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. .SH "LINE EDITING SECTION" The line-editing section begins with the line: .sp #line-edit .sp 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. .SH EXAMPLE The following input file describes the set of default line-editing keys used by less: .sp .nf #line-edit \et forw-complete \e17 back-complete \ee\et back-complete ^L expand ^V literal ^A literal \eel right \ekr right \eeh left \ekl left \eeb word-left \ee\ekl word-left \eew word-right \ee\ekr word-right \eei insert \eex delete \ekx delete \eeX word-delete \eekx word-delete \ee\eb word-backspace \ee0 home \ekh home \ee$ end \eke end \eek up \eku up \eej down .fi .sp .SH "LESS ENVIRONMENT VARIABLES" The environment variable section begins with the line .sp #env .sp 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 .I 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 override variables set in the environment, the main purpose of assigning variables in the lesskey file is simply to have all .I less configuration information stored in one file. .SH EXAMPLE The following input file sets the -i option whenever .I less is run, and specifies the character set to be "latin1": .sp .nf #env LESS = -i LESSCHARSET = latin1 .fi .sp .SH "SEE ALSO" less(1) .SH WARNINGS It is not possible to specify special keys, such as uparrow, 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. .PP 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 \e340 in a lesskey file. .SH COPYRIGHT 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 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. .PP 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. .PP 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. .SH AUTHOR .PP Mark Nudelman .br Send bug reports or comments to the above address or to bug-less@gnu.org. diff --git a/contrib/less/optfunc.c b/contrib/less/optfunc.c index 4ca514297c95..f296b79368ab 100644 --- a/contrib/less/optfunc.c +++ b/contrib/less/optfunc.c @@ -1,668 +1,668 @@ /* * 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. * * For more information about less, or for information on how to * contact the author, see the README file. */ /* * Handling functions for command line options. * * Most options are handled by the generic code in option.c. * But all string options, and a few non-string options, require * special handling specific to the particular option. * This special processing is done by the "handling functions" in this file. * * Each handling function is passed a "type" and, if it is a string * option, the string which should be "assigned" to the option. * The type may be one of: * INIT The option is being initialized from the command line. * TOGGLE The option is being changed from within the program. * QUERY The setting of the option is merely being queried. */ #include "less.h" #include "option.h" extern int nbufs; extern int bufspace; extern int pr_type; extern int plusoption; extern int swindow; extern int sc_height; extern int secure; extern int dohelp; extern int any_display; extern char openquote; extern char closequote; extern char *prproto[]; extern char *eqproto; 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; extern int logfile; #endif #if TAGS public char *tagoption = NULL; extern char *tags; #endif #if MSDOS_COMPILER extern int nm_fg_color, nm_bg_color; extern int bo_fg_color, bo_bg_color; extern int ul_fg_color, ul_bg_color; extern int so_fg_color, so_bg_color; extern int bl_fg_color, bl_bg_color; #endif #if LOGFILE /* * Handler for -o option. */ public void opt_o(type, s) int type; char *s; { PARG parg; if (secure) { error("log file support is not available", NULL_PARG); return; } switch (type) { case INIT: namelogfile = s; break; case TOGGLE: if (ch_getflags() & CH_CANSEEK) { error("Input is not a pipe", NULL_PARG); return; } if (logfile >= 0) { error("Log file is already in use", NULL_PARG); return; } s = skipsp(s); namelogfile = lglob(s); use_logfile(namelogfile); sync_logfile(); break; case QUERY: if (logfile < 0) error("No log file", NULL_PARG); else { parg.p_string = namelogfile; error("Log file \"%s\"", &parg); } break; } } /* * Handler for -O option. */ public void opt__O(type, s) int type; char *s; { force_logfile = TRUE; opt_o(type, s); } #endif /* * Handlers for -l option. */ public void opt_l(type, s) int type; char *s; { int err; int n; char *t; switch (type) { case INIT: t = s; n = getnum(&t, "l", &err); if (err || n <= 0) { error("Line number is required after -l", NULL_PARG); return; } plusoption = TRUE; ungetsc(s); break; } } /* * 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) int type; char *s; { PARG parg; switch (type) { case INIT: if (lesskey(s, 0)) { parg.p_string = s; error("Cannot use lesskey file \"%s\"", &parg); } break; } } #endif #if TAGS /* * Handler for -t option. */ public void opt_t(type, s) int type; char *s; { IFILE save_ifile; POSITION pos; switch (type) { case INIT: tagoption = s; /* Do the rest in main() */ break; case TOGGLE: if (secure) { error("tags support is not available", NULL_PARG); break; } findtag(skipsp(s)); save_ifile = save_curr_ifile(); /* * 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; } unsave_ifile(save_ifile); jump_loc(pos, jump_sline); break; } } /* * Handler for -T option. */ public void opt__T(type, s) int type; char *s; { PARG parg; switch (type) { case INIT: tags = s; break; case TOGGLE: s = skipsp(s); tags = lglob(s); break; case QUERY: parg.p_string = tags; error("Tags file \"%s\"", &parg); break; } } #endif /* * Handler for -p option. */ public void opt_p(type, s) int type; register char *s; { switch (type) { case INIT: /* * Unget a search command for the specified string. * {{ This won't work if the "/" command is * changed or invalidated by a .lesskey file. }} */ plusoption = TRUE; ungetsc(s); /* * 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; } } /* * Handler for -P option. */ public void opt__P(type, s) int type; register char *s; { register char **proto; PARG parg; switch (type) { case INIT: case TOGGLE: /* * Figure out which prototype string should be changed. */ switch (*s) { case 's': proto = &prproto[PR_SHORT]; s++; break; case 'm': proto = &prproto[PR_MEDIUM]; s++; break; case 'M': proto = &prproto[PR_LONG]; s++; break; case '=': proto = &eqproto; s++; break; case 'h': proto = &hproto; s++; break; case 'w': proto = &wproto; s++; break; default: proto = &prproto[PR_SHORT]; break; } free(*proto); *proto = save(s); break; case QUERY: parg.p_string = prproto[pr_type]; error("%s", &parg); break; } } /* * Handler for the -b option. */ /*ARGSUSED*/ public void opt_b(type, s) int type; char *s; { switch (type) { case INIT: case TOGGLE: /* * Set the new number of buffers. */ ch_setbufspace(bufspace); break; case QUERY: break; } } /* * Handler for the -i option. */ /*ARGSUSED*/ public void opt_i(type, s) int type; char *s; { switch (type) { case TOGGLE: chg_caseless(); break; case QUERY: case INIT: break; } } /* * Handler for the -V option. */ /*ARGSUSED*/ public void opt__V(type, s) int type; char *s; { switch (type) { case TOGGLE: case QUERY: dispversion(); break; case INIT: /* * Force output to stdout per GNU standard for --version output. */ any_display = 1; putstr("less "); putstr(version); - putstr("\nCopyright (C) 1984-2005 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"); putstr("Homepage: http://www.greenwoodsoftware.com/less\n"); quit(QUIT_OK); break; } } #if MSDOS_COMPILER /* * Parse an MSDOS color descriptor. */ static void colordesc(s, fg_color, bg_color) char *s; int *fg_color; int *bg_color; { int fg, bg; int err; fg = getnum(&s, "D", &err); if (err) { error("Missing fg color in -D", NULL_PARG); return; } if (*s != '.') bg = 0; else { s++; bg = getnum(&s, "D", &err); if (err) { error("Missing fg color in -D", NULL_PARG); return; } } if (*s != '\0') error("Extra characters at end of -D option", NULL_PARG); *fg_color = fg; *bg_color = bg; } /* * Handler for the -D option. */ /*ARGSUSED*/ public void opt_D(type, s) int type; char *s; { switch (type) { case INIT: case TOGGLE: switch (*s++) { case 'n': colordesc(s, &nm_fg_color, &nm_bg_color); break; case 'd': colordesc(s, &bo_fg_color, &bo_bg_color); break; case 'u': colordesc(s, &ul_fg_color, &ul_bg_color); break; case 'k': colordesc(s, &bl_fg_color, &bl_bg_color); break; case 's': colordesc(s, &so_fg_color, &so_bg_color); break; default: error("-D must be followed by n, d, u, k or s", NULL_PARG); break; } if (type == TOGGLE) { at_enter(AT_STANDOUT); at_exit(); } break; case QUERY: break; } } #endif /* * Handler for the -x option. */ public void opt_x(type, s) int type; register char *s; { extern int tabstops[]; extern int ntabstops; extern int tabdefault; char msg[60+(4*TABSTOP_MAX)]; int i; PARG p; switch (type) { case INIT: case TOGGLE: /* Start at 1 because tabstops[0] is always zero. */ for (i = 1; i < TABSTOP_MAX; ) { int n = 0; s = skipsp(s); while (*s >= '0' && *s <= '9') n = (10 * n) + (*s++ - '0'); if (n > tabstops[i-1]) tabstops[i++] = n; s = skipsp(s); if (*s++ != ',') break; } if (i < 2) return; ntabstops = i; tabdefault = tabstops[ntabstops-1] - tabstops[ntabstops-2]; break; case QUERY: strcpy(msg, "Tab stops "); if (ntabstops > 2) { for (i = 1; i < ntabstops; i++) { if (i > 1) strcat(msg, ","); sprintf(msg+strlen(msg), "%d", tabstops[i]); } sprintf(msg+strlen(msg), " and then "); } sprintf(msg+strlen(msg), "every %d spaces", tabdefault); p.p_string = msg; error("%s", &p); break; } } /* * Handler for the -" option. */ public void opt_quote(type, s) int type; register char *s; { char buf[3]; PARG parg; switch (type) { case INIT: case TOGGLE: if (s[0] == '\0') { openquote = closequote = '\0'; break; } if (s[1] != '\0' && s[2] != '\0') { error("-\" must be followed by 1 or 2 chars", NULL_PARG); return; } openquote = s[0]; if (s[1] == '\0') closequote = openquote; else closequote = s[1]; break; case QUERY: buf[0] = openquote; buf[1] = closequote; buf[2] = '\0'; parg.p_string = buf; error("quotes %s", &parg); break; } } /* * "-?" means display a help message. * If from the command line, exit immediately. */ /*ARGSUSED*/ public void opt_query(type, s) int type; char *s; { switch (type) { case QUERY: case TOGGLE: error("Use \"h\" for help", NULL_PARG); break; case INIT: dohelp = 1; } } /* * Get the "screen window" size. */ public int get_swindow() { if (swindow > 0) return (swindow); return (sc_height + swindow); } diff --git a/contrib/less/opttbl.c b/contrib/less/opttbl.c index 2514463ea6e9..755a93d72ae6 100644 --- a/contrib/less/opttbl.c +++ b/contrib/less/opttbl.c @@ -1,592 +1,602 @@ /* * 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. * * For more information about less, or for information on how to * contact the author, see the README file. */ /* * The option table. */ #include "less.h" #include "option.h" /* * Variables controlled by command line options. */ public int quiet; /* Should we suppress the audible bell? */ public int how_search; /* Where should forward searches start? */ public int top_scroll; /* Repaint screen from top? (alternative is scroll from bottom) */ public int pr_type; /* Type of prompt (short, medium, long) */ public int bs_mode; /* How to process backspaces */ public int know_dumb; /* Don't complain about dumb terminals */ public int quit_at_eof; /* Quit after hitting end of file twice */ public int quit_if_one_screen; /* Quit if EOF on first screen */ public int squeeze; /* Squeeze multiple blank lines into one */ public int tabstop; /* Tab settings */ public int back_scroll; /* Repaint screen on backwards movement */ public int forw_scroll; /* Repaint screen on forward movement */ public int caseless; /* Do "caseless" searches */ public int linenums; /* Use line numbers */ public int autobuf; /* Automatically allocate buffers as needed */ public int bufspace; /* Max buffer space per file (K) */ 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 */ public int twiddle; /* Show tildes after EOF */ 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 oldbot; /* Old bottom of screen behavior */ +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. */ static struct optname a_optname = { "search-skip-screen", NULL }; static struct optname b_optname = { "buffers", NULL }; static struct optname B__optname = { "auto-buffers", NULL }; static struct optname c_optname = { "clear-screen", NULL }; static struct optname d_optname = { "dumb", NULL }; #if MSDOS_COMPILER static struct optname D__optname = { "color", NULL }; #endif static struct optname e_optname = { "quit-at-eof", NULL }; static struct optname f_optname = { "force", NULL }; static struct optname F__optname = { "quit-if-one-screen", NULL }; #if HILITE_SEARCH static struct optname g_optname = { "hilite-search", NULL }; #endif static struct optname h_optname = { "max-back-scroll", NULL }; static struct optname i_optname = { "ignore-case", NULL }; static struct optname j_optname = { "jump-target", NULL }; 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 }; #if LOGFILE static struct optname o_optname = { "log-file", NULL }; static struct optname O__optname = { "LOG-FILE", NULL }; #endif static struct optname p_optname = { "pattern", NULL }; static struct optname P__optname = { "prompt", NULL }; static struct optname q2_optname = { "silent", NULL }; static struct optname q_optname = { "quiet", &q2_optname }; static struct optname r_optname = { "raw-control-chars", NULL }; static struct optname s_optname = { "squeeze-blank-lines", NULL }; static struct optname S__optname = { "chop-long-lines", NULL }; #if TAGS static struct optname t_optname = { "tag", NULL }; static struct optname T__optname = { "tag-file", NULL }; #endif static struct optname u_optname = { "underline-special", NULL }; static struct optname V__optname = { "version", NULL }; static struct optname w_optname = { "hilite-unread", NULL }; static struct optname x_optname = { "tabs", NULL }; static struct optname X__optname = { "no-init", NULL }; static struct optname y_optname = { "max-forw-scroll", NULL }; static struct optname z_optname = { "window", NULL }; static struct optname quote_optname = { "quotes", NULL }; 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 }; /* * Table of all options and their semantics. * * For BOOL and TRIPLE options, odesc[0], odesc[1], odesc[2] are * the description of the option when set to 0, 1 or 2, respectively. * For NUMBER options, odesc[0] is the prompt to use when entering * a new value, and odesc[1] is the description, which should contain * one %d which is replaced by the value of the number. * For STRING options, odesc[0] is the prompt to use when entering * a new value, and odesc[1], if not NULL, is the set of characters * that are valid in the string. */ static struct loption option[] = { { 'a', &a_optname, BOOL, OPT_OFF, &how_search, NULL, { "Search includes displayed screen", "Search skips displayed screen", NULL } }, { 'b', &b_optname, NUMBER|INIT_HANDLER, 64, &bufspace, opt_b, { "Max buffer space per file (K): ", "Max buffer space per file: %dK", NULL } }, { 'B', &B__optname, BOOL, OPT_ON, &autobuf, NULL, { "Don't automatically allocate buffers", "Automatically allocate buffers when needed", NULL } }, { 'c', &c_optname, TRIPLE, OPT_OFF, &top_scroll, NULL, { "Repaint by scrolling from bottom of screen", "Repaint by painting from top of screen", "Repaint by painting from top of screen" } }, { 'd', &d_optname, BOOL|NO_TOGGLE, OPT_OFF, &know_dumb, NULL, { "Assume intelligent terminal", "Assume dumb terminal", NULL } }, #if MSDOS_COMPILER { 'D', &D__optname, STRING|REPAINT|NO_QUERY, 0, NULL, opt_D, { "color desc: ", "Ddknsu0123456789.", NULL } }, #endif { 'e', &e_optname, TRIPLE, OPT_OFF, &quit_at_eof, NULL, { "Don't quit at end-of-file", "Quit at end-of-file", "Quit immediately at end-of-file" } }, { 'f', &f_optname, BOOL, OPT_OFF, &force_open, NULL, { "Open only regular files", "Open even non-regular files", NULL } }, { 'F', &F__optname, BOOL, OPT_OFF, &quit_if_one_screen, NULL, { "Don't quit if end-of-file on first screen", "Quit if end-of-file on first screen", NULL } }, #if HILITE_SEARCH { 'g', &g_optname, TRIPLE|HL_REPAINT, OPT_ONPLUS, &hilite_search, NULL, { "Don't highlight search matches", "Highlight matches for previous search only", "Highlight all matches for previous search pattern", } }, #endif { 'h', &h_optname, NUMBER, -1, &back_scroll, NULL, { "Backwards scroll limit: ", "Backwards scroll limit is %d lines", NULL } }, { 'i', &i_optname, TRIPLE|HL_REPAINT, OPT_OFF, &caseless, opt_i, { "Case is significant in searches", "Ignore case in searches", "Ignore case in searches and in patterns" } }, { 'j', &j_optname, STRING, 0, NULL, opt_j, { "Target line: ", "0123456789.", NULL } }, { 'J', &J__optname, BOOL|REPAINT, OPT_OFF, &status_col, NULL, { "Don't display a status column", "Display a status column", NULL } }, #if USERFILE { 'k', &k_optname, STRING|NO_TOGGLE|NO_QUERY, 0, NULL, opt_k, { 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 } }, { 'L', &L__optname, BOOL, OPT_ON, &use_lessopen, NULL, { "Don't use the LESSOPEN filter", "Use the LESSOPEN filter", NULL } }, { 'm', &m_optname, TRIPLE, OPT_OFF, &pr_type, NULL, { "Short prompt", "Medium prompt", "Long prompt" } }, { 'n', &n_optname, TRIPLE|REPAINT, OPT_ON, &linenums, NULL, { "Don't use line numbers", "Use line numbers", "Constantly display line numbers" } }, #if LOGFILE { 'o', &o_optname, STRING, 0, NULL, opt_o, { "log file: ", NULL, NULL } }, { 'O', &O__optname, STRING, 0, NULL, opt__O, { "Log file: ", NULL, NULL } }, #endif { 'p', &p_optname, STRING|NO_TOGGLE|NO_QUERY, 0, NULL, opt_p, { NULL, NULL, NULL } }, { 'P', &P__optname, STRING, 0, NULL, opt__P, { "prompt: ", NULL, NULL } }, { 'q', &q_optname, TRIPLE, OPT_OFF, &quiet, NULL, { "Ring the bell for errors AND at eof/bof", "Ring the bell for errors but not at eof/bof", "Never ring the bell" } }, { 'r', &r_optname, TRIPLE|REPAINT, OPT_OFF, &ctldisp, NULL, { "Display control characters as ^X", "Display control characters directly", "Display control characters directly, processing ANSI sequences" } }, { 's', &s_optname, BOOL|REPAINT, OPT_OFF, &squeeze, NULL, { "Display all blank lines", "Squeeze multiple blank lines", NULL } }, { 'S', &S__optname, BOOL|REPAINT, OPT_OFF, &chopline, NULL, { "Fold long lines", "Chop long lines", NULL } }, #if TAGS { 't', &t_optname, STRING|NO_QUERY, 0, NULL, opt_t, { "tag: ", NULL, NULL } }, { 'T', &T__optname, STRING, 0, NULL, opt__T, { "tags file: ", NULL, NULL } }, #endif { 'u', &u_optname, TRIPLE|REPAINT, OPT_OFF, &bs_mode, NULL, { "Display underlined text in underline mode", "Backspaces cause overstrike", "Print backspace as ^H" } }, { 'V', &V__optname, NOVAR, 0, NULL, opt__V, { NULL, NULL, NULL } }, { 'w', &w_optname, TRIPLE|REPAINT, OPT_OFF, &show_attn, NULL, { "Don't highlight first unread line", "Highlight first unread line after forward-screen", "Highlight first unread line after any forward movement", } }, { 'x', &x_optname, STRING|REPAINT, 0, NULL, opt_x, { "Tab stops: ", "0123456789,", NULL } }, { 'X', &X__optname, BOOL|NO_TOGGLE, OPT_OFF, &no_init, NULL, { "Send init/deinit strings to terminal", "Don't use init/deinit strings", NULL } }, { 'y', &y_optname, NUMBER, -1, &forw_scroll, NULL, { "Forward scroll limit: ", "Forward scroll limit is %d lines", NULL } }, { 'z', &z_optname, NUMBER, -1, &swindow, NULL, { "Scroll window size: ", "Scroll window size is %d lines", NULL } }, { '"', "e_optname, STRING, 0, NULL, opt_quote, { "quotes: ", NULL, NULL } }, { '~', &tilde_optname, BOOL|REPAINT, OPT_ON, &twiddle, NULL, { "Don't show tildes after end of file", "Show tildes after end of file", NULL } }, { '?', &query_optname, NOVAR, 0, NULL, opt_query, { NULL, NULL, NULL } }, { '#', £_optname, NUMBER, 0, &shift_count, NULL, { "Horizontal shift: ", "Horizontal shift %d positions", NULL } }, { '.', &keypad_optname, BOOL|NO_TOGGLE, OPT_OFF, &no_keypad, NULL, { "Use keypad mode", "Don't use keypad mode", 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 } } }; /* * Initialize each option to its default value. */ public void 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++) { /* * Set each variable to its default. */ if (o->ovar != NULL) *(o->ovar) = o->odefault; if (o->otype & INIT_HANDLER) (*(o->ofunc))(INIT, (char *) NULL); } } /* * Find an option in the option table, given its option letter. */ public struct loption * findopt(c) int c; { register struct loption *o; for (o = option; o->oletter != '\0'; o++) { if (o->oletter == c) return (o); if ((o->otype & TRIPLE) && ASCII_TO_UPPER(o->oletter) == c) return (o); } return (NULL); } /* * */ static int is_optchar(c) char c; { if (ASCII_IS_UPPER(c)) return 1; if (ASCII_IS_LOWER(c)) return 1; if (c == '-') return 1; return 0; } /* * Find an option in the option table, given its option name. * p_optname is the (possibly partial) name to look for, and * is updated to point after the matched name. * p_oname if non-NULL is set to point to the full option name. */ public struct loption * findopt_name(p_optname, p_oname, p_err) char **p_optname; char **p_oname; int *p_err; { char *optname = *p_optname; register struct loption *o; register struct optname *oname; register int len; int uppercase; struct loption *maxo = NULL; struct optname *maxoname = NULL; int maxlen = 0; int ambig = 0; int exact = 0; /* * Check all options. */ for (o = option; o->oletter != '\0'; o++) { /* * Check all names for this option. */ for (oname = o->onames; oname != NULL; oname = oname->onext) { /* * Try normal match first (uppercase == 0), * then, then if it's a TRIPLE option, * try uppercase match (uppercase == 1). */ for (uppercase = 0; uppercase <= 1; uppercase++) { len = sprefix(optname, oname->oname, uppercase); if (len <= 0 || is_optchar(optname[len])) { /* * We didn't use all of the option name. */ continue; } if (!exact && len == maxlen) /* * Already had a partial match, * and now there's another one that * matches the same length. */ ambig = 1; else if (len > maxlen) { /* * Found a better match than * the one we had. */ maxo = o; maxoname = oname; maxlen = len; ambig = 0; exact = (len == (int)strlen(oname->oname)); } if (!(o->otype & TRIPLE)) break; } } } if (ambig) { /* * Name matched more than one option. */ if (p_err != NULL) *p_err = OPT_AMBIG; return (NULL); } *p_optname = optname + maxlen; if (p_oname != NULL) *p_oname = maxoname == NULL ? NULL : maxoname->oname; return (maxo); } diff --git a/contrib/less/tags.c b/contrib/less/tags.c index b22fda8a28ed..ab00faf004d1 100644 --- a/contrib/less/tags.c +++ b/contrib/less/tags.c @@ -1,757 +1,757 @@ /* * 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. * * For more information about less, or for information on how to * contact the author, see the README file. */ #include "less.h" #define WHITESP(c) ((c)==' ' || (c)=='\t') #if TAGS public char *tags = "tags"; static int total; static int curseq; extern int linenums; extern int sigs; enum tag_result { TAG_FOUND, TAG_NOFILE, TAG_NOTAG, TAG_NOTYPE, TAG_INTR }; /* * Tag type */ enum { T_CTAGS, /* 'tags': standard and extended format (ctags) */ T_CTAGS_X, /* stdin: cross reference format (ctags) */ T_GTAGS, /* 'GTAGS': function defenition (global) */ T_GRTAGS, /* 'GRTAGS': function reference (global) */ T_GSYMS, /* 'GSYMS': other symbols (global) */ T_GPATH /* 'GPATH': path name (global) */ }; static enum tag_result findctag(); static enum tag_result findgtag(); static char *nextgtag(); static char *prevgtag(); static POSITION ctagsearch(); static POSITION gtagsearch(); static int getentry(); /* * The list of tags generated by the last findgtag() call. * * Use either pattern or line number. * findgtag() always uses line number, so pattern is always NULL. * findctag() uses either pattern (in which case line number is 0), * or line number (in which case pattern is NULL). */ struct taglist { struct tag *tl_first; struct tag *tl_last; }; #define TAG_END ((struct tag *) &taglist) static struct taglist taglist = { TAG_END, TAG_END }; struct tag { struct tag *next, *prev; /* List links */ char *tag_file; /* Source file containing the tag */ LINENUM tag_linenum; /* Appropriate line number in source file */ char *tag_pattern; /* Pattern used to find the tag */ char tag_endline; /* True if the pattern includes '$' */ }; static struct tag *curtag; #define TAG_INS(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; \ (tp)->prev->next = (tp)->next; /* * Delete tag structures. */ public void cleantags() { register struct tag *tp; /* * Delete any existing tag list. * {{ Ideally, we wouldn't do this until after we know that we * can load some other tag information. }} */ while ((tp = taglist.tl_first) != TAG_END) { TAG_RM(tp); free(tp); } curtag = NULL; total = curseq = 0; } /* * Create a new tag entry. */ static struct tag * maketagent(name, file, linenum, pattern, endline) char *name; char *file; LINENUM linenum; char *pattern; int endline; { register struct tag *tp; tp = (struct tag *) ecalloc(sizeof(struct tag), 1); tp->tag_file = (char *) ecalloc(strlen(file) + 1, sizeof(char)); strcpy(tp->tag_file, file); tp->tag_linenum = linenum; tp->tag_endline = endline; if (pattern == NULL) tp->tag_pattern = NULL; else { tp->tag_pattern = (char *) ecalloc(strlen(pattern) + 1, sizeof(char)); strcpy(tp->tag_pattern, pattern); } return (tp); } /* * Get tag mode. */ public int gettagtype() { int f; if (strcmp(tags, "GTAGS") == 0) return T_GTAGS; if (strcmp(tags, "GRTAGS") == 0) return T_GRTAGS; if (strcmp(tags, "GSYMS") == 0) return T_GSYMS; if (strcmp(tags, "GPATH") == 0) return T_GPATH; if (strcmp(tags, "-") == 0) return T_CTAGS_X; f = open(tags, OPEN_READ); if (f >= 0) { close(f); return T_CTAGS; } return T_GTAGS; } /* * Find tags in tag file. * Find a tag in the "tags" file. * Sets "tag_file" to the name of the file containing the tag, * and "tagpattern" to the search pattern which should be used * to find the tag. */ public void findtag(tag) register char *tag; { int type = gettagtype(); enum tag_result result; if (type == T_CTAGS) result = findctag(tag); else result = findgtag(tag, type); switch (result) { case TAG_FOUND: case TAG_INTR: break; case TAG_NOFILE: error("No tags file", NULL_PARG); break; case TAG_NOTAG: error("No such tag in tags file", NULL_PARG); break; case TAG_NOTYPE: error("unknown tag type", NULL_PARG); break; } } /* * Search for a tag. */ public POSITION tagsearch() { if (curtag == NULL) return (NULL_POSITION); /* No gtags loaded! */ if (curtag->tag_linenum != 0) return gtagsearch(); else return ctagsearch(); } /* * Go to the next tag. */ public char * nexttag(n) int n; { char *tagfile = (char *) NULL; while (n-- > 0) tagfile = nextgtag(); return tagfile; } /* * Go to the previous tag. */ public char * prevtag(n) int n; { char *tagfile = (char *) NULL; while (n-- > 0) tagfile = prevgtag(); return tagfile; } /* * Return the total number of tags. */ public int ntags() { return total; } /* * Return the sequence number of current tag. */ public int curr_tag() { return curseq; } /***************************************************************************** * ctags */ /* * Find tags in the "tags" file. * Sets curtag to the first tag entry. */ static enum tag_result findctag(tag) register char *tag; { char *p; register FILE *f; register int taglen; LINENUM taglinenum; char *tagfile; char *tagpattern; int tagendline; int search_char; int err; char tline[TAGLINE_SIZE]; struct tag *tp; p = shell_unquote(tags); f = fopen(p, "r"); free(p); if (f == NULL) return TAG_NOFILE; cleantags(); total = 0; taglen = strlen(tag); /* * Search the tags file for the desired tag. */ while (fgets(tline, sizeof(tline), f) != NULL) { if (tline[0] == '!') /* Skip header of extended format. */ continue; if (strncmp(tag, tline, taglen) != 0 || !WHITESP(tline[taglen])) continue; /* * Found it. * The line contains the tag, the filename and the * location in the file, separated by white space. * The location is either a decimal line number, * or a search pattern surrounded by a pair of delimiters. * Parse the line and extract these parts. */ tagpattern = NULL; /* * Skip over the whitespace after the tag name. */ p = skipsp(tline+taglen); if (*p == '\0') /* File name is missing! */ continue; /* * Save the file name. * Skip over the whitespace after the file name. */ tagfile = p; while (!WHITESP(*p) && *p != '\0') p++; *p++ = '\0'; p = skipsp(p); if (*p == '\0') /* Pattern is missing! */ continue; /* * First see if it is a line number. */ tagendline = 0; taglinenum = getnum(&p, 0, &err); if (err) { /* * No, it must be a pattern. * Delete the initial "^" (if present) and * the final "$" from the pattern. * Delete any backslash in the pattern. */ taglinenum = 0; search_char = *p++; if (*p == '^') p++; tagpattern = p; while (*p != search_char && *p != '\0') { if (*p == '\\') p++; p++; } tagendline = (p[-1] == '$'); if (tagendline) p--; *p = '\0'; } tp = maketagent(tag, tagfile, taglinenum, tagpattern, tagendline); TAG_INS(tp); total++; } fclose(f); if (total == 0) return TAG_NOTAG; curtag = taglist.tl_first; curseq = 1; return TAG_FOUND; } /* * Edit current tagged file. */ public int edit_tagfile() { if (curtag == NULL) return (1); return (edit(curtag->tag_file)); } /* * Search for a tag. * This is a stripped-down version of search(). * We don't use search() for several reasons: * - We don't want to blow away any search string we may have saved. * - The various regular-expression functions (from different systems: * regcmp vs. re_comp) behave differently in the presence of * parentheses (which are almost always found in a tag). */ static POSITION ctagsearch() { POSITION pos, linepos; LINENUM linenum; int len; char *line; pos = ch_zero(); linenum = find_linenum(pos); for (;;) { /* * Get lines until we find a matching one or * until we hit end-of-file. */ if (ABORT_SIGS()) return (NULL_POSITION); /* * Read the next line, and save the * starting position of that line in linepos. */ linepos = pos; pos = forw_raw_line(pos, &line, (int *)NULL); if (linenum != 0) linenum++; if (pos == NULL_POSITION) { /* * We hit EOF without a match. */ error("Tag not found", NULL_PARG); return (NULL_POSITION); } /* * If we're using line numbers, we might as well * remember the information we have now (the position * and line number of the current line). */ if (linenums) add_lnum(linenum, pos); /* * Test the line to see if we have a match. * Use strncmp because the pattern may be * truncated (in the tags file) if it is too long. * If tagendline is set, make sure we match all * the way to end of line (no extra chars after the match). */ len = strlen(curtag->tag_pattern); if (strncmp(curtag->tag_pattern, line, len) == 0 && (!curtag->tag_endline || line[len] == '\0' || line[len] == '\r')) { curtag->tag_linenum = find_linenum(linepos); break; } } return (linepos); } /******************************************************************************* * gtags */ /* * Find tags in the GLOBAL's tag file. * The findgtag() will try and load information about the requested tag. * It does this by calling "global -x tag" and storing the parsed output * for future use by gtagsearch(). * Sets curtag to the first tag entry. */ static enum tag_result findgtag(tag, type) char *tag; /* tag to load */ int type; /* tags type */ { char buf[256]; FILE *fp; struct tag *tp; if (type != T_CTAGS_X && tag == NULL) return TAG_NOFILE; cleantags(); total = 0; /* * If type == T_CTAGS_X then read ctags's -x format from stdin * else execute global(1) and read from it. */ if (type == T_CTAGS_X) { fp = stdin; /* Set tag default because we cannot read stdin again. */ tags = "tags"; } else { #if !HAVE_POPEN return TAG_NOFILE; #else char *command; char *flag; char *qtag; char *cmd = lgetenv("LESSGLOBALTAGS"); if (cmd == NULL || *cmd == '\0') return TAG_NOFILE; /* Get suitable flag value for global(1). */ switch (type) { case T_GTAGS: flag = "" ; break; case T_GRTAGS: flag = "r"; break; case T_GSYMS: flag = "s"; break; case T_GPATH: flag = "P"; break; default: return TAG_NOTYPE; } /* Get our data from global(1). */ 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) { while (fgets(buf, sizeof(buf), fp)) { char *name, *file, *line; int len; if (sigs) { #if HAVE_POPEN if (fp != stdin) pclose(fp); #endif return TAG_INTR; } len = strlen(buf); if (len > 0 && buf[len-1] == '\n') buf[len-1] = '\0'; else { int c; do { c = fgetc(fp); } while (c != '\n' && c != EOF); } if (getentry(buf, &name, &file, &line)) { /* * Couldn't parse this line for some reason. * We'll just pretend it never happened. */ break; } /* Make new entry and add to list. */ tp = maketagent(name, file, (LINENUM) atoi(line), NULL, 0); TAG_INS(tp); total++; } if (fp != stdin) { if (pclose(fp)) { curtag = NULL; total = curseq = 0; return TAG_NOFILE; } } } /* Check to see if we found anything. */ tp = taglist.tl_first; if (tp == TAG_END) return TAG_NOTAG; curtag = tp; curseq = 1; return TAG_FOUND; } static int circular = 0; /* 1: circular tag structure */ /* * Return the filename required for the next gtag in the queue that was setup * by findgtag(). The next call to gtagsearch() will try to position at the * appropriate tag. */ static char * nextgtag() { struct tag *tp; if (curtag == NULL) /* No tag loaded */ return NULL; tp = curtag->next; if (tp == TAG_END) { if (!circular) return NULL; /* Wrapped around to the head of the queue */ curtag = taglist.tl_first; curseq = 1; } else { curtag = tp; curseq++; } return (curtag->tag_file); } /* * Return the filename required for the previous gtag in the queue that was * setup by findgtat(). The next call to gtagsearch() will try to position * at the appropriate tag. */ static char * prevgtag() { struct tag *tp; if (curtag == NULL) /* No tag loaded */ return NULL; tp = curtag->prev; if (tp == TAG_END) { if (!circular) return NULL; /* Wrapped around to the tail of the queue */ curtag = taglist.tl_last; curseq = total; } else { curtag = tp; curseq--; } return (curtag->tag_file); } /* * 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() { if (curtag == NULL) return (NULL_POSITION); /* No gtags loaded! */ return (find_pos(curtag->tag_linenum)); } /* * The getentry() parses both standard and extended ctags -x format. * * [standard format] * * +------------------------------------------------ * |main 30 main.c main(argc, argv) * |func 21 subr.c func(arg) * * The following commands write this format. * o Traditinal Ctags with -x option * o Global with -x option * See * * [extended format] * * +---------------------------------------------------------- * |main function 30 main.c main(argc, argv) * |func function 21 subr.c func(arg) * * The following commands write this format. * o Exuberant Ctags with -x option * See * * Returns 0 on success, -1 on error. * The tag, file, and line will each be NUL-terminated pointers * into buf. */ static int getentry(buf, tag, file, line) char *buf; /* standard or extended ctags -x format data */ char **tag; /* name of the tag we actually found */ char **file; /* file in which to find this tag */ char **line; /* line number of file where this tag is found */ { char *p = buf; for (*tag = p; *p && !IS_SPACE(*p); p++) /* tag name */ ; if (*p == 0) return (-1); *p++ = 0; for ( ; *p && IS_SPACE(*p); p++) /* (skip blanks) */ ; if (*p == 0) return (-1); /* * If the second part begin with other than digit, * it is assumed tag type. Skip it. */ if (!IS_DIGIT(*p)) { for ( ; *p && !IS_SPACE(*p); p++) /* (skip tag type) */ ; for (; *p && IS_SPACE(*p); p++) /* (skip blanks) */ ; } if (!IS_DIGIT(*p)) return (-1); *line = p; /* line number */ for (*line = p; *p && !IS_SPACE(*p); p++) ; if (*p == 0) return (-1); *p++ = 0; for ( ; *p && IS_SPACE(*p); p++) /* (skip blanks) */ ; if (*p == 0) return (-1); *file = p; /* file name */ for (*file = p; *p && !IS_SPACE(*p); p++) ; if (*p == 0) return (-1); *p = 0; /* value check */ if (strlen(*tag) && strlen(*line) && strlen(*file) && atoi(*line) > 0) return (0); return (-1); } #endif diff --git a/contrib/less/version.c b/contrib/less/version.c index 1fce12e560b1..578dc55e07a6 100644 --- a/contrib/less/version.c +++ b/contrib/less/version.c @@ -1,701 +1,706 @@ /* * 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. * * For more information about less, or for information on how to * contact the author, see the README file. */ /* ----------------------- CHANGE HISTORY -------------------------- 1/29/84 Allowed use on standard input 2/1/84 Added E, N, P commands 4/17/84 Added '=' command, 'stop' signal handling 4/20/84 Added line folding v2 4/27/84 Fixed '=' command to use BOTTOM_PLUS_ONE, instead of TOP, added 'p' & 'v' commands v3 5/3/84 Added -m and -t options, '-' command v4 5/3/84 Added LESS environment variable v5 5/3/84 New comments, fixed '-' command slightly v6 5/15/84 Added -Q, visual bell v7 5/24/84 Fixed jump_back(n) bug: n should count real lines, not folded lines. Also allow number on G command. v8 5/30/84 Re-do -q and -Q commands v9 9/25/84 Added "+" argument v10 10/10/84 Fixed bug in -b argument processing v11 10/18/84 Made error() ring bell if \n not entered. ----------------------------------------------------------------- v12 2/13/85 Reorganized signal handling and made portable to 4.2bsd. v13 2/16/85 Reword error message for '-' command. v14 2/22/85 Added -bf and -bp variants of -b. v15 2/25/85 Miscellaneous changes. v16 3/13/85 Added -u flag for backspace processing. v17 4/13/85 Added j and k commands, changed -t default. v18 4/20/85 Rewrote signal handling code. v19 5/2/85 Got rid of "verbose" eq_message(). Made search() scroll in some cases. v20 5/21/85 Fixed screen.c ioctls for System V. v21 5/23/85 Fixed some first_cmd bugs. v22 5/24/85 Added support for no RECOMP nor REGCMP. v23 5/25/85 Miscellanous changes and prettying up. Posted to USENET. ----------------------------------------------------------------- v24 6/3/85 Added ti,te terminal init & de-init. (Thanks to Mike Kersenbrock) v25 6/8/85 Added -U flag, standout mode underlining. v26 6/9/85 Added -M flag. Use underline termcap (us) if it exists. v27 6/15/85 Renamed some variables to make unique in 6 chars. Minor fix to -m. v28 6/28/85 Fixed right margin bug. v29 6/28/85 Incorporated M.Rose's changes to signal.c v30 6/29/85 Fixed stupid bug in argument processing. v31 7/15/85 Added -p flag, changed repaint algorithm. Added kludge for magic cookie terminals. v32 7/16/85 Added cat_file if output not a tty. v33 7/23/85 Added -e flag and EDITOR. v34 7/26/85 Added -s flag. v35 7/27/85 Rewrote option handling; added option.c. v36 7/29/85 Fixed -e flag to work if not last file. v37 8/10/85 Added -x flag. v38 8/19/85 Changed prompting; created prompt.c. v39 8/24/85 (Not -p) does not initially clear screen. v40 8/26/85 Added "skipping" indicator in forw(). Posted to USENET. ----------------------------------------------------------------- v41 9/17/85 ONLY_RETURN, control char commands, faster search, other minor fixes. v42 9/25/85 Added ++ command line syntax; ch_fsize for pipes. v43 10/15/85 Added -h flag, changed prim.c algorithms. v44 10/16/85 Made END print in all cases of eof; ignore SIGTTOU after receiv ing SIGTSTP. v45 10/16/85 Never print backspaces unless -u. v46 10/24/85 Backwards scroll in jump_loc. v47 10/30/85 Fixed bug in edit(): *first_cmd==0 v48 11/16/85 Use TIOCSETN instead of TIOCSETP. Added marks (m and ' commands). Posted to USENET. ----------------------------------------------------------------- v49 1/9/86 Fixed bug: signal didn't clear mcc. v50 1/15/86 Added ' (quote) to gomark. v51 1/16/86 Added + cmd, fixed problem if first_cmd fails, made g cmd sort of "work" on pipes ev en if bof is no longer buffered. v52 1/17/86 Made short files work better. v53 1/20/86 Added -P option. v54 1/20/86 Changed help to use HELPFILE. v55 1/23/86 Messages work better if not tty output. v56 1/24/86 Added -l option. v57 1/31/86 Fixed -l to get confirmation before ov erwriting an existing file. v58 8/28/86 Added filename globbing. v59 9/15/86 Fixed some bugs with very long filenames. v60 9/26/86 Incorporated changes from Leith (Casey) Leedom for boldface and -z option. v61 9/26/86 Got rid of annoying repaints after ! cmd. Posted to USENET. ----------------------------------------------------------------- v62 12/23/86 Added is_directory(); change -z default to -1 instead of 24; cat-and-exit if -e and file is less than a screenful. v63 1/8/87 Fixed bug in cat-and-exit if > 1 file. v64 1/12/87 Changed puts/putstr, putc/putchr, getc/getchr to av oid name conflict with stdio functions. v65 1/26/87 Allowed '-' command to change NUMBER v alued options (thanks to Gary Puckering) v66 2/13/87 Fixed bug: prepaint should use force=1. v67 2/24/87 Added !! and % expansion to ! command. v68 2/25/87 Added SIGWINCH and TIOCGWINSZ support; changed is_directory to bad_file. (thanks to J. Robert Ward) v69 2/25/87 Added SIGWIND and WIOCGETD (for Unix PC). v70 3/13/87 Changed help cmd from 'h' to 'H'; better error msgs in bad_file, errno_message. v71 5/11/87 Changed -p to -c, made triple -c/-C for clear-eol like more's -c. v72 6/26/87 Added -E, -L, use $SHELL in lsystem(). (thanks to Stev e Spearman) v73 6/26/87 Allow Examine "#" for previous file. Posted to USENET 8/25/87. ----------------------------------------------------------------- v74 9/18/87 Fix conflict in EOF symbol with stdio.h, Make os.c more portable to BSD. v75 9/23/87 Fix problems in get_term (thanks to Paul Eggert); new backwards scrolling in jump_loc (thanks to Marion Hakanson). v76 9/23/87 Added -i flag; allow single "!" to inv oke a shell (thanks to Franco Barber). v77 9/24/87 Added -n flag and line number support. v78 9/25/87 Fixed problem with prompts longer than the screen width. v79 9/29/87 Added the _ command. v80 10/6/87 Allow signal to break out of linenum scan. v81 10/6/87 Allow -b to be changed from within less. v82 10/7/87 Add cmd_decode to use a table for key binding (thanks to Dav id Nason). v83 10/9/87 Allow .less file for user-defined keys. v84 10/11/87 Fix -e/-E problems (thanks to Felix Lee). v85 10/15/87 Search now keeps track of line numbers. v86 10/20/87 Added -B option and autobuf; fixed "pipe error" bug. v87 3/1/88 Fix bug re BSD signals while reading file. v88 3/12/88 Use new format for -P option (thanks to der Mouse), allow "+-c" without message, fix bug re BSD hangup. v89 3/18/88 Turn off line numbers if linenum scan is interrupted. v90 3/30/88 Allow -P from within less. v91 3/30/88 Added tags file support (new -t option) (thanks to Brian Campbell). v92 4/4/88 Added -+option syntax. v93 4/11/88 Add support for slow input (thanks to Joe Orost & apologies for taking almost 3 years to get this in!) v94 4/11/88 Redo reading/signal stuff. v95 4/20/88 Repaint screen better after signal. v96 4/21/88 Add /! and ?! commands. v97 5/17/88 Allow -l/-L from within less. Eliminate some static arrays (use calloc). Posted to USENET. ----------------------------------------------------------------- v98 10/14/88 Fix incorrect calloc call; uninitialized var in exec_mca; core dump on unknown TERM. Make v cmd work if past last line of file. Fix some signal bugs. v99 10/29/88 Allow space between -X and string, when X is a string-valued option. v100 1/5/89 Fix globbing bug when $SHELL not set; allow spaces after -t command. v101 1/6/89 Fix problem with long (truncated) lines in tags file (thanks to Neil Dixon). v102 1/6/89 Fix bug with E# when no prev file; allow spaces after -l command. v103 3/14/89 Add -N, -f and -? options. Add z and w commands. Add %L for prompt strings. v104 3/16/89 Added EDITPROTO. v105 3/20/89 Fix bug in find_linenum which cached incorrectly on long lines. v106 3/31/89 Added -k option and multiple lesskey files. v107 4/27/89 Add 8-bit char support and -g option. Split option code into 3 files. v108 5/5/89 Allocate position table dynamically (thanks to Paul Eggert); change % command from "percent" to vi-style brace finder. v109 5/10/89 Added ESC-% command, split prim.c. v110 5/24/89 Fixed bug in + option; fixed repaint bug under Sun windows (thanks to Paul Eggert). v111 5/25/89 Generalized # and % expansion; use calloc for some error messages. v112 5/30/89 Get rid of ESC-%, add {}()[] commands. v113 5/31/89 Optimize lseeks (thanks to Paul Eggert). v114 7/25/89 Added ESC-/ and ESC-/! commands. v115 7/26/89 Added ESC-n command. v116 7/31/89 Added find_pos to optimize g command. v117 8/1/89 Change -f option to -r. v118 8/2/89 Save positions for all previous files, not just the immediately previous one. v119 8/7/89 Save marks across file boundaries. Add file handle stuff. v120 8/11/89 Add :ta command. v121 8/16/89 Add -f option. v122 8/30/89 Fix performance with many buffers. v123 8/31/89 Verbose prompts for string options. Posted beta to USENET. ----------------------------------------------------------------- v124 9/18/89 Reorganize search commands, N = rev, ESC-n = span, add ESC-N. v125 9/18/89 Fix tab bug (thanks to Alex Liu). Fix EOF bug when both -w and -c. v126 10/25/89 Add -j option. v127 10/27/89 Fix problems with blank lines before BOF. v128 10/27/89 Add %bj, etc. to prompt strings. v129 11/3/89 Add -+,-- commands; add set-option and unset-option to lesskey. v130 11/6/89 Generalize A_EXTRA to string, remove set-option, unset-option from lesskey. v131 11/7/89 Changed name of EDITPROTO to LESSEDIT. v132 11/8/89 Allow editing of command prefix. v133 11/16/89 Add -y option (thanks to Jeff Sullivan). v134 12/1/89 Glob filenames in the -l command. v135 12/5/89 Combined {}()[] commands into one, and added ESC-^F and ESC-^B commands. v136 1/20/90 Added -S, -R flags. Added | command. Added warning for binary files. (thanks to Richard Brittain and J. Sullivan). v137 1/21/90 Rewrote horrible pappend code. Added * notation for hi-bit chars. v138 1/24/90 Fix magic cookie terminal handling. Get rid of "cleanup" loop in ch_get. v139 1/27/90 Added MSDOS support. (many thanks to Richard Brittain). v140 2/7/90 Editing a new file adds it to the command line list. v141 2/8/90 Add edit_list for editing >1 file. v142 2/10/90 Add :x command. v143 2/11/90 Add * and @ modifies to search cmds. Change ESC-/ cmd from /@* to / *. v144 3/1/90 Messed around with ch_zero; no real change. v145 3/2/90 Added -R and -v/-V for MSDOS; renamed FILENAME to avoid conflict. v146 3/5/90 Pull cmdbuf functions out of command.c v147 3/7/90 Implement ?@; fix multi-file edit bugs. v148 3/29/90 Fixed bug in :e then :e#. v149 4/3/90 Change error,ierror,query to use PARG. v150 4/6/90 Add LESS_CHARSET, LESS_CHARDEF. v151 4/13/90 Remove -g option; clean up ispipe. v152 4/14/90 lsystem() closes input file, for editors which require exclusive open. v153 4/18/90 Fix bug if SHELL unset; fix bug in overstrike control char. v154 4/25/90 Output to fd 2 via buffer. v155 4/30/90 Ignore -i if uppercase in pattern (thanks to Michael Rendell.) v156 5/3/90 Remove scroll limits in forw() & back(); causes problems with -c. v157 5/4/90 Forward search starts at next real line (not screen line) after jump target. v158 6/14/90 Added F command. v159 7/29/90 Fix bug in exiting: output not flushed. v160 7/29/90 Clear screen before initial output w/ -c. v161 7/29/90 Add -T flag. v162 8/14/90 Fix bug with +F on command line. v163 8/21/90 Added LESSBINFMT variable. v164 9/5/90 Added -p, LINES, COLUMNS and unset mark ' == BOF, for 1003.2 D5. v165 9/6/90 At EOF with -c set, don't display empty screen when try to page forward. v166 9/6/90 Fix G when final line in file wraps. v167 9/11/90 Translate CR/LF -> LF for 1003.2. v168 9/13/90 Return to curr file if "tag not found". v169 12/12/90 G goes to EOF even if file has grown. v170 1/17/91 Add optimization for BSD _setjmp; fix #include ioctl.h TERMIO problem. (thanks to Paul Eggert) Posted to USENET. ----------------------------------------------------------------- v171 3/6/91 Fix -? bug in get_filename. v172 3/15/91 Fix G bug in empty file. Fix bug with ?\n and -i and uppercase pattern at EOF! (thanks to Paul Eggert) v173 3/17/91 Change N cmd to not permanently change direction. (thanks to Brian Matthews) v174 3/18/91 Fix bug with namelogfile not getting cleared when change files. v175 3/18/91 Fix bug with ++cmd on command line. (thanks to Jim Meyering) v176 4/2/91 Change | to not force current screen, include marked line, start/end from top of screen. Improve search speed. (thanks to Don Mears) v177 4/2/91 Add LESSHELP variable. Fix bug with F command with -e. Try /dev/tty for input before using fd 2. Patches posted to USENET 4/2/91. ----------------------------------------------------------------- v178 4/8/91 Fixed bug in globbing logfile name. (thanks to Jim Meyering) v179 4/9/91 Allow negative -z for screen-relative. v180 4/9/91 Clear to eos rather than eol if "db"; don't use "sr" if "da". (thanks to Tor Lillqvist) v181 4/18/91 Fixed bug with "negative" chars 80 - FF. (thanks to Benny Sander Hofmann) v182 5/16/91 Fixed bug with attribute at EOL. (thanks to Brian Matthews) v183 6/1/91 Rewrite linstall to do smart config. v184 7/11/91 Process \b in searches based on -u rather than -i. v185 7/11/91 -Pxxx sets short prompt; assume SIGWINCH after a SIGSTOP. (thanks to Ken Laprade) ----------------------------------------------------------------- v186 4/20/92 Port to MS-DOS (Microsoft C). v187 4/23/92 Added -D option & TAB_COMPLETE_FILENAME. v188 4/28/92 Added command line editing features. v189 12/8/92 Fix mem overrun in anscreen.c:init; fix edit_list to recover from bin file. v190 2/13/93 Make TAB enter one filename at a time; create ^L with old TAB functionality. v191 3/10/93 Defer creating "flash" page for MS-DOS. v192 9/6/93 Add BACK-TAB. v193 9/17/93 Simplify binary_file handling. v194 1/4/94 Add rudiments of alt_filename handling. v195 1/11/94 Port back to Unix; support keypad. ----------------------------------------------------------------- v196 6/7/94 Fix bug with bad filename; fix IFILE type problem. (thanks to David MacKenzie) v197 6/7/94 Fix bug with .less tables inserted wrong. v198 6/23/94 Use autoconf installation technology. (thanks to David MacKenzie) v199 6/29/94 Fix MS-DOS build (thanks to Tim Wiegman). v200 7/25/94 Clean up copyright, minor fixes. Posted to prep.ai.mit.edu ----------------------------------------------------------------- v201 7/27/94 Check for no memcpy; add casts to calloc; look for regcmp in libgen.a. (thanks to Kaveh Ghazi). v202 7/28/94 Fix bug in edit_next/edit_prev with non-existant files. v203 8/2/94 Fix a variety of configuration bugs on various systems. (thanks to Sakai Kiyotaka, Harald Koenig, Bjorn Brox, Teemu Rantanen, and Thorsten Lockert) v204 8/3/94 Use strerror if available. (thanks to J.T. Conklin) v205 8/5/94 Fix bug in finding "me" termcap entry. (thanks to Andreas Stolcke) 8/10/94 v205+: Change BUFSIZ to LBUFSIZE to avoid name conflict with stdio.h. Posted to prep.ai.mit.edu ----------------------------------------------------------------- v206 8/10/94 Use initial_scrpos for -t to avoid displaying first page before init(). (thanks to Dominique Petitpierre) v207 8/12/94 Fix bug if stdout is not tty. v208 8/16/94 Fix bug in close_altfile if goto err1 in edit_ifile. (Thanks to M.J. Hewitt) v209 8/16/94 Change scroll to wscroll to avoid conflict with library function. v210 8/16/94 Fix bug with bold on 8 bit chars. (thanks to Vitor Duarte) v211 8/16/94 Don't quit on EOI in jump_loc / forw. v212 8/18/94 Use time_t if available. v213 8/20/94 Allow ospeed to be defined in termcap.h. v214 8/20/94 Added HILITE_SEARCH, -F, ESC-u cmd. (thanks to Paul Lew and Bob Byrnes) v215 8/23/94 Fix -i toggle behavior. v216 8/23/94 Process BS in all searches, not only -u. v217 8/24/94 Added -X flag. v218 8/24/94 Reimplement undo_search. v219 8/24/94 Find tags marked with line number instead of pattern. v220 8/24/94 Stay at same position after SIG_WINCH. v221 8/24/94 Fix bug in file percentage in big file. v222 8/25/94 Do better if can't reopen current file. v223 8/27/94 Support setlocale. (thanks to Robert Joop) v224 8/29/94 Revert v216: process BS in search only if -u. v225 9/6/94 Rewrite undo_search again: toggle. v226 9/15/94 Configuration fixes. (thanks to David MacKenzie) v227 9/19/94 Fixed strerror config problem. Posted to prep.ai.mit.edu ----------------------------------------------------------------- v228 9/21/94 Fix bug in signals: repeated calls to get_editkeys overflowed st_edittable. v229 9/21/94 Fix "Nothing to search" error if -a and SRCH_PAST_EOF. v230 9/21/94 Don't print extra error msg in search after regerror(). v231 9/22/94 Fix hilite bug if search matches 0 chars. (thanks to John Polstra) v232 9/23/94 Deal with weird systems that have termios.h but not tcgetattr(). Posted to prep.ai.mit.edu ----------------------------------------------------------------- v233 9/26/94 Use get_term() instead of pos_init() in psignals to re-get lower_left termcap. (Thanks to John Malecki) v234 9/26/94 Make MIDDLE closer to middle of screen. v235 9/27/94 Use local strchr if system doesn't have. v236 9/28/94 Don't use libucb; use libterm if libtermcap & libcurses doesn't work. (Fix for Solaris; thanks to Frank Kaefer) v237 9/30/94 Use system isupper() etc if provided. Posted to prep.ai.mit.edu ----------------------------------------------------------------- v238 10/6/94 Make binary non-blinking if LESSBINFMT is set to a string without a *. v239 10/7/94 Don't let delimit_word run back past beginning of cmdbuf. v240 10/10/94 Don't write into termcap buffer. (Thanks to Benoit Speckel) v241 10/13/94 New lesskey file format. Don't expand filenames in search command. v242 10/14/94 Allow lesskey specification of "literal". v243 10/14/94 Add #stop command to lesskey. v244 10/16/94 Add -f flag to lesskey. v245 10/25/94 Allow TAB_COMPLETE_FILENAME to be undefd. v246 10/27/94 Move help file to /usr/local/share. v247 10/27/94 Add -V option. v248 11/5/94 Add -V option to lesskey. v249 11/5/94 Remove -f flag from lesskey; default input file is ~/.lesskey.in, not stdin. v250 11/7/94 Lesskey input file "-" means stdin. v251 11/9/94 Convert cfgetospeed result to ospeed. (Thanks to Andrew Chernov) v252 11/16/94 Change default lesskey input file from .lesskey.in to .lesskey. Posted to prep.ai.mit.edu ----------------------------------------------------------------- v253 11/21/94 Fix bug when tags file has a backslash. v254 12/6/94 Fix -k option. v255 12/8/94 Add #define EXAMINE to disable :e etc. v256 12/10/94 Change highlighting: only highlite search results (but now it is reliable). v257 12/10/94 Add goto_line and repaint_highlight to optimize highlight repaints. v258 12/12/94 Fixup in hilite_line if BS_SPECIAL. v259 12/12/94 Convert to autoconf 2.0. v260 12/13/94 Add SECURE define. v261 12/14/94 Use system WERASE char as EC_W_BACKSPACE. v262 12/16/94 Add -g/-G flag and screen_hilite. v263 12/20/94 Reimplement/optimize -G flag behavior. v264 12/23/94 Allow EXTRA string after line-edit cmd in lesskey file. v265 12/24/94 Add LESSOPEN=|cmd syntax. v266 12/26/94 Add -I flag. v267 12/28/94 Formalize the four-byte header emitted by a LESSOPEN pipe. v268 12/28/94 Get rid of four-byte header. v269 1/2/95 Close alt file before open new one. Avoids multiple popen(). v270 1/3/95 Use VISUAL; use S_ISDIR/S_ISREG; fix config problem with Solaris POSIX regcomp. v271 1/4/95 Don't quit on read error. v272 1/5/95 Get rid of -L. v273 1/6/95 Fix ch_ungetchar bug; don't call LESSOPEN on a pipe. v274 1/6/95 Ported to OS/2 (thanks to Kai Uwe Rommel) v275 1/18/95 Fix bug if toggle -G at EOF. v276 1/30/95 Fix OS/2 version. v277 1/31/95 Add "next" charset; don't display ^X for X > 128. v278 2/14/95 Change default for -G. Posted to prep.ai.mit.edu ----------------------------------------------------------------- v279 2/22/95 Add GNU options --help, --version. Minor config fixes. v280 2/24/95 Clean up calls to glob(); don't set # if we can't open the new file. v281 2/24/95 Repeat search should turn on hilites. v282 3/2/95 Minor fixes. v283 3/2/95 Fix homefile; make OS2 look in $HOME. v284 3/2/95 Error if "v" on LESSOPENed file; "%" figures out file size on pipe. v285 3/7/95 Don't set # in lsystem; lesskey try $HOME first. v286 3/7/95 Reformat change history (too much free time?). v287 3/8/95 Fix hilite bug if overstrike multiple chars. v288 3/8/95 Allow lesskey to override get_editkey keys. v289 3/9/95 Fix adj_hilite bug when line gets processed by hilite_line more than once. v290 3/9/95 Make configure automatically. Fix Sequent problem with incompatible sigsetmask(). Posted to prep.ai.mit.edu ----------------------------------------------------------------- v291 3/21/95 Add #env to lesskey. Fix MS-DOS build. Posted to simtel. ----------------------------------------------------------------- v292 4/24/95 Add MS-DOS support for Borland C. Fix arrow keys in MS-DOS versions. v293 4/28/95 Add auto-versioning stuff to make dist. v294 5/12/95 Fix Borland build. v295 1/20/96 Fix search on squished file; add /@@. v296 1/23/96 Allow cmdbuf larger than screen width. v297 1/24/96 Don't call termcap if tgetent fails; add #defines for buffers. v298 1/24/96 Change @@ to ^K. Add alternate search modifiers ^N, ^F, ^E. v299 1/25/96 Fix percent overflow in jump_percent (thanks to Brent Wiese); don't send "ti" after shell command till RETURN pressed. v300 1/25/96 Change -U to print tabs as ^I. v301 1/30/96 Make hilites work in cmd F output. v302 1/31/96 Fix cmd F to notice window-change signals. v303 1/31/96 Add ESC-SPACE command. v304 2/1/96 Add ^R search modifier; add LESSSECURE. v305 2/2/96 Workaround Linux /proc kernel bug; add LESSKEY. v306 3/16/96 Minor fixes. v307 3/25/96 Allow cmd line arg "--"; fix DOS & OS/2 defines.h. v308 4/4/96 Port to OS-9 (thanks to Boisy Pitre); fix -d. v309 4/9/96 Fix OS-9 version; fix tags bug with "$". v310 4/10/96 Get rid of HELPFILE. v311 4/22/96 Add Windows32 support; merge doscreen.c into screen.c. v312 4/24/96 Don't quit after "cannot reopen" error. v313 4/25/96 Added horizontal scrolling. v314 4/26/96 Modified -e to quit on reaching end of a squished file. v315 4/26/96 Fix "!;TAB" bug. v316 5/2/96 Make "|a" when (a < curr screen) go to end of curr screen. v317 5/14/96 Various fixes for the MS-DOS and OS/2 builds. Added ## and %% handling for filenames v318 5/29/96 Port to OS-9 Microware compiler; minor fixes (thanks to Martin Gregorie). v319 7/8/96 Fix Windows port (thanks to Jeff Paquette). v320 7/11/96 Final fixes for Windows port. v321 7/18/96 Minor fixes. Posted to Web page. ----------------------------------------------------------------- v322 8/13/96 Fix bug in shell escape from help file; add support for Microsoft Visual C under Windows; numerous small fixes. v323 8/19/96 Fixes for Windows version (thanks to Simon Munton); fix for Linux library weirdness (thanks to Jim Diamond); port to DJGPP (thanks to Eli Zaretskii). v324 8/21/96 Add support for spaces in filenames (thanks to Simon Munton). v325 8/21/96 Add lessecho, for spaces in filenames under Unix. v326 8/27/96 Fix DJGPP version. v327 9/1/96 Reorganize lglob, make spaces in filenames work better in Unix. v328 10/7/96 Append / to directory name in filename completion. Fix MS-DOS and OS-9 versions. v329 10/11/96 Fix more MS-DOS bugs; add LESSSEPARATOR; add -" option. Add LESSMETACHARS, LESSMETAESCAPE. v330 10/21/96 Minor fixes. Posted to Web page. ----------------------------------------------------------------- v331 4/22/97 Various Windows fixes (thanks to Gurusamy Sarathy). v332 4/22/97 Enter filenames from cmd line into edit history. Posted to Web page. ----------------------------------------------------------------- v333 3/4/99 Changed -w to highlite new line after forward movement. v334 3/9/99 Avoid overflowing prompt buffer; add %d and %D. v335 3/20/99 Add EBCDIC support (thanks to Thomas Dorner). Use HOMEDRIVE/HOMEPATH on Windows (thanks to Preston Bannister). Posted to Web page. ----------------------------------------------------------------- v336 4/8/99 Fix installation bugs. v337 4/9/99 Fix another installation bug. Posted to Web page. ----------------------------------------------------------------- v338 4/13/99 Add support for long option names. v339 4/18/99 Add \k, long option names to lesskey. Add -^P. Add :d. v340 4/21/99 Add regexec2. Fix Windows build. Posted to Web page. ----------------------------------------------------------------- v341 5/6/99 Add -F option; %c & ?c prompt escapes. (Thanks to Michele Maltoni) v342 7/22/99 Add system-wide lesskey file; allow GPL or Less License. v343 9/23/99 Support UTF-8 (Thanks to Robert Brady). Add %P and ?P in prompts. v344 10/27/99 -w highlights target line of g and p commands. v345 10/29/99 Make -R pass thru ESC but not other control chars. Posted to Web page. ----------------------------------------------------------------- v346 11/4/99 Fix bugs in long option processing; R cmd should clear hilites. Posted to Web page. ----------------------------------------------------------------- v347 12/13/99 Fixes for DJGPP version (thanks to Eli Zaretskii). v348 12/28/99 Fix deleting file with marks (thanks to Dimitar Jekov). Fix color problem in DJGPP version (thanks to Eli Zaretskii). v349 1/24/00 Fix minor DJGPP bugs; check environment vars for UTF-8; add --with-editor (thanks to Eli, Markus Kuhn, Thomas Schoepf). v350 3/1/00 Fix clear-while-standout bug. v351 3/5/00 Change -M and = prompts to show top & bottom line number. Posted to Web page. ----------------------------------------------------------------- v352 3/8/00 Fix scan_option NULL dereference. ----------------------------------------------------------------- v353 3/20/00 Fix SECURE compile bug, allow space after numeric option. v354 3/23/00 Add support for PCRE; add --with-regex configure option. ----------------------------------------------------------------- v355 6/28/00 Add -# option (thanks to Andy Levinson). v356 7/5/00 Add -J option. v357 7/6/00 Support sigprocmask. ----------------------------------------------------------------- v358 7/8/00 Fix problems with #stop in lesskey file. Posted to Web page. ----------------------------------------------------------------- v359 9/10/00 Fixes for Win32 display problems (thanks to Maurizio Vairani). v360 1/17/01 Move sysless to etc. v361 12/4/01 Add IBM-1047 charset & EBCDIC fixes (thanks to Thomas Dorner). Fix 32 bit dependencies (thanks to Paul Eggert). Fix UTF-8 overstriking (thanks to Robert Brady). v362 12/4/01 Make status column show search targets. v363 12/6/01 Add --no-keypad option. Add variable width tabstops (thanks to Peter Samuelson). v364 12/10/01 Better handling of very long lines in input; Fix horizontal shifting of colored text. v365 12/11/01 Fix overstriking of tabs; Add support for global(1) and multiple tag matches (thanks to Shigio Yamaguchi and Tim Vanderhoek). v366 12/11/01 Fixes for OS/2 (thanks to Kyosuke Tokoro). v367 12/13/01 Allow -D and -x options to terminate without dollar sign; Right/left arrow when entering N are shift cmds, not line edit. v368 12/18/01 Update lesskey commands. v370 12/23/01 Fix tags error messages. Posted to Web page. ----------------------------------------------------------------- v371 12/26/01 Fix new_file bug; use popen in Windows version; fix some compiler warnings. v372 12/29/01 Make -b be in units of 1K. v373 1/14/02 Improve handling of filenames containing shell metachars. v374 2/7/02 Fix memory leak; fix bug in -x argument parsing. v375 4/7/02 Fix searching for SGR sequences; fix SECURE build; add SGR support to DJGPP version (thanks to Eli Zaretskii). v376 6/10/02 Fix bug in overstriking mulitbyte UTF-8 characters (thanks to Jungshik Shin). Posted to Web page. ----------------------------------------------------------------- v377 9/10/02 Fix bug in Windows version when file contains CR; fix bug in search highlights with -R; make initial buffer limit really be 64K not unlimited. v378 9/30/02 Misc bug fixes and compiler warning cleanup. Posted to Web page. ----------------------------------------------------------------- v379 11/23/02 Add -L option; fix bug with ctrl-K in lesskey files; improve UTF-8 overstriking and underscore overstriking; fix minor man page problems; change to autoconf 2.54. 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. */ -char version[] = "409"; +char version[] = "415";