diff options
author | Alain Magloire <alainm@rcsm.ee.mcgill.ca> | 1998-11-22 06:46:27 +0000 |
---|---|---|
committer | Alain Magloire <alainm@rcsm.ee.mcgill.ca> | 1998-11-22 06:46:27 +0000 |
commit | 695fbff68e97129065ec5060975cfd630c54248c (patch) | |
tree | 8a3b3b92026353d3e855adf5fd57906e85a7bd4f | |
parent | a0216ebb9728c8de4def988fdb3b498db2cfe11a (diff) | |
download | grep-695fbff68e97129065ec5060975cfd630c54248c.tar.gz |
auto generated no need or them in the repository.
new directory doc enter.
support for DOS.
move in doc.
updated.
* doc/: New directory, grep.1, {e,f}grep.man move here
with a draft of grep.texi(base of sed.texi).
* tests/{ere,bre}.*: New files. The spencer2 test is split
in two ere/bre.
* config.hin: New, config.h.in rename to config.hin for OS
with limited file system aka DOS.
-rw-r--r-- | COPYING | 340 | ||||
-rw-r--r-- | ChangeLog | 19 | ||||
-rw-r--r-- | INSTALL | 183 | ||||
-rw-r--r-- | NEWS | 2 | ||||
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | config.guess | 565 | ||||
-rw-r--r-- | config.h.in | 180 | ||||
-rw-r--r-- | configure.in | 2 | ||||
-rw-r--r-- | doc/Makefile.am | 18 | ||||
-rw-r--r-- | doc/egrep.man (renamed from src/egrep.man) | 0 | ||||
-rw-r--r-- | doc/fgrep.man (renamed from src/fgrep.man) | 0 | ||||
-rw-r--r-- | doc/grep.1 (renamed from src/grep.1) | 2 | ||||
-rw-r--r-- | doc/grep.texi | 765 | ||||
-rw-r--r-- | install-sh | 250 | ||||
-rw-r--r-- | m4/progtest.m4 | 5 | ||||
-rw-r--r-- | missing | 134 | ||||
-rw-r--r-- | mkinstalldirs | 40 | ||||
-rw-r--r-- | src/Makefile.am | 16 | ||||
-rw-r--r-- | src/regex.c | 26 | ||||
-rw-r--r-- | tests/Makefile.am | 11 | ||||
-rw-r--r-- | tests/scriptgen.awk | 19 | ||||
-rw-r--r-- | tests/spencer1.sh | 4 |
22 files changed, 832 insertions, 1751 deletions
diff --git a/COPYING b/COPYING deleted file mode 100644 index eeb586b3..00000000 --- a/COPYING +++ /dev/null @@ -1,340 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - <one line to give the program's name and a brief idea of what it does.> - Copyright (C) 19yy <name of author> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - <signature of Ty Coon>, 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. @@ -1,6 +1,15 @@ +1998-11-22 Alain Magloire + + * doc/: New directory, grep.1, {e,f}grep.man move here + with a draft of grep.texi(base of sed.texi). + * tests/{ere,bre}.*: New files. The spencer2 test is split + in two ere/bre. + * config.hin: New, config.h.in rename to config.hin for OS + with limited file system aka DOS. + 1998-11-18 Alain Magloire - * src/regex.[ch] : Updated from GLibc, previous was + * src/regex.[ch] : Updated from GLibc, previous patches were integrate by Ulrich Drepper and some added ones. 1998-11-16 Paul Eggert @@ -54,14 +63,6 @@ check whether `dir' needs a slash. (grepfile): If file is a directory, set e to EISDIR. -1998-11-11 Alain Magloire - - * src/regex.c : On Apple, grep is overriding the regex library - (recomp, etc.). Adding __private_extern__ in the declaration - localizes the scope of that symbol for the linker, so it knows - to use grep's regex routines rather than those in lib system. - Done by Wilfredo Sanchez. - 1998-11-10 Alain Magloire * src/vms_fab.{c,h}: New file for VMS wildcard expansion diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 50dbe439..00000000 --- a/INSTALL +++ /dev/null @@ -1,183 +0,0 @@ -Basic Installation -================== - - These are generic installation instructions. - - The `configure' shell script attempts to guess correct values for -various system-dependent variables used during compilation. It uses -those values to create a `Makefile' in each directory of the package. -It may also create one or more `.h' files containing system-dependent -definitions. Finally, it creates a shell script `config.status' that -you can run in the future to recreate the current configuration, a file -`config.cache' that saves the results of its tests to speed up -reconfiguring, and a file `config.log' containing compiler output -(useful mainly for debugging `configure'). - - If you need to do unusual things to compile the package, please try -to figure out how `configure' could check whether to do them, and mail -diffs or instructions to the address given in the `README' so they can -be considered for the next release. If at some point `config.cache' -contains results you don't want to keep, you may remove or edit it. - - The file `configure.in' is used to create `configure' by a program -called `autoconf'. You only need `configure.in' if you want to change -it or regenerate `configure' using a newer version of `autoconf'. - -The simplest way to compile this package is: - - 1. `cd' to the directory containing the package's source code and type - `./configure' to configure the package for your system. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. While running, it prints some - messages telling which features it is checking for. - - 2. Type `make' to compile the package. - - 3. Optionally, type `make check' to run any self-tests that come with - the package. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. You can remove the program binaries and object files from the - source code directory by typing `make clean'. To also remove the - files that `configure' created (so you can compile the package for - a different kind of computer), type `make distclean'. There is - also a `make maintainer-clean' target, but that is intended mainly - for the package's developers. If you use it, you may have to get - all sorts of other programs in order to regenerate files that came - with the distribution. - -Compilers and Options -===================== - - Some systems require unusual options for compilation or linking that -the `configure' script does not know about. You can give `configure' -initial values for variables by setting them in the environment. Using -a Bourne-compatible shell, you can do that on the command line like -this: - CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure - -Or on systems that have the `env' program, you can do it like this: - env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure - -Compiling For Multiple Architectures -==================================== - - You can compile the package for more than one kind of computer at the -same time, by placing the object files for each architecture in their -own directory. To do this, you must use a version of `make' that -supports the `VPATH' variable, such as GNU `make'. `cd' to the -directory where you want the object files and executables to go and run -the `configure' script. `configure' automatically checks for the -source code in the directory that `configure' is in and in `..'. - - If you have to use a `make' that does not supports the `VPATH' -variable, you have to compile the package for one architecture at a time -in the source code directory. After you have installed the package for -one architecture, use `make distclean' before reconfiguring for another -architecture. - -Installation Names -================== - - By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PATH'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PATH', the package will use -PATH as the prefix for installing programs and libraries. -Documentation and other data files will still use the regular prefix. - - In addition, if you use an unusual directory layout you can give -options like `--bindir=PATH' to specify different values for particular -kinds of files. Run `configure --help' for a list of the directories -you can set and what kinds of files go in them. - - If the package supports it, you can cause programs to be installed -with an extra prefix or suffix on their names by giving `configure' the -option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. - -Optional Features -================= - - Some packages pay attention to `--enable-FEATURE' options to -`configure', where FEATURE indicates an optional part of the package. -They may also pay attention to `--with-PACKAGE' options, where PACKAGE -is something like `gnu-as' or `x' (for the X Window System). The -`README' should mention any `--enable-' and `--with-' options that the -package recognizes. - - For packages that use the X Window System, `configure' can usually -find the X include and library files automatically, but if it doesn't, -you can use the `configure' options `--x-includes=DIR' and -`--x-libraries=DIR' to specify their locations. - -Specifying the System Type -========================== - - There may be some features `configure' can not figure out -automatically, but needs to determine by the type of host the package -will run on. Usually `configure' can figure that out, but if it prints -a message saying it can not guess the host type, give it the -`--host=TYPE' option. TYPE can either be a short name for the system -type, such as `sun4', or a canonical name with three fields: - CPU-COMPANY-SYSTEM - -See the file `config.sub' for the possible values of each field. If -`config.sub' isn't included in this package, then this package doesn't -need to know the host type. - - If you are building compiler tools for cross-compiling, you can also -use the `--target=TYPE' option to select the type of system they will -produce code for and the `--build=TYPE' option to select the type of -system on which you are compiling the package. - -Sharing Defaults -================ - - If you want to set default values for `configure' scripts to share, -you can create a site shell script called `config.site' that gives -default values for variables like `CC', `cache_file', and `prefix'. -`configure' looks for `PREFIX/share/config.site' if it exists, then -`PREFIX/etc/config.site' if it exists. Or, you can set the -`CONFIG_SITE' environment variable to the location of the site script. -A warning: not all `configure' scripts look for a site script. - -Operation Controls -================== - - `configure' recognizes the following options to control how it -operates. - -`--cache-file=FILE' - Use and save the results of the tests in FILE instead of - `./config.cache'. Set FILE to `/dev/null' to disable caching, for - debugging `configure'. - -`--help' - Print a summary of the options to `configure', and exit. - -`--quiet' -`--silent' -`-q' - Do not print messages saying which checks are being made. To - suppress all normal output, redirect it to `/dev/null' (any error - messages will still be shown). - -`--srcdir=DIR' - Look for the package's source code in directory DIR. Usually - `configure' can determine that directory automatically. - -`--version' - Print the version of Autoconf used to generate the `configure' - script, and exit. - -`configure' also accepts some other, not widely useful, options. - @@ -1,3 +1,5 @@ +Version 2.3: + - When searching a binary file FOO, grep now just reports `Binary file FOO matches' instead of outputting binary data. This is typically more useful than the old behavior, @@ -20,7 +20,7 @@ See the file INSTALL for compilation and installation instructions. See the file NEWS for a description of major changes in this release. -See the file PROJECTS for ideas for how you could help us improve grep. +See the file TODO for ideas on how you could help us improve grep. Send bug reports to bug-gnu-utils@gnu.org. Be sure to include the word "grep" in your Subject: header field. diff --git a/config.guess b/config.guess deleted file mode 100644 index 2ff0eba2..00000000 --- a/config.guess +++ /dev/null @@ -1,565 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc. -# -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# Written by Per Bothner <bothner@cygnus.com>. -# The master version of this file is at the FSF in /home/gd/gnu/lib. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# The plan is that this can be called by configure scripts if you -# don't specify an explicit system type (host/target name). -# -# Only a few systems have been added to this list; please add others -# (but try to keep the structure clean). -# - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 8/24/94.) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -trap 'rm -f dummy.c dummy.o dummy; exit 1' 1 2 15 - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - alpha:OSF1:V*:*) - # After 1.2, OSF1 uses "V1.3" for uname -r. - echo alpha-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^V//'` - exit 0 ;; - alpha:OSF1:*:*) - # 1.2 uses "1.2" for uname -r. - echo alpha-dec-osf${UNAME_RELEASE} - exit 0 ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit 0 ;; - amiga:NetBSD:*:*) - echo m68k-cbm-netbsd${UNAME_RELEASE} - exit 0 ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; - Pyramid*:OSx*:*:*) - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit 0 ;; - sun4*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - i86pc:SunOS:5.*:*) - echo i386-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; - atari*:NetBSD:*:*) - echo m68k-atari-netbsd${UNAME_RELEASE} - exit 0 ;; - sun3*:NetBSD:*:*) - echo m68k-sun-netbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:NetBSD:*:*) - echo m68k-apple-netbsd${UNAME_RELEASE} - exit 0 ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; - mips:*:4*:UMIPS) - echo mips-mips-riscos4sysv - exit 0 ;; - mips:*:5*:RISCos) - echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit 0 ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit 0 ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit 0 ;; - AViiON:dgux:*:*) - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx \ - -o ${TARGET_BINARY_INTERFACE}x = x ] ; then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - exit 0 ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit 0 ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit 0 ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit 0 ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit 0 ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i[34]86:AIX:*:*) - echo i386-ibm-aix - exit 0 ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - sed 's/^ //' << EOF >dummy.c - #include <sys/systemcfg.h> - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy - echo rs6000-ibm-aix3.2.5 - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit 0 ;; - *:AIX:*:4) - if /usr/sbin/lsattr -EHl proc0 | grep POWER >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=4.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit 0 ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit 0 ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC NetBSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit 0 ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit 0 ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit 0 ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit 0 ;; - 9000/[3478]??:HP-UX:*:*) - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/7?? | 9000/8?[79] ) HP_ARCH=hppa1.1 ;; - 9000/8?? ) HP_ARCH=hppa1.0 ;; - esac - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; - 3050*:HI-UX:*:*) - sed 's/^ //' << EOF >dummy.c - #include <unistd.h> - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - ${CC-cc} dummy.c -o dummy && ./dummy && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy - echo unknown-hitachi-hiuxwe2 - exit 0 ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit 0 ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit 0 ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit 0 ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit 0 ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit 0 ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit 0 ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit 0 ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit 0 ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit 0 ;; - CRAY*X-MP:*:*:*) - echo xmp-cray-unicos - exit 0 ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} - exit 0 ;; - CRAY*C90:*:*:*) - echo c90-cray-unicos${UNAME_RELEASE} - exit 0 ;; - CRAY-2:*:*:*) - echo cray2-cray-unicos - exit 0 ;; - hp3[0-9][05]:NetBSD:*:*) - echo m68k-hp-netbsd${UNAME_RELEASE} - exit 0 ;; - i[34]86:BSD/386:*:* | *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; - *:FreeBSD:*:*) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit 0 ;; - *:NetBSD:*:*) - echo ${UNAME_MACHINE}-unknown-netbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - exit 0 ;; - *:GNU:*:*) - echo `echo ${UNAME_MACHINE}|sed -e 's,/.*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; - *:Linux:*:*) - # The BFD linker knows what the default object file format is, so - # first see if it will tell us. - ld_help_string=`ld --help 2>&1` - if echo $ld_help_string | grep >/dev/null 2>&1 "supported emulations: elf_i[345]86"; then - echo "${UNAME_MACHINE}-unknown-linux" ; exit 0 - elif echo $ld_help_string | grep >/dev/null 2>&1 "supported emulations: i[345]86linux"; then - echo "${UNAME_MACHINE}-unknown-linuxaout" ; exit 0 - elif echo $ld_help_string | grep >/dev/null 2>&1 "supported emulations: i[345]86coff"; then - echo "${UNAME_MACHINE}-unknown-linuxcoff" ; exit 0 - elif test "${UNAME_MACHINE}" = "alpha" ; then - echo alpha-unknown-linux ; exit 0 - else - # Either a pre-BFD a.out linker (linuxoldld) or one that does not give us - # useful --help. Gcc wants to distinguish between linuxoldld and linuxaout. - test ! -d /usr/lib/ldscripts/. \ - && echo "${UNAME_MACHINE}-unknown-linuxoldld" && exit 0 - # Determine whether the default compiler is a.out or elf - cat >dummy.c <<EOF -main(argc, argv) -int argc; -char *argv[]; -{ -#ifdef __ELF__ - printf ("%s-unknown-linux\n", argv[1]); -#else - printf ("%s-unknown-linuxaout\n", argv[1]); -#endif - return 0; -} -EOF - ${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy "${UNAME_MACHINE}" && rm dummy.c dummy && exit 0 - rm -f dummy.c dummy - fi ;; -# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. earlier versions -# are messed up and put the nodename in both sysname and nodename. - i[34]86:DYNIX/ptx:4*:*) - echo i386-sequent-sysv4 - exit 0 ;; - i[34]86:*:4.*:* | i[34]86:SYSTEM_V:4.*:*) - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_RELEASE} - else - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE} - fi - exit 0 ;; - i[34]86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name` - echo ${UNAME_MACHINE}-unknown-isc$UNAME_REL - elif /bin/uname -X 2>/dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` - (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 - echo ${UNAME_MACHINE}-unknown-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-unknown-sysv32 - fi - exit 0 ;; - Intel:Mach:3*:*) - echo i386-unknown-mach3 - exit 0 ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit 0 ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit 0 ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit 0 ;; - M680[234]0:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0) - uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3 && exit 0 ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; - m680[234]0:LynxOS:2.[23]*:*) - echo m68k-lynx-lynxos${UNAME_RELEASE} - exit 0 ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit 0 ;; - i[34]86:LynxOS:2.[23]*:*) - echo i386-lynx-lynxos${UNAME_RELEASE} - exit 0 ;; - TSUNAMI:LynxOS:2.[23]*:*) - echo sparc-lynx-lynxos${UNAME_RELEASE} - exit 0 ;; - rs6000:LynxOS:2.[23]*:*) - echo rs6000-lynx-lynxos${UNAME_RELEASE} - exit 0 ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit 0 ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit 0 ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -cat >dummy.c <<EOF -#ifdef _SEQUENT_ -# include <sys/types.h> -# include <sys/utsname.h> -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include <sys/param.h> - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - printf ("%s-next-nextstep%s\n", __ARCHITECTURE__, version==2 ? "2" : "3"); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-unknown-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -#if !defined (ultrix) - printf ("vax-dec-bsd\n"); exit (0); -#else - printf ("vax-dec-ultrix\n"); exit (0); -#endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -${CC-cc} dummy.c -o dummy 2>/dev/null && ./dummy && rm dummy.c dummy && exit 0 -rm -f dummy.c dummy - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit 0 ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit 0 ;; - c34*) - echo c34-convex-bsd - exit 0 ;; - c38*) - echo c38-convex-bsd - exit 0 ;; - c4*) - echo c4-convex-bsd - exit 0 ;; - esac -fi - -#echo '(Unable to guess system type)' 1>&2 - -exit 1 diff --git a/config.h.in b/config.h.in deleted file mode 100644 index 196e9ef4..00000000 --- a/config.h.in +++ /dev/null @@ -1,180 +0,0 @@ -/* config.h.in. Generated automatically from configure.in by autoheader. */ - -/* Define if using alloca.c. */ -#undef C_ALLOCA - -/* Define if the closedir function returns void instead of int. */ -#undef CLOSEDIR_VOID - -/* Define to empty if the keyword does not work. */ -#undef const - -/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. - This function is required for alloca.c support on those systems. */ -#undef CRAY_STACKSEG_END - -/* Define if you have alloca, as a function or macro. */ -#undef HAVE_ALLOCA - -/* Define if you have <alloca.h> and it should be used (not on Ultrix). */ -#undef HAVE_ALLOCA_H - -/* Define if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Define as __inline if that's what the C compiler calls it. */ -#undef inline - -/* Define to `long' if <sys/types.h> doesn't define. */ -#undef off_t - -/* Define if you need to in order for stat and other things to work. */ -#undef _POSIX_SOURCE - -/* Define to `unsigned' if <sys/types.h> doesn't define. */ -#undef size_t - -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown - */ -#undef STACK_DIRECTION - -/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */ -#undef STAT_MACROS_BROKEN - -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* Define to use grep's error-checking malloc in the kwset routines. */ -#undef GREP - -/* Package name. */ -#undef PACKAGE - -/* Version number. */ -#undef VERSION - -#undef HAVE_STPCPY - -#undef ENABLE_NLS - -#undef HAVE_CATGETS - -#undef HAVE_GETTEXT - -#undef HAVE_LC_MESSAGES - -/* Define if you have the __argz_count function. */ -#undef HAVE___ARGZ_COUNT - -/* Define if you have the __argz_next function. */ -#undef HAVE___ARGZ_NEXT - -/* Define if you have the __argz_stringify function. */ -#undef HAVE___ARGZ_STRINGIFY - -/* Define if you have the btowc function. */ -#undef HAVE_BTOWC - -/* Define if you have the dcgettext function. */ -#undef HAVE_DCGETTEXT - -/* Define if you have the getcwd function. */ -#undef HAVE_GETCWD - -/* Define if you have the getpagesize function. */ -#undef HAVE_GETPAGESIZE - -/* Define if you have the isascii function. */ -#undef HAVE_ISASCII - -/* Define if you have the memchr function. */ -#undef HAVE_MEMCHR - -/* Define if you have the munmap function. */ -#undef HAVE_MUNMAP - -/* Define if you have the putenv function. */ -#undef HAVE_PUTENV - -/* Define if you have the setenv function. */ -#undef HAVE_SETENV - -/* Define if you have the setlocale function. */ -#undef HAVE_SETLOCALE - -/* Define if you have the stpcpy function. */ -#undef HAVE_STPCPY - -/* Define if you have the strcasecmp function. */ -#undef HAVE_STRCASECMP - -/* Define if you have the strchr function. */ -#undef HAVE_STRCHR - -/* Define if you have the strdup function. */ -#undef HAVE_STRDUP - -/* Define if you have the strerror function. */ -#undef HAVE_STRERROR - -/* Define if you have the valloc function. */ -#undef HAVE_VALLOC - -/* Define if you have the <argz.h> header file. */ -#undef HAVE_ARGZ_H - -/* Define if you have the <dirent.h> header file. */ -#undef HAVE_DIRENT_H - -/* Define if you have the <libintl.h> header file. */ -#undef HAVE_LIBINTL_H - -/* Define if you have the <limits.h> header file. */ -#undef HAVE_LIMITS_H - -/* Define if you have the <locale.h> header file. */ -#undef HAVE_LOCALE_H - -/* Define if you have the <malloc.h> header file. */ -#undef HAVE_MALLOC_H - -/* Define if you have the <memory.h> header file. */ -#undef HAVE_MEMORY_H - -/* Define if you have the <ndir.h> header file. */ -#undef HAVE_NDIR_H - -/* Define if you have the <nl_types.h> header file. */ -#undef HAVE_NL_TYPES_H - -/* Define if you have the <stdlib.h> header file. */ -#undef HAVE_STDLIB_H - -/* Define if you have the <string.h> header file. */ -#undef HAVE_STRING_H - -/* Define if you have the <sys/dir.h> header file. */ -#undef HAVE_SYS_DIR_H - -/* Define if you have the <sys/ndir.h> header file. */ -#undef HAVE_SYS_NDIR_H - -/* Define if you have the <sys/param.h> header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define if you have the <unistd.h> header file. */ -#undef HAVE_UNISTD_H - -/* Define if you have the <wchar.h> header file. */ -#undef HAVE_WCHAR_H - -/* Define if you have the <wctype.h> header file. */ -#undef HAVE_WCTYPE_H - -/* Define if you have the i library (-li). */ -#undef HAVE_LIBI diff --git a/configure.in b/configure.in index 987bd6c8..7eafa4e5 100644 --- a/configure.in +++ b/configure.in @@ -9,7 +9,7 @@ AC_PREREQ(2.12) dnl Automake stuff. AM_INIT_AUTOMAKE(grep, 2.2d) -AM_CONFIG_HEADER(config.h) +AM_CONFIG_HEADER(config.h:config.hin) dnl Checks for programs. AC_PROG_AWK diff --git a/doc/Makefile.am b/doc/Makefile.am new file mode 100644 index 00000000..b93d96c3 --- /dev/null +++ b/doc/Makefile.am @@ -0,0 +1,18 @@ +## Process this file with automake to create Makefile.in +AUTOMAKE_OPTIONS=no-dependencies + +info_TEXINFOS = grep.texi + +man_MANS = grep.1 fgrep.1 egrep.1 + +EXTRA_DIST = grep.1 egrep.man fgrep.man + +CLEANFILES = egrep.1 fgrep.1 + +fgrep.1: fgrep.man + inst=`echo "grep" | sed '$(transform)'`.1; \ +sed -e "s%@grep@%$$inst%g" $(srcdir)/fgrep.man > $@ + +egrep.1: egrep.man + inst=`echo "grep" | sed '$(transform)'`.1; \ +sed -e "s%@grep@%$$inst%g" $(srcdir)/egrep.man > $@ diff --git a/src/egrep.man b/doc/egrep.man index 877a8a89..877a8a89 100644 --- a/src/egrep.man +++ b/doc/egrep.man diff --git a/src/fgrep.man b/doc/fgrep.man index 877a8a89..877a8a89 100644 --- a/src/fgrep.man +++ b/doc/fgrep.man @@ -2,7 +2,7 @@ .de Id .ds Dt \\$4 .. -.Id $Id: grep.1,v 1.6 1998/11/10 00:29:38 alainm Exp $ +.Id $Id: grep.1,v 1.1 1998/11/22 06:45:20 alainm Exp $ .TH GREP 1 \*(Dt "GNU Project" .SH NAME grep, egrep, fgrep \- print lines matching a pattern diff --git a/doc/grep.texi b/doc/grep.texi new file mode 100644 index 00000000..40af5c51 --- /dev/null +++ b/doc/grep.texi @@ -0,0 +1,765 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header +@setfilename sed.info +@settitle sed, a stream editor +@c %**end of header + +@c This file has the new style title page commands. +@c Run `makeinfo' rather than `texinfo-format-buffer'. + +@c smallbook + +@c tex +@c \overfullrule=0pt +@c end tex + +@include version.texi + +@c Combine indices. +@syncodeindex ky cp +@syncodeindex pg cp +@syncodeindex tp cp + +@defcodeindex op +@syncodeindex op fn + +@ifinfo +@direntry +* sed: (sed). Stream EDitor. +@end direntry +This file documents @sc{sed}, a stream editor. + + +Published by the Free Software Foundation, +59 Temple Place - Suite 330 +Boston, MA 02111-1307, USA + +Copyright (C) 1998 Free Software Foundation, Inc. + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +@ignore +Permission is granted to process this file through TeX and print the +results, provided the printed document carries copying permission +notice identical to this one except for the removal of this paragraph +(this paragraph not being relevant to the printed manual). + +@end ignore +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided that the entire +resulting derived work is distributed under the terms of a permission +notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions, +except that this permission notice may be stated in a translation approved +by the Foundation. +@end ifinfo + +@setchapternewpage off + +@titlepage +@title sed, a stream editor +@subtitle version @value{VERSION}, @value{UPDATED} +@author by Ken Pizzini + +@page +@vskip 0pt plus 1filll +Copyright @copyright{} 1998 Free Software Foundation, Inc. + +@sp 2 +Published by the Free Software Foundation, @* +59 Temple Place - Suite 330, @* +Boston, MA 02111-1307, USA + +Permission is granted to make and distribute verbatim copies of +this manual provided the copyright notice and this permission notice +are preserved on all copies. + +Permission is granted to copy and distribute modified versions of this +manual under the conditions for verbatim copying, provided that the entire +resulting derived work is distributed under the terms of a permission +notice identical to this one. + +Permission is granted to copy and distribute translations of this manual +into another language, under the above conditions for modified versions, +except that this permission notice may be stated in a translation approved +by the Foundation. + +@end titlepage +@page + + +@node Top, Introduction, (dir), (dir) +@comment node-name, next, previous, up + +@ifinfo +This document was produced for version @value{VERSION} of @sc{GNU} @sc{sed}. +@end ifinfo + +@menu +* Introduction:: Introduction +* Invoking SED:: Invocation +* sed Programs:: @sc{sed} programs +* Examples:: Some sample scripts +* Limitations:: About the (non-)limitations on line length +* Other Resources:: Other resources for learning about @sc{sed} +* Reporting Bugs:: Reporting bugs +* Concept Index:: A menu with all the topics in this manual. +* Command and Option Index:: A menu with all @sc{sed} commands and + command-line options. +@end menu + + +@node Introduction, Invoking SED, Top, Top +@chapter Introduction + +@cindex Stream editor +@sc{sed} is a stream editor. +A stream editor is used to perform basic text +transformations on an input stream +(a file or input from a pipeline). +While in some ways similar to an editor which +permits scripted edits (such as @sc{ed}), +@sc{sed} works by making only one pass over the +input(s), and is consequently more efficient. +But it is @sc{sed}'s ability to filter text in a pipeline +which particularly distinguishes it from other types of +editors. + + +@node Invoking SED, sed Programs, Introduction, Top +@chapter Invocation + +@sc{sed} may be invoked with the following command-line options: + +@table @samp +@item -V +@itemx --version +@opindex -V +@opindex --version +@cindex Version, printing +Print out the version of @sc{sed} that is being run and a copyright notice, +then exit. + +@item -h +@itemx --help +@opindex -h +@opindex --help +@cindex Usage summary, printing +Print a usage message briefly summarizing these command-line options +and the bug-reporting address, +then exit. + +@item -n +@itemx --quiet +@itemx --silent +@opindex -n +@opindex --quiet +@opindex --silent +By default, @sc{sed} will print out the pattern space +at the end of each cycle through the script. +These options disable this automatic printing, +and @sc{sed} will only produce output when explicitly told to +via the @code{p} command. + +@item -e @var{script} +@itemx --expression=@var{script} +@opindex -e +@opindex --expression +@cindex Script, from command line +Add the commands in @var{script} to the set of commands to be +run while processing the input. + +@item -f @var{script-file} +@itemx --file=@var{script-file} +@opindex -f +@opindex --file +@cindex Script, from a file +Add the commands contained in the file @var{script-file} +to the set of commands to be run while processing the input. + +@end table + +If no @code{-e}, @code{-f}, @code{--expression}, or @code{--file} +options are given on the command-line, +then the first non-option argument on the command line is +taken to be the @var{script} to be executed. + +@cindex Files to be processed as input +If any command-line parameters remain after processing the above, +these parameters are interpreted as the names of input files to +be processed. +@cindex Standard input, processing as input +A file name of @code{-} refers to the standard input stream. +The standard input will be processed if no file names are specified. + + +@node sed Programs, Examples, Invoking SED, Top +@chapter @sc{sed} Programs + +@cindex @sc{sed} program structure +@cindex Script structure +A @sc{sed} program consists of one or more @sc{sed} commands, +passed in by one or more of the +@code{-e}, @code{-f}, @code{--expression}, and @code{--file} +options, or the first non-option argument if zero of these +options are used. +This document will refer to ``the'' @sc{sed} script; +this will be understood to mean the in-order catenation +of all of the @var{script}s and @var{script-file}s passed in. + +Each @sc{sed} command consists of an optional address or +address range, followed by a one-character command name +and any additional command-specific code. + +@menu +* Addresses:: Selecting lines with @sc{sed} +* Regular Expressions:: Overview of regular expression syntax +* Data Spaces:: Where @sc{sed} buffers data +* Common Commands:: Often used commands +* Other Commands:: Less frequently used commands +* Programming Commands:: Commands for die-hard @sc{sed} programmers +@end menu + + +@node Addresses, Regular Expressions, sed Programs, sed Programs +@section Selecting lines with @sc{sed} +@cindex Addresses, in @sc{sed} scripts +@cindex Line selection +@cindex Selecting lines to process + +Addresses in a @sc{sed} script can be in any of the following forms: +@table @samp +@item @var{number} +@cindex Address, numeric +@cindex Line, selecting by number +Specifying a line number will match only that line in the input. +(Note that @sc{sed} counts lines continuously across all input files.) + +@item @var{first}~@var{step} +@cindex @sc{GNU} extensions, @code{@var{n}~@var{m}} addresses +This @sc{GNU} extension matches every @var{step}th line +starting with line @var{first}. +In particular, lines will be selected when there exists +a non-negative @var{n} such that the current line-number equals +@var{first} + (@var{n} * @var{step}). +Thus, to select the odd-numbered lines, +one would use @code{1~2}; +to pick every third line starting with the second, @code{2~3} would be used; +to pick every fifth line starting with the tenth, use @code{10~5}; +and @code{50~0} is just an obscure way of saying @code{50}. + +@item $ +@cindex Address, last line +@cindex Last line, selecting +@cindex Line, selecting last +This address matches the last line of the last file of input. + +@item /@var{regexp}/ +@cindex Address, as a regular expression +@cindex Line, selecting by regular expression match +This will select any line which matches the regular expression @var{regexp}. +If @var{regexp} itself includes any @code{/} characters, +each must be escaped by a backslash (@code{\}). + +@item \%@var{regexp}% +(The @code{%} may be replaced by any other single character.) + +@cindex Slash character, in regular expressions +This also matches the regular expression @var{regexp}, +but allows one to use a different delimiter than @code{/}. +This is particularly useful if the @var{regexp} itself contains +a lot of @code{/}s, since it avoids the tedious escaping of every @code{/}. +If @var{regexp} itself includes any delimiter characters, +each must be escaped by a backslash (@code{\}). + +@item /@var{regexp}/I +@itemx \%@var{regexp}%I +@cindex @sc{GNU} extensions, @code{I} modifier +The @code{I} modifier to regular-expression matching is a @sc{GNU} +extension which causes the @var{regexp} to be matched in +a case-insensitive manner. + +@end table + +If no addresses are given, then all lines are matched; +if one address is given, then only lines matching that +address are matched. + +@cindex Range of lines +@cindex Several lines, selecting +An address range can be specified by specifying two addresses +separated by a comma (@code{,}). +An address range matches lines starting from where the first +address matches, and continues until the second address matches +(inclusively). +If the second address is a @var{regexp}, then checking for the +ending match will start with the line @emph{following} the +line which matched the first address. +If the second address is a @var{number} less than (or equal to) +the line matching the first address, +then only the one line is matched. + +@cindex Excluding lines +@cindex Selecting non-matching lines +Appending the @code{!} character to the end of an address +specification will negate the sense of the match. +That is, if the @code{!} character follows an address range, +then only lines which do @emph{not} match the address range +will be selected. +This also works for singleton addresses, +and, perhaps perversely, for the null address. + + +@node Regular Expressions, Data Spaces, Addresses, sed Programs +@section Overview of regular expression syntax + +@c XXX FIXME +[[I may add a brief overview of regular expressions at a later date; +for now see any of the various other documentations for regular +expressions, such as the @sc{awk} info page.]] + + +@node Data Spaces, Common Commands, Regular Expressions, sed Programs +@section Where @sc{sed} buffers data + +@cindex Buffer spaces, pattern and hold +@cindex Spaces, pattern and hold +@cindex Pattern space, definition +@cindex Hold space, definition +@sc{sed} maintains two data buffers: the active @emph{pattern} space, +and the auxiliary @emph{hold} space. +In ``normal'' operation, @sc{sed} reads in one line from the +input stream and places it in the pattern space. +This pattern space is where text manipulations occur. +The hold space is initially empty, but there are commands +for moving data between the pattern and hold spaces. +@c XXX FIXME: explain why this is useful/interesting to know. + + +@node Common Commands, Other Commands, Data Spaces, sed Programs +@section Often used commands + +If you use @sc{sed} at all, you will quite likely want to know +these commands. + +@table @samp +@item # +[No addresses allowed.] + +@findex # (comment) command +@cindex Comments, in scripts +The @code{#} ``command'' begins a comment; +the comment continues until the next newline. + +@cindex Portability, comments +If you are concerned about portability, be aware that +some implementations of @sc{sed} (which are not POSIX.2 +conformant) may only support a single one-line comment, +and then only when the very first character of the script is a @code{#}. + +@findex -n, forcing from within a script +@cindex Caveat --- #n on first line +Warning: if the first two characters of the @sc{sed} script +are @code{#n}, then the @code{-n} (no-autoprint) option is forced. +If you want to put a comment in the first line of your script +and that comment begins with the letter `n' +and you do not want this behavior, +then be sure to either use a capital `N', +or place at least one space before the `n'. + +@item s/@var{regexp}/@var{replacement}/@var{flags} +(The @code{/} characters may be uniformly replaced by +any other single character within any given @code{s} command.) + +@findex s (substitute) command +@cindex Substitution of text +@cindex Replacing text matching regexp +The @code{/} character (or whatever other character is used in its stead) +can appear in the @var{regexp} or @var{replacement} +only if it is preceded by a @code{\} character. +Also newlines may appear in the @var{regexp} using the two +character sequence @code{\n}. + +The @code{s} command attempts to match the pattern +space against the supplied @var{regexp}. +If the match is successful, then that portion of the pattern +space which was matched is replaced with @var{replacement}. + +@cindex Backreferences, in regular expressions +@cindex Parenthesized substrings +The @var{replacement} can contain @code{\@var{n}} (@var{n} being +a number from 1 to 9, inclusive) references, which refer to +the portion of the match which is contained between the @var{n}th +@code{\(} and its matching @code{\)}. +Also, the @var{replacement} can contain unescaped @code{&} +characters which will reference the whole matched portion +of the pattern space. +To include a literal @code{\}, @code{&}, or newline in the final +replacement, be sure to precede the desired @code{\}, @code{&}, +or newline in the @var{replacement} with a @code{\}. + +@findex s command, option flags +@cindex Substitution of text, options +@cindex Replacing text matching regexp, options +The @code{s} command can be followed with zero or more of the +following @var{flags}: + +@table @samp +@item g +@cindex Global substitution +@cindex Replacing all text matching regexp in a line +Apply the replacement to @emph{all} matches to the @var{regexp}, +not just the first. +@item p +@cindex Printing text after substitution +If the substitution was made, then print the new pattern space. +@item @var{number} +@cindex Replacing only @var{n}th match of regexp in a line +Only replace the @var{number}th match of the @var{regexp}. +@item w @var{file-name} +@cindex Write result of a substitution to file +If the substitution was made, then write out the result to the named file. +@item I +(This is a @sc{GNU} extension.) + +@cindex @sc{GNU} extensions, @code{I} modifier +@cindex Case-insensitive matching +Match @var{regexp} in a case-insensitive manner. +@end table + +@item q +[At most one address allowed.] + +@findex q (quit) command +@cindex Quitting +Exit @sc{sed} without processing any more commands or input. +Note that the current pattern space is printed +if auto-print is not disabled. + +@item d +@findex d (delete) command +@cindex Deleting lines +Delete the pattern space; +immediately start next cycle. + +@item p +@findex p (print) command +@cindex Print selected lines +Print out the pattern space (to the standard output). +This command is usually only used in conjunction with the @code{-n} +command-line option. + +@cindex Caveat --- @code{p} command and -n flag +Note: some implementations of @sc{sed}, such as this one, will +double-print lines when auto-print is not disabled and the @code{p} +command is given. +Other implementations will only print the line once. +Both ways conform with the POSIX.2 standard, and so neither +way can be considered to be in error. +@cindex Portability, @code{p} command and -n flag +Portable @sc{sed} scripts should thus avoid relying on either behavior; +either use the @code{-n} option and explicitly print what you want, +or avoid use of the @code{p} command (and also the @code{p} flag to the +@code{s} command). + +@item n +@findex n (next-line) command +@cindex Next input line, replace pattern space with +@cindex Read next input line +If auto-print is not disabled, print the pattern space, +then, regardless, replace the pattern space with the next line of input. +If there is no more input then @sc{sed} exits without processing +any more commands. + +@item @{ @var{commands} @} +@findex @{@} command grouping +@cindex Grouping commands +@cindex Command groups +A group of commands may be enclosed between +@code{@{} and @code{@}} characters. +(The @code{@}} must appear in a zero-address command context.) +This is particularly useful when you want a group of commands +to be triggered by a single address (or address-range) match. + +@end table + + +@node Other Commands, Programming Commands, Common Commands, sed Programs +@section Less frequently used commands + +Though perhaps less frequently used than those in the previous +section, some very small yet useful @sc{sed} scripts can be built with +these commands. + +@table @samp +@item y/@var{source-chars}/@var{dest-chars}/ +(The @code{/} characters may be uniformly replaced by +any other single character within any given @code{y} command.) + +@findex y (transliterate) command +@cindex Transliteration +Transliterate any characters in the pattern space which match +any of the @var{source-chars} with the corresponding character +in @var{dest-chars}. + +Instances of the @code{/} (or whatever other character is used in its stead), +@code{\}, or newlines can appear in the @var{source-chars} or @var{dest-chars} +lists, provide that each instance is escaped by a @code{\}. +The @var{source-chars} and @var{dest-chars} lists @emph{must} +contain the same number of characters (after de-escaping). + +@c XXX was getting a bad page break; remove this @need if formatting changes +@need 1000 +@item a\ +@itemx @var{text} +[At most one address allowed.] + +@findex a (append text lines) command +@cindex Adding a block of text after a line +@cindex Text, appending +Queue the lines of text which follow this command +(each but the last ending with a @code{\}, +which will be removed from the output) +to be output at the end of the current cycle, +or when the next input line is read. + +@item i\ +@itemx @var{text} +[At most one address allowed.] + +@findex i (insert text lines) command +@cindex Inserting a block of text before a line +@cindex Text, insertion +Immediately output the lines of text which follow this command +(each but the last ending with a @code{\}, +which will be removed from the output). + +@item c\ +@itemx @var{text} +@findex c (change to text lines) command +@cindex Replace specific input lines +@cindex Selected lines, replacing +Delete the lines matching the address or address-range, +and output the lines of text which follow this command +(each but the last ending with a @code{\}, +which will be removed from the output) +in place of the last line +(or in place of each line, if no addresses were specified). +A new cycle is started after this command is done, +since the pattern space will have been deleted. + +@item = +[At most one address allowed.] + +@findex = (print line number) command +@cindex Print line number +@cindex Line number, print +Print out the current input line number (with a trailing newline). + +@item l +@findex l (list unambiguously) command +@cindex List pattern space +@cindex Print unambiguous representation of pattern space +Print the pattern space in an unambiguous form: +non-printable characters (and the @code{\} character) +are printed in C-style escaped form; +long lines are split, with a trailing @code{\} character +to indicate the split; the end of each line is marked +with a @code{$}. + +@item r @var{filename} +[At most one address allowed.] + +@findex r (read file) command +@cindex Read text from a file +@cindex Insert text from a file +Queue the contents of @var{filename} to be read and +inserted into the output stream at the end of the current cycle, +or when the next input line is read. +Note that if @var{filename} cannot be read, it is treated as +if it were an empty file, without any error indication. + +@item w @var{filename} +@findex w (write file) command +@cindex Write to a file +Write the pattern space to @var{filename}. +The @var{filename} will be created (or truncated) before the +first input line is read; all @code{w} commands (including +instances of @code{w} flag on successful @code{s} commands) +which refer to the same @var{filename} are output through +the same @sc{FILE} stream. + +@item D +@findex D (delete first line) command +@cindex Delete first line from pattern space +Delete text in the pattern space up to the first newline. +If any text is left, restart cycle with the resultant +pattern space (without reading a new line of input), +otherwise start a normal new cycle. + +@item N +@findex N (append Next line) command +@cindex Next input line, append to pattern space +@cindex Append next input line to pattern space +Add a newline to the pattern space, +then append the next line of input to the pattern space. +If there is no more input then @sc{sed} exits without processing +any more commands. + +@item P +@findex P (print first line) command +@cindex Print first line from pattern space +Print out the portion of the pattern space up to the first newline. + +@item h +@findex h (hold) command +@cindex Copy pattern space into hold space +@cindex Replace hold space with copy of pattern space +@cindex Hold space, copying pattern space into +Replace the contents of the hold space with the contents of the pattern space. + +@item H +@findex H (append Hold) command +@cindex Append pattern space to hold space +@cindex Hold space, appending from pattern space +Append a newline to the contents of the hold space, +and then append the contents of the pattern space to that of the hold space. + +@item g +@findex g (get) command +@cindex Copy hold space into pattern space +@cindex Replace pattern space with copy of hold space +@cindex Hold space, copy into pattern space +Replace the contents of the pattern space with the contents of the hold space. + +@item G +@findex G (appending Get) command +@cindex Append hold space to pattern space +@cindex Hold space, appending to pattern space +Append a newline to the contents of the pattern space, +and then append the contents of the hold space to that of the pattern space. + +@item x +@findex x (eXchange) command +@cindex Exchange hold space with pattern space +@cindex Hold space, exchange with pattern space +Exchange the contents of the hold and pattern spaces. + +@end table + + +@node Programming Commands, , Other Commands, sed Programs +@section Commands for die-hard @sc{sed} programmers + +In most cases, use of these commands indicates that you are +probably better off programming in something like @sc{perl}. +But occasionally one is committed to sticking with @sc{sed}, +and these commands can enable one to write quite convoluted +scripts. + +@cindex Flow of control in scripts +@table @samp +@item : @var{label} +[No addresses allowed.] + +@findex : (label) command +@cindex Labels, in scripts +Specify the location of @var{label} for the @code{b} and @code{t} commands. +In all other respects, a no-op. + +@item b @var{label} +@findex b (branch) command +@cindex Branch to a label, unconditionally +@cindex Goto, in scripts +Unconditionally branch to @var{label}. +The @var{label} may be omitted, in which case the next cycle is started. + +@item t @var{label} +@findex t (conditional branch) command +@cindex Branch to a label, if @code{s///} succeeded +@cindex Conditional branch +Branch to @var{label} only if there has been a successful @code{s}ubstitution +since the last input line was read or @code{t} branch was taken. +The @var{label} may be omitted, in which case the next cycle is started. + +@end table + + +@node Examples, Limitations, sed Programs, Top +@chapter Some sample scripts + +@c XXX FIXME +[[Not this release, sorry. +But check out the scripts in the testsuite directory, +and the amazing dc.sed script in the +top-level directory of this distribution.]] + + +@node Limitations, Other Resources, Examples, Top +@chapter About the (non-)limitations on line length + +@cindex @sc{GNU} extensions, unlimited line length +@cindex Portability, line length limitations +For those who want to write portable @sc{sed} scripts, +be aware that some implementations have been known to +limit line lengths (for the pattern and hold spaces) +to be no more than 4000 bytes. +The POSIX.2 standard specifies that conforming @sc{sed} +implementations shall support at least 8192 byte line lengths. +@sc{GNU} @sc{sed} has no built-in limit on line length; +as long as @sc{sed} can malloc() more (virtual) memory, +it will allow lines as long as you care to feed it +(or construct within it). + +@node Other Resources, Reporting Bugs, Limitations, Top +@chapter Other resources for learning about @sc{sed} + +@cindex Addtional reading about @sc{sed} +In addition to several books that have been written about @sc{sed} +(either specifically or as chapters in books which discuss +shell programming), one can find out more about @sc{sed} +(including suggestions of a few books) from the FAQ +for the seders mailing list, available from any of: +@display + @uref{http://www.dbnet.ece.ntua.gr/~george/sed/sedfaq.html} + @uref{http://www.ptug.org/sed/sedfaq.htm} +@end display +Also of interest is @uref{http://seders.icheme.org/tutorials/}. + +There is an informal ``seders'' mailing list manually maintained +by Al Aab. To subscribe, send e-mail to @email{af137@@torfree.net} +with a brief description of your interest. + +@node Reporting Bugs, Concept Index, Other Resources, Top +@chapter Reporting bugs + +@cindex Bugs, reporting +Email bug reports to @email{bug-gnu-utils@@gnu.org}. +Be sure to include the word ``sed'' somewhere in the ``Subject:'' field. + +@c XXX FIXME: the term "cycle" is never defined... + +@page +@node Concept Index, Command and Option Index, Reporting Bugs, Top +@unnumbered Concept Index + +This is a general index of all issues discussed in this manual, with the +exception of the @sc{sed} commands and command-line options. + +@printindex cp + +@page +@node Command and Option Index, , Concept Index, Top +@unnumbered Command and Option Index + +This is an alphabetical list of all @sc{sed} commands and command-line +opions. + +@printindex fn + +@contents +@bye diff --git a/install-sh b/install-sh deleted file mode 100644 index 2c212ccf..00000000 --- a/install-sh +++ /dev/null @@ -1,250 +0,0 @@ -#! /bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). -# -# Copyright 1991 by the Massachusetts Institute of Technology -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. -# - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/m4/progtest.m4 b/m4/progtest.m4 index 2482d4a9..fbc62ccc 100644 --- a/m4/progtest.m4 +++ b/m4/progtest.m4 @@ -1,5 +1,6 @@ # Search path for a program which passes the given test. # Ulrich Drepper <drepper@cygnus.com>, 1996. +# update to support dos # # This file can be copied and used freely without restrictions. It can # be used in projects which are not available under the GNU Public License @@ -16,14 +17,14 @@ set dummy $2; ac_word=[$]2 AC_MSG_CHECKING([for $ac_word]) AC_CACHE_VAL(ac_cv_path_$1, [case "[$]$1" in - /*) + /*|[A-Z]:/*) ac_cv_path_$1="[$]$1" # Let the user override the test with a path. ;; *) IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" for ac_dir in ifelse([$5], , $PATH, [$5]); do test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$ac_word; then + if test $ac_x $ac_dir/$ac_word; then if [$3]; then ac_cv_path_$1="$ac_dir/$ac_word" break diff --git a/missing b/missing deleted file mode 100644 index a6abd069..00000000 --- a/missing +++ /dev/null @@ -1,134 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. -# Copyright (C) 1996, 1997 Free Software Foundation, Inc. -# Franc,ois Pinard <pinard@iro.umontreal.ca>, 1996. - -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -case "$1" in - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - automake touch all \`Makefile.in' files - bison touch file \`y.tab.c' - makeinfo touch the output file - yacc touch file \`y.tab.c'" - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing - GNU libit 0.0" - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - - aclocal) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`acinclude.m4' or \`configure.in'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`configure.in'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`acconfig.h' or \`configure.in'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - touch config.h.in - ;; - - automake) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`configure.in'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print \ - | sed 's/^\(.*\).am$/touch \1.in/' \ - | sh - ;; - - bison|yacc) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - touch y.tab.c - ;; - - makeinfo) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` - fi - touch $file - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and you do not seem to have it handy on your - system. You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequirements for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 diff --git a/mkinstalldirs b/mkinstalldirs deleted file mode 100644 index ae0de648..00000000 --- a/mkinstalldirs +++ /dev/null @@ -1,40 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman <friedman@prep.ai.mit.edu> -# Created: 1993-05-16 -# Public domain - -# $Id: mkinstalldirs,v 1.1 1998/11/03 21:38:54 alainm Exp $ - -errstatus=0 - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" 1>&2 - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# mkinstalldirs ends here diff --git a/src/Makefile.am b/src/Makefile.am index 47f54bc7..4924a7bd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -20,19 +20,7 @@ datadir = $(prefix)/@DATADIRNAME@ localedir = $(datadir)/locale INCLUDES = -I../intl -DLOCALEDIR=\"$(localedir)\" -man_MANS = grep.1 fgrep.1 egrep.1 - -EXTRA_DIST = grep.1 egrep.man fgrep.man \ - regex.h \ +EXTRA_DIST = regex.h \ dosbuf.c \ - vms_fab.c vms_fab.h - -CLEANFILES = egrep.1 fgrep.1 - -fgrep.1: fgrep.man - inst=`echo "grep" | sed '$(transform)'`.1; \ -sed -e "s%@grep@%$$inst%g" $(srcdir)/fgrep.man > $@ + vms_fab.c vms_fab.h -egrep.1: egrep.man - inst=`echo "grep" | sed '$(transform)'`.1; \ -sed -e "s%@grep@%$$inst%g" $(srcdir)/egrep.man > $@ diff --git a/src/regex.c b/src/regex.c index 6c692914..ba01f735 100644 --- a/src/regex.c +++ b/src/regex.c @@ -1735,7 +1735,7 @@ typedef struct # define IS_CHAR_CLASS(string) wctype (string) # endif #else -# define CHAR_CLASS_MAX_LENGTH 256 /* Namely, `xdigit'. */ +# define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */ # define IS_CHAR_CLASS(string) \ (STREQ (string, "alpha") || STREQ (string, "upper") \ @@ -2210,10 +2210,13 @@ regex_compile (pattern, size, syntax, bufp) for (;;) { PATFETCH (c); - if ((c == ':' && *p == ']') || p == pend - || c1 == CHAR_CLASS_MAX_LENGTH) + if ((c == ':' && *p == ']') || p == pend) break; - str[c1++] = c; + if (c1 < CHAR_CLASS_MAX_LENGTH) + str[c1++] = c; + else + /* This is in any case an invalid class name. */ + str[0] = '\0'; } str[c1] = '\0'; @@ -5594,10 +5597,6 @@ re_exec (s) It returns 0 if it succeeds, nonzero if it doesn't. (See regex.h for the return codes and their meanings.) */ -#ifdef __APPLE__ -__private_extern__ -#endif - int regcomp (preg, pattern, cflags) regex_t *preg; @@ -5689,10 +5688,6 @@ weak_alias (__regcomp, regcomp) We return 0 if we find a match and REG_NOMATCH if not. */ -#ifdef __APPLE__ -__private_extern__ -#endif - int regexec (preg, string, nmatch, pmatch, eflags) const regex_t *preg; @@ -5760,9 +5755,6 @@ weak_alias (__regexec, regexec) /* Returns a message corresponding to an error code, ERRCODE, returned from either regcomp or regexec. We don't use PREG here. */ -#ifdef __APPLE__ -__private_extern__ -#endif size_t regerror (errcode, preg, errbuf, errbuf_size) int errcode; @@ -5809,9 +5801,7 @@ weak_alias (__regerror, regerror) /* Free dynamically allocated space used by PREG. */ -#ifdef __APPLE__ -__private_extern__ -#endif + void regfree (preg) regex_t *preg; diff --git a/tests/Makefile.am b/tests/Makefile.am index 3df9386f..dbe1ae16 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -2,8 +2,11 @@ AWK=@AWK@ -TESTS = warning.sh khadafy.sh spencer1.sh spencer2.sh status.sh empty.sh -EXTRA_DIST = $(TESTS) khadafy.lines khadafy.regexp \ - scriptgen.awk spencer1.tests spencer2.tests -CLEANFILES = tmp1.script tmp2.script khadafy.out +TESTS = warning.sh khadafy.sh spencer1.sh bre.sh ere.sh \ + status.sh empty.sh options.sh +EXTRA_DIST = $(TESTS) \ + khadafy.lines khadafy.regexp \ + spencer1.awk spencer1.tests \ + bre.awk ere.awk bre.tests ere.tests +CLEANFILES = spencer1.script bre.script ere.script khadafy.out TESTS_ENVIRONMENT = GREP=$(top_builddir)/src/grep AWK=$(AWK) diff --git a/tests/scriptgen.awk b/tests/scriptgen.awk index e65f114a..b66b8f5f 100644 --- a/tests/scriptgen.awk +++ b/tests/scriptgen.awk @@ -1,9 +1,14 @@ -BEGIN {FS = "@"; print "failures=0" } +BEGIN { + FS = "@"; + printf ("failures=0\n"); +} + $0 !~ /^#/ && NF = 3 { - printf("echo '%s'|${GREP} -E -e '%s' > /dev/null 2>&1\n",$3, $2); - printf("if test $? -ne %s ; then\n", $1) - printf "\techo Spencer test \\#%d failed\n", ++n - print "\tfailures=1" - print "fi" + printf ("echo '%s'|${GREP} -E -e '%s' > /dev/null 2>&1\n",$3, $2); + printf ("if test $? -ne %s ; then\n", $1); + printf ("\techo Spencer test \\#%d failed\n", ++n); + printf ("\tfailures=1\n"); + printf ("fi\n"); } -END { print "exit $failures"; } + +END { printf ("exit $failures\n"); } diff --git a/tests/spencer1.sh b/tests/spencer1.sh index 7307d1ee..f09b3fa9 100644 --- a/tests/spencer1.sh +++ b/tests/spencer1.sh @@ -7,7 +7,7 @@ failures=0 # . . . and the following by Henry Spencer. -${AWK-awk} -f $srcdir/scriptgen.awk $srcdir/spencer1.tests > tmp1.script +${AWK-awk} -f $srcdir/spencer1.awk $srcdir/spencer1.tests > spencer1.script -sh tmp1.script && exit $failures +sh spencer1.script && exit $failures exit 1 |