aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog22
-rw-r--r--manual/contrib.texi434
-rw-r--r--manual/header.texi2
-rw-r--r--manual/install.texi375
-rw-r--r--manual/libc.texinfo11
-rw-r--r--manual/maint.texi792
-rw-r--r--manual/process.texi16
-rw-r--r--posix/wordexp.c430
8 files changed, 1059 insertions, 1023 deletions
diff --git a/ChangeLog b/ChangeLog
index 31b91d2a4f..87a4bafa7e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+1998-03-18 00:25 Tim Waugh <tim@cyberelk.demon.co.uk>
+
+ * posix/wordexp.c (parse_comm): Allow quoting inside $(...).
+ (parse_param): Fold in Andreas' fixes to do with when the end of
+ the parameter name has been reached, and quoting inside ${...}.
+ (parse_dollars): Fix differentiation between $(((1+3)*(4-2))) and
+ $((echo);(ls)).
+
+1998-03-16 22:10 Zack Weinberg <zack@rabi.phys.columbia.edu>
+
+ * manual/maint.texi: Split out installation and contribution
+ sections to their own appendices. Misc cleanups.
+ * manual/install.texi: New file. Mention add-ons. Refer to FAQ.
+ * manual/contrib.texi: New file.
+ * manual/libc.texinfo: Pull in new appendices.
+ * manual/header.texi: Correct node pointer.
+
+1998-03-17 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * manual/process.texi (Process Completion): Clarify return value
+ of waitpid a bit. Patch by Zack Weinberg. [PR libc/490]
+
1998-03-15 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* posix/wordexp-test.c: Add more tests.
diff --git a/manual/contrib.texi b/manual/contrib.texi
new file mode 100644
index 0000000000..11c0dd2c2d
--- /dev/null
+++ b/manual/contrib.texi
@@ -0,0 +1,434 @@
+@node Contributors, Copying, Maintenance, Top
+@appendix Contributors to the GNU C Library
+
+The GNU C library was written originally by Roland McGrath, and is
+currently maintained by Ulrich Drepper. Some parts of the library were
+contributed or worked on by other people.
+
+@itemize @bullet
+@item
+The @code{getopt} function and related code were written by
+Richard Stallman, @w{David J.} MacKenzie, and @w{Roland McGrath}.
+
+@item
+The merge sort function @code{qsort} was written by Michael J. Haertel.
+
+@item
+The quick sort function used as a fallback by @code{qsort} was written
+by Douglas C. Schmidt.
+
+@item
+The memory allocation functions @code{malloc}, @code{realloc} and
+@code{free} and related code were written by Michael J. Haertel,
+@w{Wolfram Gloger}, and @w{Doug Lea}.
+
+@item
+Fast implementations of many of the string functions (@code{memcpy},
+@code{strlen}, etc.) were written by Torbj@"orn Granlund.
+
+@item
+The @file{tar.h} header file was written by David J. MacKenzie.
+
+@item
+The port to the MIPS DECStation running Ultrix 4
+(@code{mips-dec-ultrix4})
+was contributed by Brendan Kehoe and Ian Lance Taylor.
+
+@item
+The DES encryption function @code{crypt} and related functions were
+contributed by Michael Glad.
+
+@item
+The @code{ftw} and @code{nftw} functions were contributed by Ulrich Drepper.
+
+@item
+The startup code to support SunOS shared libraries was contributed by
+Tom Quinn.
+
+@item
+The @code{mktime} function was contributed by Paul Eggert.
+
+@item
+The port to the Sequent Symmetry running Dynix version 3
+(@code{i386-sequent-bsd}) was contributed by Jason Merrill.
+
+@item
+The timezone support code is derived from the public-domain timezone
+package by Arthur David Olson and his many contributors.
+
+@item
+The port to the DEC Alpha running OSF/1 (@code{alpha-dec-osf1}) was
+contributed by Brendan Kehoe, using some code written by Roland McGrath.
+
+@item
+The port to SGI machines running Irix 4 (@code{mips-sgi-irix4}) was
+contributed by Tom Quinn.
+
+@item
+The port of the Mach and Hurd code to the MIPS architecture
+(@code{mips-@var{anything}-gnu}) was contributed by Kazumoto Kojima.
+
+@item
+The floating-point printing function used by @code{printf} and friends
+and the floating-point reading function used by @code{scanf},
+@code{strtod} and friends were written by Ulrich Drepper. The
+multi-precision integer functions used in those functions are taken from
+GNU MP, which was contributed by Torbj@"orn Granlund.
+
+@item
+The internationalization support in the library, and the support
+programs @code{locale} and @code{localedef}, were written by Ulrich
+Drepper. Ulrich Drepper adapted the support code for message catalogs
+(@file{libintl.h}, etc.) from the GNU @code{gettext} package, which he
+also wrote. He also contributed the @code{catgets} support and the
+entire suite of multi-byte and wide-character support functions
+(@file{wctype.h}, @file{wchar.h}, etc.).
+
+@item
+The implementations of the @file{nsswitch.conf} mechanism and the files
+and DNS backends for it were designed and written by Ulrich Drepper and
+Roland McGrath, based on a backend interface defined by Peter Eriksson.
+
+@item
+The port to Linux i386/ELF (@code{i386-@var{anything}-linux}) was
+contributed by Ulrich Drepper, based in large part on work done in
+Hongjiu Lu's Linux version of the GNU C Library.
+
+@item
+The port to Linux/m68k (@code{m68k-@var{anything}-linux}) was
+contributed by Andreas Schwab.
+
+@item
+The ports to Linux/ARM (@code{arm-@var{ANYTHING}-linuxaout}) and ARM
+standalone (@code{arm-@var{ANYTHING}-none}), as well as parts of the
+IPv6 support code, were contributed by Philip Blundell.
+
+@item
+Richard Henderson contributed the ELF dynamic linking code and other
+support for the Alpha processor.
+
+@item
+David Mosberger-Tang contributed the port to Linux/Alpha
+(@code{alpha-@var{anything}-linux}).
+
+@item
+The port to Linux on PowerPC (@code{powerpc-@var{anything}-linux})
+was contributed by Geoffrey Keating.
+
+@item
+Miles Bader wrote the argp argument-parsing package, and the argz/envz
+interfaces.
+
+@item
+Stephen R. van den Berg contributed a highly-optimized @code{strstr} function.
+
+@item
+Ulrich Drepper contributed the @code{hsearch} and @code{drand48}
+families of functions; reentrant @samp{@dots{}@code{_r}} versions of the
+@code{random} family; System V shared memory and IPC support code; and
+several highly-optimized string functions for i@var{x}86 processors.
+
+@item
+The math functions are taken from @code{fdlibm-5.1} by Sun
+Microsystems, as modified by J.T. Conklin, Ian Lance Taylor,
+Ulrich Drepper, Andreas Schwab, and Roland McGrath.
+
+@item
+The @code{libio} library used to implement @code{stdio} functions on
+some platforms was written by Per Bothner and modified by Ulrich Drepper.
+
+@item
+Eric Youngdale and Ulrich Drepper implemented versioning of objects on
+ symbol level.
+
+@item
+Thorsten Kukuk provided an implementation for NIS (YP) and NIS+,
+securelevel 0, 1 and 2.
+
+@item
+Andreas Jaeger provided a test suite for the math library.
+
+@item
+Mark Kettenis implemented the utmpx interface and an utmp daemon.
+
+@item
+Ulrich Drepper added character conversion functions (@code{iconv}).
+
+@item
+Thorsten Kukuk provided an implementation for a caching daemon for NSS
+(nscd).
+
+@item
+Tim Waugh provided an implementation of the POSIX.2 wordexp function family.
+
+@item
+Mark Kettenis provided a Hesiod NSS module.
+
+@item
+The Internet-related code (most of the @file{inet} subdirectory) and
+several other miscellaneous functions and header files have been
+included from 4.4 BSD with little or no modification.
+
+All code incorporated from 4.4 BSD is under the following copyright:
+
+@quotation
+@display
+Copyright @copyright{} 1991 Regents of the University of California.
+All rights reserved.
+@end display
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+@enumerate
+@item
+Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+@item
+Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+@item
+All advertising materials mentioning features or use of this software
+must display the following acknowledgement:
+@quotation
+This product includes software developed by the University of
+California, Berkeley and its contributors.
+@end quotation
+@item
+Neither the name of the University nor the names of its contributors
+may be used to endorse or promote products derived from this software
+without specific prior written permission.
+@end enumerate
+
+@sc{this software is provided by the regents and contributors ``as is'' and
+any express or implied warranties, including, but not limited to, the
+implied warranties of merchantability and fitness for a particular purpose
+are disclaimed. in no event shall the regents or contributors be liable
+for any direct, indirect, incidental, special, exemplary, or consequential
+damages (including, but not limited to, procurement of substitute goods
+or services; loss of use, data, or profits; or business interruption)
+however caused and on any theory of liability, whether in contract, strict
+liability, or tort (including negligence or otherwise) arising in any way
+out of the use of this software, even if advised of the possibility of
+such damage.}
+@end quotation
+
+@item
+The random number generation functions @code{random}, @code{srandom},
+@code{setstate} and @code{initstate}, which are also the basis for the
+@code{rand} and @code{srand} functions, were written by Earl T. Cohen
+for the University of California at Berkeley and are copyrighted by the
+Regents of the University of California. They have undergone minor
+changes to fit into the GNU C library and to fit the @w{ISO C} standard,
+but the functional code is Berkeley's.@refill
+
+@item
+The DNS resolver code is taken directly from BIND 4.9.5, which is
+under both the Berkeley copyright above and also:
+
+@quotation
+Portions Copyright @copyright{} 1993 by Digital Equipment Corporation.
+
+Permission to use, copy, modify, and distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies, and
+that the name of Digital Equipment Corporation not be used in
+advertising or publicity pertaining to distribution of the document or
+software without specific, written prior permission.
+
+@sc{the software is provided ``as is'' and digital equipment corp.
+disclaims all warranties with regard to this software, including all
+implied warranties of merchantability and fitness. in no event shall
+digital equipment corporation be liable for any special, direct,
+indirect, or consequential damages or any damages whatsoever resulting
+from loss of use, data or profits, whether in an action of contract,
+negligence or other tortious action, arising out of or in connection
+with the use or performance of this software.}
+@end quotation
+
+@item
+The code to support Sun RPC is taken verbatim from Sun's
+@w{@sc{rpcsrc-4.0}} distribution, and is covered by this copyright:
+
+@quotation
+@display
+Copyright @copyright{} 1984, Sun Microsystems, Inc.
+@end display
+
+Sun RPC is a product of Sun Microsystems, Inc. and is provided for
+unrestricted use provided that this legend is included on all tape media
+and as a part of the software program in whole or part. Users may copy
+or modify Sun RPC without charge, but are not authorized to license or
+distribute it to anyone else except as part of a product or program
+developed by the user.
+
+@sc{sun rpc is provided as is with no warranties of any kind including the
+warranties of design, merchantibility and fitness for a particular
+purpose, or arising from a course of dealing, usage or trade practice.}
+
+Sun RPC is provided with no support and without any obligation on the
+part of Sun Microsystems, Inc. to assist in its use, correction,
+modification or enhancement.
+
+@sc{sun microsystems, inc. shall have no liability with respect to the
+infringement of copyrights, trade secrets or any patents by sun rpc
+or any part thereof.}
+
+In no event will Sun Microsystems, Inc. be liable for any lost revenue
+or profits or other special, indirect and consequential damages, even if
+Sun has been advised of the possibility of such damages.
+
+@display
+Sun Microsystems, Inc.
+2550 Garcia Avenue
+Mountain View, California 94043
+@end display
+@end quotation
+
+@item
+Some of the support code for Mach is taken from Mach 3.0 by CMU,
+and is under the following copyright terms:
+
+@quotation
+@display
+Mach Operating System
+Copyright @copyright{} 1991,1990,1989 Carnegie Mellon University
+All Rights Reserved.
+@end display
+
+Permission to use, copy, modify and distribute this software and its
+documentation is hereby granted, provided that both the copyright
+notice and this permission notice appear in all copies of the
+software, derivative works or modified versions, and any portions
+thereof, and that both notices appear in supporting documentation.
+
+@sc{carnegie mellon allows free use of this software in its ``as is''
+condition. carnegie mellon disclaims any liability of any kind for
+any damages whatsoever resulting from the use of this software.}
+
+Carnegie Mellon requests users of this software to return to
+
+@display
+ Software Distribution Coordinator
+ School of Computer Science
+ Carnegie Mellon University
+ Pittsburgh PA 15213-3890
+@end display
+
+@noindent
+or @email{Software.Distribution@@CS.CMU.EDU} any improvements or
+extensions that they make and grant Carnegie Mellon the rights to
+redistribute these changes.
+@end quotation
+
+@item
+The code for the database library @file{libdb} comes from the 2.3
+release of Berkeley DB. That code is under the same copyright as 4.4 BSD
+and also:
+
+@quotation
+@display
+Copyright @copyright{} 1990, 1993, 1994, 1995, 1996, 1997
+Sleepycat Software. All rights reserved.
+@end display
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+@enumerate
+@item
+Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+@item
+Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+@item
+Redistributions in any form must be accompanied by information on
+how to obtain complete source code for the DB software and any
+accompanying software that uses the DB software. The source code
+must either be included in the distribution or be available for no
+more than the cost of distribution plus a nominal fee, and must be
+freely redistributable under reasonable conditions. For an
+executable file, complete source code means the source code for all
+modules it contains. It does not mean source code for modules or
+files that typically accompany the operating system on which the
+executable file runs, e.g., standard library modules or system
+header files.
+@end enumerate
+
+@sc{this software is provided by sleepycat software ``as is'' and
+any express or implied warranties, including, but not limited to, the
+implied warranties of merchantability and fitness for a particular purpose
+are disclaimed. in no event shall sleepycat software be liable
+for any direct, indirect, incidental, special, exemplary, or consequential
+damages (including, but not limited to, procurement of substitute goods
+or services; loss of use, data, or profits; or business interruption)
+however caused and on any theory of liability, whether in contract, strict
+liability, or tort (including negligence or otherwise) arising in any way
+out of the use of this software, even if advised of the possibility of
+such damage.}
+
+@display
+Portions copyright @copyright{} 1995, 1996
+The President and Fellows of Harvard University.
+All rights reserved.
+@end display
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+@enumerate
+@item
+Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+@item
+Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution.
+@item
+All advertising materials mentioning features or use of this software
+must display the following acknowledgement:
+@quotation
+ This product includes software developed by Harvard University
+ and its contributors.
+@end quotation
+@item
+Neither the name of the University nor the names of its contributors
+may be used to endorse or promote products derived from this software
+without specific prior written permission.
+@end enumerate
+
+@sc{this software is provided by harvard and its contributors ``as is'' and
+any express or implied warranties, including, but not limited to, the
+implied warranties of merchantability and fitness for a particular purpose
+are disclaimed. in no event shall harvard or its contributors be liable
+for any direct, indirect, incidental, special, exemplary, or consequential
+damages (including, but not limited to, procurement of substitute goods
+or services; loss of use, data, or profits; or business interruption)
+however caused and on any theory of liability, whether in contract, strict
+liability, or tort (including negligence or otherwise) arising in any way
+out of the use of this software, even if advised of the possibility of
+such damage.}
+
+@noindent
+For a license to use, redistribute or sell DB software under conditions
+other than those described above, or to purchase support for this
+software, please contact Sleepycat Software at
+
+@display
+ Sleepycat Software
+ 394 E. Riding Dr.
+ Carlisle, MA 01741
+ USA
+ +1-508-287-4781
+@end display
+
+or @email{db@@sleepycat.com}.
+
+@end quotation
+
+@end itemize
diff --git a/manual/header.texi b/manual/header.texi
index 588d77eabf..066fdbf1aa 100644
--- a/manual/header.texi
+++ b/manual/header.texi
@@ -1,4 +1,4 @@
-@node Library Summary, Maintenance, Language Features, Top
+@node Library Summary, Installation, Language Features, Top
@appendix Summary of Library Facilities
This appendix is a complete list of the facilities declared within the
diff --git a/manual/install.texi b/manual/install.texi
new file mode 100644
index 0000000000..6f686c37a8
--- /dev/null
+++ b/manual/install.texi
@@ -0,0 +1,375 @@
+@c This is for making the `INSTALL' file for the distribution.
+@c Makeinfo ignores it when processing the file from the include.
+@setfilename INSTALL
+
+@node Installation, Maintenance, Library Summary, Top
+@appendix Installing the GNU C Library
+
+@menu
+* Tools for Installation:: We recommend using these tools to build.
+* Supported Configurations:: What systems the GNU C library runs on.
+* Reporting Bugs:: How to report bugs (if you want to
+ get them fixed) and other troubles
+ you may have with the GNU C library.
+@end menu
+
+Installation of the GNU C library is relatively simple, but usually
+requires several GNU tools to be installed already.
+@iftex
+(@pxref{Tools for Installation}, below.)
+@end iftex
+
+Before you do anything else, you should read the file @file{FAQ} found
+at the top level of the source tree. This file answers common questions
+and describes problems you may experience with compilation and
+installation. It is updated more frequently than this manual.
+
+To configure the GNU C library for your system, run the shell script
+@file{configure} with @code{sh}. Use an argument which is the
+conventional GNU name for your system configuration---for example,
+@samp{sparc-sun-sunos4.1}, for a Sun 4 running SunOS 4.1.
+@xref{Installation, Installation, Installing GNU CC, gcc.info, Using and
+Porting GNU CC}, for a full description of standard GNU configuration
+names. If you omit the configuration name, @file{configure} will try to
+guess one for you by inspecting the system it is running on. It may or
+may not be able to come up with a guess, and the its guess might be
+wrong. @file{configure} will tell you the canonical name of the chosen
+configuration before proceeding.
+
+Here are some options that you should specify (if appropriate) when
+you run @code{configure}:
+
+@table @samp
+@item --with-binutils=@var{directory}
+Use the binutils (assembler and linker) in @file{@var{directory}}, not
+the ones the C compiler would default to. You could use this option if
+the default binutils on your system cannot deal with all the constructs
+in the GNU C library. (@code{configure} will detect the problem and
+suppress these constructs, so the library will still be usable, but
+functionality may be lost---for example, you can not build a shared libc
+with old binutils.)
+
+@c extra blank line makes it look better
+@item --without-fp
+@itemx --nfp
+
+Use this option if your computer lacks hardware floating-point support
+and your operating system does not emulate an FPU.
+
+@item --prefix=@var{directory}
+Install machine-independent data files in subdirectories of
+@file{@var{directory}}. (You can also set this in @file{configparms};
+see below.) The default is to install in `/usr/local'.
+
+@item --exec-prefix=@var{directory}
+Install the library and other machine-dependent files in subdirectories
+of @file{@var{directory}}. (You can also set this in
+@file{configparms}; see below.) The default is to use <prefix>/bin
+and <prefix>/sbin.
+
+@item --enable-shared
+@itemx --disable-shared
+Enable or disable building of an ELF shared library on systems that
+support it. The default is to build the shared library on systems using
+ELF when the GNU @code{binutils} are available.
+
+@item --enable-profile
+@itemx --disable-profile
+Enable or disable building of the profiled C library, @samp{-lc_p}. The
+default is to build the profiled library. You may wish to disable it if
+you don't plan to do profiling, because it doubles the build time of
+compiling just the unprofiled static library.
+
+@item --enable-omitfp
+Enable building a highly-optimized but possibly undebuggable C
+library. This causes the normal static and shared (if enabled) C
+libraries to be compiled with maximal optimization, including the
+@samp{-fomit-frame-pointer} switch that makes debugging impossible on
+many machines, and without debugging information (which makes the
+binaries substantially smaller). An additional static library is
+compiled with no optimization and full debugging information, and
+installed as @samp{-lc_g}.
+
+@item --enable-add-ons[=LIST]
+Certain components of the C library are distributed separately from the
+rest of the sources. In particular, the @code{crypt} function and its
+friends are separated due to US export control regulations, and the
+threading support code for Linux is maintained separately. You can get
+these @dfn{add-on} packages from the same place you got the libc
+sources. To use them, unpack them into your source tree, and give
+@code{configure} the @samp{--enable-add-ons} option.
+
+If you do not wish to use some add-on package that you have present in
+your source tree, give this option a list of the add-ons that you
+@emph{do} want used, like this: @samp{--enable-add-ons=crypt,linuxthreads}
+@end table
+
+You should not build the library in the same directory as the sources,
+because there are bugs in @code{make clean}. Make a directory for the
+build, and run @code{configure} from that directory, like this:
+
+@smallexample
+mkdir sun4
+cd sun4
+../configure sparc-sun-sunos4.1
+@end smallexample
+
+@noindent
+@code{configure} looks for the sources in whatever directory you
+specified for finding @code{configure} itself. It does not matter where
+in the file system the source and build directories are---as long as you
+specify the source directory when you run @code{configure}, you will get
+the proper results.
+
+This feature lets you keep sources and binaries in different
+directories, and that makes it easy to build the library for several
+different machines from the same set of sources. Simply create a
+build directory for each target machine, and run @code{configure} in
+that directory specifying the target machine's configuration name.
+
+The library has a number of special-purpose configuration parameters.
+These are defined in the file @file{configparms}; see the comments in
+that file for the details. To change them, copy @file{configparms} into
+your build directory and modify it as appropriate for your system.
+@code{configure} will not notice your modifications if you change the
+file in the source directory.
+
+It is easy to configure the GNU C library for cross-compilation by
+setting a few variables in @file{configparms}. Set @code{CC} to the
+cross-compiler for the target you configured the library for; it is
+important to use this same @code{CC} value when running
+@code{configure}, like this: @samp{CC=@var{target}-gcc configure
+@var{target}}. Set @code{BUILD_CC} to the compiler to use for for
+programs run on the build system as part of compiling the library. You
+may need to set @code{AR} and @code{RANLIB} to cross-compiling versions
+of @code{ar} and @code{ranlib} if the native tools are not configured to
+work with object files for the target you configured for.
+
+Some of the machine-dependent code for some machines uses extensions in
+the GNU C compiler, so you may need to compile the library with GCC.
+(In fact, all of the existing complete ports require GCC.)
+
+
+To build the library and related programs, type @code{make}. This will
+produce a lot of output, some of which may look like errors from
+@code{make} (but isn't). Look for error messages from @code{make}
+containing @samp{***}. Those indicate that something is really wrong.
+
+To build and run some test programs which exercise some of the library
+facilities, type @code{make check}. This will produce several files
+with names like @file{@var{program}.out}.
+
+To format the @cite{GNU C Library Reference Manual} for printing, type
+@w{@code{make dvi}}. You need a working @TeX{} installation to do this.
+
+To install the library and its header files, and the Info files of the
+manual, type @code{make install}. This will build things if necessary,
+before installing them. If you want to install the files in a different
+place than the one specified at configuration time you can specify a
+value for the Makefile variable @code{install_root} on the command line.
+This is useful to create chroot'ed environment or to prepare binary
+releases.@refill
+
+@node Tools for Installation
+@appendixsec Recommended Tools to Install the GNU C Library
+@cindex installation tools
+@cindex tools, for installing library
+
+We recommend installing the following GNU tools before attempting to
+build the GNU C library:
+
+@itemize @bullet
+@item
+GNU @code{make} 3.75
+
+You need the latest version of GNU @code{make}. Modifying the GNU C
+Library to work with other @code{make} programs would be so hard that we
+recommend you port GNU @code{make} instead. @strong{Really.} We
+recommend version GNU @code{make} version 3.75. Versions 3.76 and
+3.76.1 are known to have bugs which only show up in big projects like
+GNU @code{libc}.
+
+@item
+GCC 2.7.2.3
+
+On most platforms, the GNU C library can only be compiled with the GNU C
+compiler. We recommend GCC version 2.7.2 or later; earlier versions may
+have problems.
+
+On PowerPC, GCC versions dated earlier than 970904 are known not to work
+(they crash), including 2.7.2.
+
+@item
+GNU @code{binutils} 2.8.1.0.23
+
+Using the GNU @code{binutils} (assembler, linker, and related tools) is
+preferable when possible, and they are required to build an ELF shared C
+library. Version 2.1 of the library uses ELF symbol versioning
+extensively. Support for this feature is incomplete or buggy before
+binutils 2.8.1.0.23, so you must use at least this version.
+
+@item
+GNU @code{texinfo} 3.11
+
+To correctly translate and install the Texinfo documentation you need
+this version of the @code{texinfo} package. Earlier versions do not
+understand all the tags used in the document, and the installation
+mechanisms for the info files is not present or works differently.
+
+On some Debian Linux based systems the @code{install-info} program
+supplied with the system works differently from the one we expect. You
+must therefore run @code{make install} like this:
+
+@smallexample
+make INSTALL_INFO=/path/to/GNU/install-info install
+@end smallexample
+
+@item
+GNU @code{awk} 3.0
+
+Several files used during the build are generated using features of GNU
+@code{awk} that are not found in other implementations.
+@c XXX: Does mawk work?
+@end itemize
+
+@noindent
+If you change any of the @file{configure.in} files you will also need
+
+@itemize @bullet
+@item
+GNU @code{autoconf} 2.12
+@end itemize
+
+@noindent
+and if you change any of the message translation files you will need
+
+@itemize @bullet
+@item
+GNU @code{gettext} 0.10 or later
+@end itemize
+
+@noindent
+You may also need these packages if you upgrade your source tree using
+patches, although we try to avoid this.
+
+
+@node Supported Configurations
+@appendixsec Supported Configurations
+@cindex configurations, all supported
+
+The GNU C Library currently supports configurations that match the
+following patterns:
+
+@smallexample
+alpha-@var{anything}-linux
+i@var{x}86-@var{anything}-gnu
+i@var{x}86-@var{anything}-linux
+m68k-@var{anything}-linux
+powerpc-@var{anything}-linux
+sparc-@var{anything}-linux
+sparc64-@var{anything}-linux
+@end smallexample
+
+Former releases of this library (version 1.09.1 and perhaps earlier
+versions) used to run on the following configurations:
+
+@smallexample
+alpha-dec-osf1
+alpha-@var{anything}-linuxecoff
+i@var{x}86-@var{anything}-bsd4.3
+i@var{x}86-@var{anything}-isc2.2
+i@var{x}86-@var{anything}-isc3.@var{n}
+i@var{x}86-@var{anything}-sco3.2
+i@var{x}86-@var{anything}-sco3.2v4
+i@var{x}86-@var{anything}-sysv
+i@var{x}86-@var{anything}-sysv4
+i@var{x}86-force_cpu386-none
+i@var{x}86-sequent-bsd
+i960-nindy960-none
+m68k-hp-bsd4.3
+m68k-mvme135-none
+m68k-mvme136-none
+m68k-sony-newsos3
+m68k-sony-newsos4
+m68k-sun-sunos4.@var{n}
+mips-dec-ultrix4.@var{n}
+mips-sgi-irix4.@var{n}
+sparc-sun-solaris2.@var{n}
+sparc-sun-sunos4.@var{n}
+@end smallexample
+
+Since no one has volunteered to test and fix these configurations,
+they are not supported at the moment. They probably don't compile;
+they definitely don't work anymore. Porting the library is not hard.
+If you are interested in doing a port, please contact the glibc
+maintainers by sending electronic mail to @email{bug-glibc@@gnu.org}.
+
+Each case of @samp{i@var{x}86} can be @samp{i386}, @samp{i486},
+@samp{i586}, or @samp{i686}. All of those configurations produce a
+library that can run on any of these processors. The library will be
+optimized for the specified processor, but will not use instructions not
+available on all of them.
+
+While no other configurations are supported, there are handy aliases for
+these few. (These aliases work in other GNU software as well.)
+
+@smallexample
+decstation
+hp320-bsd4.3 hp300bsd
+i486-gnu
+i586-linux
+i386-sco
+i386-sco3.2v4
+i386-sequent-dynix
+i386-svr4
+news
+sun3-sunos4.@var{n} sun3
+sun4-solaris2.@var{n} sun4-sunos5.@var{n}
+sun4-sunos4.@var{n} sun4
+@end smallexample
+
+@node Reporting Bugs
+@appendixsec Reporting Bugs
+@cindex reporting bugs
+@cindex bugs, reporting
+
+There are probably bugs in the GNU C library. There are certainly
+errors and omissions in this manual. If you report them, they will get
+fixed. If you don't, no one will ever know about them and they will
+remain unfixed for all eternity, if not longer.
+
+To report a bug, first you must find it. Hopefully, this will be the
+hard part. Once you've found a bug, make sure it's really a bug. A
+good way to do this is to see if the GNU C library behaves the same way
+some other C library does. If so, probably you are wrong and the
+libraries are right (but not necessarily). If not, one of the libraries
+is probably wrong.
+
+Once you're sure you've found a bug, try to narrow it down to the
+smallest test case that reproduces the problem. In the case of a C
+library, you really only need to narrow it down to one library
+function call, if possible. This should not be too difficult.
+
+The final step when you have a simple test case is to report the bug.
+When reporting a bug, send your test case, the results you got, the
+results you expected, what you think the problem might be (if you've
+thought of anything), your system type, and the version of the GNU C
+library which you are using. Also include the files
+@file{config.status} and @file{config.make} which are created by running
+@file{configure}; they will be in whatever directory was current when
+you ran @file{configure}.
+
+If you think you have found some way in which the GNU C library does not
+conform to the ISO and POSIX standards (@pxref{Standards and
+Portability}), that is definitely a bug. Report it!@refill
+
+Send bug reports to the Internet address
+@email{bug-glibc@@gnu.org}. If you have other problems
+with installation or use, please report those as well.@refill
+
+If you are not sure how a function should behave, and this manual
+doesn't tell you, that's a bug in the manual. Report that too! If the
+function's behavior disagrees with the manual, then either the library
+or the manual has a bug, so report the disagreement. If you find any
+errors or omissions in this manual, please report them to the Internet
+address @email{bug-glibc-manual@@gnu.org}.
diff --git a/manual/libc.texinfo b/manual/libc.texinfo
index 84bd6b7bc8..cf25e251d3 100644
--- a/manual/libc.texinfo
+++ b/manual/libc.texinfo
@@ -160,7 +160,9 @@ Appendices
* Library Summary:: A summary showing the syntax, header file,
and derivation of each library feature.
-* Maintenance:: How to install and maintain the GNU C Library.
+* Installation:: How to install the GNU C library.
+* Maintenance:: How to enhance and port the GNU C Library.
+* Contributors:: Who wrote what parts of the GNU C Library.
* Copying:: The GNU Library General Public License says
how you can copy and share the GNU C Library.
@@ -947,11 +949,8 @@ Library Maintenance
* Reporting Bugs:: How to report bugs (if you want to
get them fixed) and other troubles
you may have with the GNU C library.
-* Porting:: How to port the GNU C library to
- a new machine or operating system.
@c * Traditional C Compatibility:: Using the GNU C library with non-ANSI
@c C compilers.
-* Contributors:: Who wrote what parts of the GNU C Library.
Porting the GNU C Library
@@ -996,11 +995,13 @@ Porting the GNU C Library
@comment Includes of the appendices.
@include lang.texi
@include header.texi
+@include install.texi
@include maint.texi
+@include contrib.texi
@set lgpl-appendix
-@node Copying, Concept Index, Maintenance, Top
+@node Copying, Concept Index, Contributors, Top
@include lgpl.texinfo
diff --git a/manual/maint.texi b/manual/maint.texi
index 6225cb42e9..b8ae488c2f 100644
--- a/manual/maint.texi
+++ b/manual/maint.texi
@@ -1,384 +1,13 @@
-@c \input /gd/gnu/doc/texinfo
-@c This is for making the `INSTALL' file for the distribution.
-@c Makeinfo ignores it when processing the file from the include.
-@setfilename INSTALL
-
-@node Maintenance, Copying, Library Summary, Top
+@node Maintenance, Contributors, Installation, Top
@appendix Library Maintenance
@menu
-* Installation:: How to configure, compile and
- install the GNU C library.
-* Reporting Bugs:: How to report bugs (if you want to
- get them fixed) and other troubles
- you may have with the GNU C library.
* Source Layout:: How to add new functions or header files
to the GNU C library.
* Porting:: How to port the GNU C library to
a new machine or operating system.
-* Contributors:: Contributors to the GNU C Library.
-@end menu
-
-@node Installation
-@appendixsec How to Install the GNU C Library
-@cindex installing the library
-
-Installation of the GNU C library is relatively simple, but usually
-requires several GNU tools to be installed already.
-@iftex
-(@pxref{Tools for Installation}, below.)
-@end iftex
-
-@menu
-* Tools for Installation:: We recommend using these tools to build.
-* Supported Configurations:: What systems the GNU C library runs on.
@end menu
-To configure the GNU C library for your system, run the shell script
-@file{configure} with @code{sh}. Use an argument which is the
-conventional GNU name for your system configuration---for example,
-@samp{sparc-sun-sunos4.1}, for a Sun 4 running SunOS 4.1.
-@xref{Installation, Installation, Installing GNU CC, gcc.info, Using and
-Porting GNU CC}, for a full description of standard GNU configuration
-names. If you omit the configuration name, @file{configure} will try to
-guess one for you by inspecting the system it is running on. It may or
-may not be able to come up with a guess, and the its guess might be
-wrong. @file{configure} will tell you the canonical name of the chosen
-configuration before proceeding.
-
-Here are some options that you should specify (if appropriate) when
-you run @code{configure}:
-
-@table @samp
-@item --with-binutils=@var{directory}
-Use the binutils (assembler and linker) in @file{@var{directory}}, not
-the ones the C compiler would default to. You could use this option if
-the default binutils on your system cannot deal with all the constructs
-in the GNU C library. (@code{configure} will detect the problem and
-suppress these constructs, so the library will still be usable, but
-functionality may be lost---for example, you can not build a shared libc
-with old binutils.)
-
-@c extra blank line makes it look better
-@item --without-fp
-@itemx --nfp
-
-Use this option if your computer lacks hardware floating-point support
-and your operating system does not emulate an FPU.
-
-@item --prefix=@var{directory}
-Install machine-independent data files in subdirectories of
-@file{@var{directory}}. (You can also set this in @file{configparms};
-see below.) The default is to install in `/usr/local'.
-
-@item --exec-prefix=@var{directory}
-Install the library and other machine-dependent files in subdirectories
-of @file{@var{directory}}. (You can also set this in
-@file{configparms}; see below.) The default is to use <prefix>/bin
-and <prefix>/sbin.
-
-@item --enable-shared
-@itemx --disable-shared
-Enable or disable building of an ELF shared library on systems that
-support it. The default is to build the shared library on systems using
-ELF when the GNU @code{binutils} are available.
-
-@item --enable-profile
-@itemx --disable-profile
-Enable or disable building of the profiled C library, @samp{-lc_p}. The
-default is to build the profiled library. You may wish to disable it if
-you don't plan to do profiling, because it doubles the build time of
-compiling just the unprofiled static library.
-
-@item --enable-omitfp
-Enable building a highly-optimized but possibly undebuggable static C
-library. This causes the normal static and shared (if enabled) C
-libraries to be compiled with maximal optimization, including the
-@samp{-fomit-frame-pointer} switch that makes debugging impossible on
-many machines, and without debugging information (which makes the
-binaries substantially smaller). An additional static library is
-compiled with no optimization and full debugging information, and
-installed as @samp{-lc_g}.
-@end table
-
-The simplest way to run @code{configure} is to do it in the directory
-that contains the library sources. This prepares to build the library
-in that very directory.
-
-You can prepare to build the library in some other directory by going
-to that other directory to run @code{configure}. In order to run
-configure, you will have to specify a directory for it, like this:
-
-@smallexample
-mkdir sun4
-cd sun4
-../configure sparc-sun-sunos4.1
-@end smallexample
-
-@noindent
-@code{configure} looks for the sources in whatever directory you
-specified for finding @code{configure} itself. It does not matter where
-in the file system the source and build directories are---as long as you
-specify the source directory when you run @code{configure}, you will get
-the proper results.
-
-This feature lets you keep sources and binaries in different
-directories, and that makes it easy to build the library for several
-different machines from the same set of sources. Simply create a
-build directory for each target machine, and run @code{configure} in
-that directory specifying the target machine's configuration name.
-
-The library has a number of special-purpose configuration parameters.
-These are defined in the file @file{Makeconfig}; see the comments in
-that file for the details.
-
-But don't edit the file @file{Makeconfig} yourself---instead, create a
-file @file{configparms} in the directory where you are building the
-library, and define in that file the parameters you want to specify.
-@file{configparms} should @strong{not} be an edited copy of
-@file{Makeconfig}; specify only the parameters that you want to
-override. To see how to set these parameters, find the section of
-@file{Makeconfig} that says ``These are the configuration variables.''
-Then for each parameter that you want to change, copy the definition
-from @file{Makeconfig} to your new @file{configparms} file, and change
-the value as appropriate for your system.
-
-It is easy to configure the GNU C library for cross-compilation by
-setting a few variables in @file{configparms}. Set @code{CC} to the
-cross-compiler for the target you configured the library for; it is
-important to use this same @code{CC} value when running
-@code{configure}, like this: @samp{CC=@var{target}-gcc configure
-@var{target}}. Set @code{BUILD_CC} to the compiler to use for for
-programs run on the build system as part of compiling the library. You
-may need to set @code{AR} and @code{RANLIB} to cross-compiling versions
-of @code{ar} and @code{ranlib} if the native tools are not configured to
-work with object files for the target you configured for.
-
-Some of the machine-dependent code for some machines uses extensions in
-the GNU C compiler, so you may need to compile the library with GCC.
-(In fact, all of the existing complete ports require GCC.)
-
-
-To build the library and related programs, type @code{make}. This will
-produce a lot of output, some of which may look like errors from
-@code{make} (but isn't). Look for error messages from @code{make}
-containing @samp{***}. Those indicate that something is really wrong.
-
-To build and run some test programs which exercise some of the library
-facilities, type @code{make check}. This will produce several files
-with names like @file{@var{program}.out}.
-
-To format the @cite{GNU C Library Reference Manual} for printing, type
-@w{@code{make dvi}}. You need a working @TeX{} installation to do this.
-
-To install the library and its header files, and the Info files of the
-manual, type @code{make install}. This will build things if necessary,
-before installing them. If you want to install the files in a different
-place than the one specified at configuration time you can specify a
-value for the Makefile variable @code{install_root} on the command line.
-This is useful to create chroot'ed environment or to prepare binary
-releases.@refill
-
-@node Tools for Installation
-@appendixsubsec Recommended Tools to Install the GNU C Library
-@cindex installation tools
-@cindex tools, for installing library
-
-We recommend installing the following GNU tools before attempting to
-build the GNU C library:
-
-@itemize @bullet
-@item
-GNU @code{make} 3.75
-
-You need the latest version of GNU @code{make}. Modifying the GNU C
-Library to work with other @code{make} programs would be so hard that we
-recommend you port GNU @code{make} instead. @strong{Really.} We
-recommend version GNU @code{make} version 3.75. Versions 3.76 and
-3.76.1 are known to have bugs which only show up in big projects like
-GNU @code{libc}.
-
-@item
-GCC 2.7.2.3
-
-On most platforms, the GNU C library can only be compiled with the GNU C
-compiler. We recommend GCC version 2.7.2 or later; earlier versions may
-have problems.
-
-On PowerPC, GCC versions dated earlier than 970904 are known not to work
-(they crash), including 2.7.2.
-
-@item
-GNU @code{binutils} 2.8.1.0.17
-
-Using the GNU @code{binutils} (assembler, linker, and related tools) is
-preferable when possible, and they are required to build an ELF shared C
-library. We recommend @code{binutils} version 2.8.1 or later; earlier
-versions are known to have problems or to not support all architectures.
-
-@item
-GNU @code{texinfo} 3.11
-
-To correctly translate and install the Texinfo documentation you need
-this version of the @code{texinfo} package. Former versions did not
-understand all the tags used in the document and also the installation
-mechanisms for the info files was not present or worked differently.
-
-On some Debian Linux based systems the used @code{install-info} program
-works differently. Here you have to run make like this:
-
-@smallexample
-make INSTALL_INFO=/path/to/GNU/install-info install
-@end smallexample
-@end itemize
-
-If you change any configuration file you will need also
-
-@itemize @bullet
-@item
-GNU @code{autoconf} 2.12
-@end itemize
-
-@noindent
-and if you change any of the message translation files you will also need
-
-@itemize @bullet
-@item
-@code{GNU gettext} 0.10 or later
-@end itemize
-
-If any of the manual files changed you will need this
-
-@itemize @bullet
-@item
-GNU @code{awk} 3.0
-@end itemize
-
-@noindent
-If you upgrade your source tree using the patches made available you probably
-will need those package above in any case.
-
-
-@node Supported Configurations
-@appendixsubsec Supported Configurations
-@cindex configurations, all supported
-
-The GNU C Library currently supports configurations that match the
-following patterns:
-
-@smallexample
-alpha-@var{anything}-linux
-i@var{x}86-@var{anything}-gnu
-i@var{x}86-@var{anything}-linux
-m68k-@var{anything}-linux
-powerpc-@var{anything}-linux
-sparc64-@var{anything}-linux
-@end smallexample
-
-Former releases of this library (version 1.09.1 and perhaps earlier
-versions) used to run on the following configurations:
-
-@smallexample
-alpha-dec-osf1
-alpha-@var{anything}-linuxecoff
-i@var{x}86-@var{anything}-bsd4.3
-i@var{x}86-@var{anything}-isc2.2
-i@var{x}86-@var{anything}-isc3.@var{n}
-i@var{x}86-@var{anything}-sco3.2
-i@var{x}86-@var{anything}-sco3.2v4
-i@var{x}86-@var{anything}-sysv
-i@var{x}86-@var{anything}-sysv4
-i@var{x}86-force_cpu386-none
-i@var{x}86-sequent-bsd
-i960-nindy960-none
-m68k-hp-bsd4.3
-m68k-mvme135-none
-m68k-mvme136-none
-m68k-sony-newsos3
-m68k-sony-newsos4
-m68k-sun-sunos4.@var{n}
-mips-dec-ultrix4.@var{n}
-mips-sgi-irix4.@var{n}
-sparc-sun-solaris2.@var{n}
-sparc-sun-sunos4.@var{n}
-@end smallexample
-
-Since no one has volunteered to test and fix the above configurations,
-these are not supported at the moment. It's expected that these don't
-work anymore. Porting the library is not hard. If you are interested
-in doing a port, please contact the glibc maintainers by sending
-electronic mail to @email{bug-glibc@@gnu.org}.
-
-Each case of @samp{i@var{x}86} can be @samp{i386}, @samp{i486},
-@samp{i586}, or @samp{i686}. All of those configurations produce a
-library that can run on any of these processors. The library will be
-optimized for the specified processor, but will not use instructions not
-available on all of them.
-
-While no other configurations are supported, there are handy aliases for
-these few. (These aliases work in other GNU software as well.)
-
-@smallexample
-decstation
-hp320-bsd4.3 hp300bsd
-i486-gnu
-i586-linux
-i386-sco
-i386-sco3.2v4
-i386-sequent-dynix
-i386-svr4
-news
-sun3-sunos4.@var{n} sun3
-sun4-solaris2.@var{n} sun4-sunos5.@var{n}
-sun4-sunos4.@var{n} sun4
-@end smallexample
-
-@node Reporting Bugs
-@appendixsec Reporting Bugs
-@cindex reporting bugs
-@cindex bugs, reporting
-
-There are probably bugs in the GNU C library. There are certainly
-errors and omissions in this manual. If you report them, they will get
-fixed. If you don't, no one will ever know about them and they will
-remain unfixed for all eternity, if not longer.
-
-To report a bug, first you must find it. Hopefully, this will be the
-hard part. Once you've found a bug, make sure it's really a bug. A
-good way to do this is to see if the GNU C library behaves the same way
-some other C library does. If so, probably you are wrong and the
-libraries are right (but not necessarily). If not, one of the libraries
-is probably wrong.
-
-Once you're sure you've found a bug, try to narrow it down to the
-smallest test case that reproduces the problem. In the case of a C
-library, you really only need to narrow it down to one library
-function call, if possible. This should not be too difficult.
-
-The final step when you have a simple test case is to report the bug.
-When reporting a bug, send your test case, the results you got, the
-results you expected, what you think the problem might be (if you've
-thought of anything), your system type, and the version of the GNU C
-library which you are using. Also include the files
-@file{config.status} and @file{config.make} which are created by running
-@file{configure}; they will be in whatever directory was current when
-you ran @file{configure}.
-
-If you think you have found some way in which the GNU C library does not
-conform to the ISO and POSIX standards (@pxref{Standards and
-Portability}), that is definitely a bug. Report it!@refill
-
-Send bug reports to the Internet address
-@email{bug-glibc@@gnu.org}. If you have other problems
-with installation or use, please report those as well.@refill
-
-If you are not sure how a function should behave, and this manual
-doesn't tell you, that's a bug in the manual. Report that too! If the
-function's behavior disagrees with the manual, then either the library
-or the manual has a bug, so report the disagreement. If you find any
-errors or omissions in this manual, please report them to the Internet
-address @email{bug-glibc-manual@@gnu.org}.
-
@node Source Layout
@appendixsec Adding New Functions
@@ -781,7 +410,7 @@ Both @file{unix/bsd} and @file{unix/sysv/sysv4} imply @file{unix/common}.
@item unix/inet
This directory is for @code{socket} and related functions on Unix systems.
-The @file{inet} top-level subdirectory is enabled by @file{unix/inet/Subdirs}.
+@file{unix/inet/Subdirs} enables the @file{inet} top-level subdirectory.
@file{unix/common} implies @file{unix/inet}.
@end table
@@ -806,8 +435,9 @@ subdirectories (and subdirectory trees) for various Unix variants.
The functions which are system calls in most Unix systems are
implemented in assembly code, which is generated automatically from
-specifications in the file @file{sysdeps/unix/syscalls.list}. Some
-special system calls are implemented in files that are named with a
+specifications in files named @file{syscalls.list}. There are several
+such files, one in @file{sysdeps/unix} and others in its subdirectories.
+Some special system calls are implemented in files that are named with a
suffix of @samp{.S}; for example, @file{_exit.S}. Files ending in
@samp{.S} are run through the C preprocessor before being fed to the
assembler.
@@ -820,8 +450,8 @@ variant. See @file{sysdeps/unix/sysdep.h} and the machine-specific
@file{sysdep.h} implementations to see what these macros are and what
they should do.@refill
-The system-specific makefile for the @file{unix} directory (that is, the
-file @file{sysdeps/unix/Makefile}) gives rules to generate several files
+The system-specific makefile for the @file{unix} directory
+(@file{sysdeps/unix/Makefile}) gives rules to generate several files
from the Unix system you are building the library on (which is assumed
to be the target system you are building the library @emph{for}). All
the generated files are put in the directory where the object files are
@@ -843,411 +473,3 @@ organization of the GNU C library header files differs from that of
traditional C implementations. This means you may need to make changes
to your program in order to get it to compile.
@end ignore
-
-@node Contributors
-@appendixsec Contributors to the GNU C Library
-
-The GNU C library was written originally by Roland McGrath. Some parts
-of the library were contributed or worked on by other people.
-
-@itemize @bullet
-@item
-The @code{getopt} function and related code were written by
-Richard Stallman, @w{David J. MacKenzie}, and @w{Roland McGrath}.
-
-@item
-The merge sort function @code{qsort} was written by Michael J. Haertel.
-
-@item
-The quick sort function used as a fallback by @code{qsort} was written
-by Douglas C. Schmidt.
-
-@item
-The memory allocation functions @code{malloc}, @code{realloc} and
-@code{free} and related code were written by Michael J. Haertel.
-
-@item
-Fast implementations of many of the string functions (@code{memcpy},
-@code{strlen}, etc.) were written by Torbj@"orn Granlund.
-
-@item
-The @file{tar.h} header file was written by David J. MacKenzie.
-
-@item
-The port to the MIPS DECStation running Ultrix 4
-(@code{mips-dec-ultrix4})
-was contributed by Brendan Kehoe and Ian Lance Taylor.
-
-@item
-The DES encryption function @code{crypt} and related functions were
-contributed by Michael Glad.
-
-@item
-The @code{ftw} and @code{nftw} function was contributed by Ulrich Drepper.
-
-@item
-The startup code to support SunOS shared libraries was contributed by
-Tom Quinn.
-
-@item
-The @code{mktime} function was contributed by Paul Eggert.
-
-@item
-The port to the Sequent Symmetry running Dynix version 3
-(@code{i386-sequent-bsd}) was contributed by Jason Merrill.
-
-@item
-The timezone support code is derived from the public-domain timezone
-package by Arthur David Olson and his many contributors.
-
-@item
-The port to the DEC Alpha running OSF/1 (@code{alpha-dec-osf1}) was
-contributed by Brendan Kehoe, using some code written by Roland McGrath.
-
-@item
-The port to SGI machines running Irix 4 (@code{mips-sgi-irix4}) was
-contributed by Tom Quinn.
-
-@item
-The port of the Mach and Hurd code to the MIPS architecture
-(@code{mips-@var{anything}-gnu}) was contributed by Kazumoto Kojima.
-
-@item
-The floating-point printing function used by @code{printf} and friends
-and the floating-point reading function used by @code{scanf},
-@code{strtod} and friends were written by Ulrich Drepper. The
-multi-precision integer functions used in those functions are taken from
-GNU MP, which was contributed by Torbj@"orn Granlund.
-
-@item
-The internationalization support in the library, and the support
-programs @code{locale} and @code{localedef}, were written by Ulrich
-Drepper. Ulrich Drepper adapted the support code for message catalogs
-(@file{libintl.h}, etc.) from the GNU @code{gettext} package, which he
-also wrote. He also contributed the @code{catgets} support and the
-entire suite of multi-byte and wide-character support functions
-(@file{wctype.h}, @file{wchar.h}, etc.).
-
-@item
-The implementations of the @file{nsswitch.conf} mechanism and the files
-and DNS backends for it were designed and written by Ulrich Drepper and
-Roland McGrath, based on a backend interface defined by Peter Eriksson.
-
-@item
-The port to Linux i386/ELF (@code{i386-@var{anything}-linux}) was
-contributed by Ulrich Drepper, based in large part on work done in
-Hongjiu Lu's Linux version of the GNU C Library.
-
-@item
-The port to Linux/m68k (@code{m68k-@var{anything}-linux}) was
-contributed by Andreas Schwab.
-
-@item
-The ports to Linux/ARM (@code{arm-@var{ANYTHING}-linuxaout}) and ARM
-standalone (@code{arm-@var{ANYTHING}-none}), as well as parts of the
-IPv6 support code, were contributed by Philip Blundell.
-
-@item
-Richard Henderson contributed the ELF dynamic linking code and other
-support for the Alpha processor.
-
-@item
-David Mosberger-Tang contributed the port to Linux/Alpha
-(@code{alpha-@var{anything}-linux}).
-
-@item
-The port to Linux on PowerPC (@code{powerpc-@var{anything}-linux})
-was contributed by Geoffrey Keating.
-
-@item
-Miles Bader wrote the argp argument-parsing package, and the argz/envz
-interfaces.
-
-@item
-Stephen R. van den Berg contributed a highly-optimized @code{strstr} function.
-
-@item
-Ulrich Drepper contributed the @code{hsearch} and @code{drand48}
-families of functions; reentrant @samp{@dots{}@code{_r}} versions of the
-@code{random} family; System V shared memory and IPC support code; and
-several highly-optimized string functions for i@var{x}86 processors.
-
-@item
-The math functions are taken from @code{fdlibm-5.1} by Sun
-Microsystems, as modified by J.T. Conklin, Ian Lance Taylor,
-Ulrich Drepper, Andreas Schwab, and Roland McGrath.
-
-@item
-The @code{libio} library used to implement @code{stdio} functions on
-some platforms was written by Per Bothner and modified by Ulrich Drepper.
-
-@item
-The Internet-related code (most of the @file{inet} subdirectory) and
-several other miscellaneous functions and header files have been
-included from 4.4 BSD with little or no modification.
-
-All code incorporated from 4.4 BSD is under the following copyright:
-
-@quotation
-@display
-Copyright @copyright{} 1991 Regents of the University of California.
-All rights reserved.
-@end display
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-@enumerate
-@item
-Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-@item
-Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-@item
-All advertising materials mentioning features or use of this software
-must display the following acknowledgement:
-@quotation
-This product includes software developed by the University of
-California, Berkeley and its contributors.
-@end quotation
-@item
-Neither the name of the University nor the names of its contributors
-may be used to endorse or promote products derived from this software
-without specific prior written permission.
-@end enumerate
-
-@sc{this software is provided by the regents and contributors ``as is'' and
-any express or implied warranties, including, but not limited to, the
-implied warranties of merchantability and fitness for a particular purpose
-are disclaimed. in no event shall the regents or contributors be liable
-for any direct, indirect, incidental, special, exemplary, or consequential
-damages (including, but not limited to, procurement of substitute goods
-or services; loss of use, data, or profits; or business interruption)
-however caused and on any theory of liability, whether in contract, strict
-liability, or tort (including negligence or otherwise) arising in any way
-out of the use of this software, even if advised of the possibility of
-such damage.}
-@end quotation
-
-@item
-The random number generation functions @code{random}, @code{srandom},
-@code{setstate} and @code{initstate}, which are also the basis for the
-@code{rand} and @code{srand} functions, were written by Earl T. Cohen
-for the University of California at Berkeley and are copyrighted by the
-Regents of the University of California. They have undergone minor
-changes to fit into the GNU C library and to fit the @w{ISO C} standard,
-but the functional code is Berkeley's.@refill
-
-@item
-The Internet resolver code is taken directly from BIND 4.9.5, which is
-under both the Berkeley copyright above and also:
-
-@quotation
-Portions Copyright @copyright{} 1993 by Digital Equipment Corporation.
-
-Permission to use, copy, modify, and distribute this software for any
-purpose with or without fee is hereby granted, provided that the above
-copyright notice and this permission notice appear in all copies, and
-that the name of Digital Equipment Corporation not be used in
-advertising or publicity pertaining to distribution of the document or
-software without specific, written prior permission.
-
-@sc{the software is provided ``as is'' and digital equipment corp.
-disclaims all warranties with regard to this software, including all
-implied warranties of merchantability and fitness. in no event shall
-digital equipment corporation be liable for any special, direct,
-indirect, or consequential damages or any damages whatsoever resulting
-from loss of use, data or profits, whether in an action of contract,
-negligence or other tortious action, arising out of or in connection
-with the use or performance of this software.}
-@end quotation
-
-@item
-The code to support Sun RPC is taken verbatim from Sun's
-@w{@sc{rpcsrc-4.0}} distribution, and is covered by this copyright:
-
-@quotation
-@display
-Copyright @copyright{} 1984, Sun Microsystems, Inc.
-@end display
-
-Sun RPC is a product of Sun Microsystems, Inc. and is provided for
-unrestricted use provided that this legend is included on all tape media
-and as a part of the software program in whole or part. Users may copy
-or modify Sun RPC without charge, but are not authorized to license or
-distribute it to anyone else except as part of a product or program
-developed by the user.
-
-@sc{sun rpc is provided as is with no warranties of any kind including the
-warranties of design, merchantibility and fitness for a particular
-purpose, or arising from a course of dealing, usage or trade practice.}
-
-Sun RPC is provided with no support and without any obligation on the
-part of Sun Microsystems, Inc. to assist in its use, correction,
-modification or enhancement.
-
-@sc{sun microsystems, inc. shall have no liability with respect to the
-infringement of copyrights, trade secrets or any patents by sun rpc
-or any part thereof.}
-
-In no event will Sun Microsystems, Inc. be liable for any lost revenue
-or profits or other special, indirect and consequential damages, even if
-Sun has been advised of the possibility of such damages.
-
-@display
-Sun Microsystems, Inc.
-2550 Garcia Avenue
-Mountain View, California 94043
-@end display
-@end quotation
-
-@item
-Some of the support code for Mach is taken from Mach 3.0 by CMU,
-and is under the following copyright terms:
-
-@quotation
-@display
-Mach Operating System
-Copyright @copyright{} 1991,1990,1989 Carnegie Mellon University
-All Rights Reserved.
-@end display
-
-Permission to use, copy, modify and distribute this software and its
-documentation is hereby granted, provided that both the copyright
-notice and this permission notice appear in all copies of the
-software, derivative works or modified versions, and any portions
-thereof, and that both notices appear in supporting documentation.
-
-@sc{carnegie mellon allows free use of this software in its ``as is''
-condition. carnegie mellon disclaims any liability of any kind for
-any damages whatsoever resulting from the use of this software.}
-
-Carnegie Mellon requests users of this software to return to
-
-@display
- Software Distribution Coordinator
- School of Computer Science
- Carnegie Mellon University
- Pittsburgh PA 15213-3890
-@end display
-
-@noindent
-or @email{Software.Distribution@@CS.CMU.EDU} any improvements or
-extensions that they make and grant Carnegie Mellon the rights to
-redistribute these changes.
-@end quotation
-
-@item
-The code for the database library @file{libdb} comes from the 2.3
-release of Berkeley DB. That code is under the same copyright as 4.4 BSD
-and also:
-
-@quotation
-@display
-Copyright @copyright{} 1990, 1993, 1994, 1995, 1996, 1997
-Sleepycat Software. All rights reserved.
-@end display
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-@enumerate
-@item
-Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-@item
-Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-@item
-Redistributions in any form must be accompanied by information on
-how to obtain complete source code for the DB software and any
-accompanying software that uses the DB software. The source code
-must either be included in the distribution or be available for no
-more than the cost of distribution plus a nominal fee, and must be
-freely redistributable under reasonable conditions. For an
-executable file, complete source code means the source code for all
-modules it contains. It does not mean source code for modules or
-files that typically accompany the operating system on which the
-executable file runs, e.g., standard library modules or system
-header files.
-@end enumerate
-
-@sc{this software is provided by sleepycat software ``as is'' and
-any express or implied warranties, including, but not limited to, the
-implied warranties of merchantability and fitness for a particular purpose
-are disclaimed. in no event shall sleepycat software be liable
-for any direct, indirect, incidental, special, exemplary, or consequential
-damages (including, but not limited to, procurement of substitute goods
-or services; loss of use, data, or profits; or business interruption)
-however caused and on any theory of liability, whether in contract, strict
-liability, or tort (including negligence or otherwise) arising in any way
-out of the use of this software, even if advised of the possibility of
-such damage.}
-
-@display
-Portions copyright @copyright{} 1995, 1996
-The President and Fellows of Harvard University.
-All rights reserved.
-@end display
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-@enumerate
-@item
-Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-@item
-Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-@item
-All advertising materials mentioning features or use of this software
-must display the following acknowledgement:
-@quotation
- This product includes software developed by Harvard University
- and its contributors.
-@end quotation
-@item
-Neither the name of the University nor the names of its contributors
-may be used to endorse or promote products derived from this software
-without specific prior written permission.
-@end enumerate
-
-@sc{this software is provided by harvard and its contributors ``as is'' and
-any express or implied warranties, including, but not limited to, the
-implied warranties of merchantability and fitness for a particular purpose
-are disclaimed. in no event shall harvard or its contributors be liable
-for any direct, indirect, incidental, special, exemplary, or consequential
-damages (including, but not limited to, procurement of substitute goods
-or services; loss of use, data, or profits; or business interruption)
-however caused and on any theory of liability, whether in contract, strict
-liability, or tort (including negligence or otherwise) arising in any way
-out of the use of this software, even if advised of the possibility of
-such damage.}
-
-@noindent
-For a license to use, redistribute or sell DB software under conditions
-other than those described above, or to purchase support for this
-software, please contact Sleepycat Software at
-
-@display
- Sleepycat Software
- 394 E. Riding Dr.
- Carlisle, MA 01741
- USA
- +1-508-287-4781
-@end display
-
-or @email{db@@sleepycat.com}.
-
-@end quotation
-
-@end itemize
-
-@c @bye
diff --git a/manual/process.texi b/manual/process.texi
index 56edf2d24c..71fc707f9a 100644
--- a/manual/process.texi
+++ b/manual/process.texi
@@ -498,10 +498,18 @@ protected using cancelation handlers.
@c ref pthread_cleanup_push / pthread_cleanup_pop
The return value is normally the process ID of the child process whose
-status is reported. If the @code{WNOHANG} option was specified and no
-child process is waiting to be noticed, the value is zero. A value of
-@code{-1} is returned in case of error. The following @code{errno}
-error conditions are defined for this function:
+status is reported. If there are child processes but none of them is
+waiting to be noticed, @code{waitpid} will block until one is. However,
+if the @code{WNOHANG} option was specified, @code{waitpid} will return
+zero instead of blocking.
+
+If a specific PID to wait for was given to @code{waitpid}, it will
+ignore all other children (if any). Therefore if there are children
+waiting to be noticed but the child whose PID was specified is not one
+of them, @code{waitpid} will block or return zero as described above.
+
+A value of @code{-1} is returned in case of error. The following
+@code{errno} error conditions are defined for this function:
@table @code
@item EINTR
diff --git a/posix/wordexp.c b/posix/wordexp.c
index 443dc4697d..54f830cc2c 100644
--- a/posix/wordexp.c
+++ b/posix/wordexp.c
@@ -973,45 +973,63 @@ parse_comm (char **word, size_t *word_length, size_t *max_length,
{
/* We are poised just after "$(" */
int paren_depth = 1;
- int error;
+ int error = 0;
size_t comm_length = 0;
size_t comm_maxlen = 0;
char *comm = NULL;
+ int quoted = 0; /* 1 for singly-quoted, 2 for doubly-quoted */
for (; words[*offset]; ++(*offset))
{
switch (words[*offset])
{
+ case '\'':
+ if (quoted == 0)
+ quoted = 1;
+ else if (quoted == 1)
+ quoted = 0;
+
+ break;
+
+ case '"':
+ if (quoted == 0)
+ quoted = 2;
+ else if (quoted == 2)
+ quoted = 0;
+
+ break;
+
case ')':
- if (--paren_depth == 0)
+ if (!quoted && --paren_depth == 0)
{
/* Go -- give script to the shell */
- error = exec_comm (comm, word, word_length, max_length, flags,
- pwordexp, ifs, ifs_white);
- free (comm);
+ if (comm)
+ {
+ error = exec_comm (comm, word, word_length, max_length,
+ flags, pwordexp, ifs, ifs_white);
+ free (comm);
+ }
+
return error;
}
/* This is just part of the script */
- comm = w_addchar (comm, &comm_length, &comm_maxlen, words[*offset]);
- if (comm == NULL)
- return WRDE_NOSPACE;
-
break;
case '(':
- ++paren_depth;
- default:
- comm = w_addchar (comm, &comm_length, &comm_maxlen, words[*offset]);
- if (comm == NULL)
- return WRDE_NOSPACE;
-
- break;
+ if (!quoted)
+ ++paren_depth;
}
+
+ comm = w_addchar (comm, &comm_length, &comm_maxlen, words[*offset]);
+ if (comm == NULL)
+ return WRDE_NOSPACE;
}
/* Premature end */
- free (comm);
+ if (comm)
+ free (comm);
+
return WRDE_SYNTAX;
}
@@ -1022,73 +1040,100 @@ parse_param (char **word, size_t *word_length, size_t *max_length,
const char *ifs, const char *ifs_white, int quoted)
{
/* We are poised just after "$" */
- enum remove_pattern_enum
+ enum action
{
- RP_NONE = 0,
- RP_SHORT_LEFT,
- RP_LONG_LEFT,
- RP_SHORT_RIGHT,
- RP_LONG_RIGHT
+ ACT_NONE,
+ ACT_RP_SHORT_LEFT = '#',
+ ACT_RP_LONG_LEFT = 'L',
+ ACT_RP_SHORT_RIGHT = '%',
+ ACT_RP_LONG_RIGHT = 'R',
+ ACT_NULL_ERROR = '?',
+ ACT_NULL_SUBST = '-',
+ ACT_NONNULL_SUBST = '+',
+ ACT_NULL_ASSIGN = '='
};
- size_t start = *offset;
size_t env_length = 0;
size_t env_maxlen = 0;
size_t pat_length = 0;
size_t pat_maxlen = 0;
+ size_t start = *offset;
char *env = NULL;
char *pattern = NULL;
char *value = NULL;
- char action = '\0';
- enum remove_pattern_enum remove = RP_NONE;
- int colon_seen = 0;
+ enum action action = ACT_NONE;
int depth = 0;
+ int colon_seen = 0;
int seen_hash = 0;
int free_value = 0;
+ int pattern_is_quoted = 0; /* 1 for singly-quoted, 2 for doubly-quoted */
int error;
+ int brace = words[*offset] == '{';
+
+ if (brace)
+ ++*offset;
for (; words[*offset]; ++(*offset))
{
- switch (words[*offset])
- {
- case '{':
- ++depth;
+ int special;
- if (action != '\0' || remove != RP_NONE)
+ if (action != ACT_NONE)
+ {
+ switch (words[*offset])
{
- pattern = w_addchar (pattern, &pat_length, &pat_maxlen,
- words[*offset]);
- if (pattern == NULL)
- goto no_space;
+ case '{':
+ if (!pattern_is_quoted)
+ ++depth;
+ break;
+ case '}':
+ if (!pattern_is_quoted)
+ {
+ if (depth == 0)
+ goto envsubst;
+ --depth;
+ }
break;
- }
- if (*offset == start)
- break;
+ case '\\':
+ if (!pattern_is_quoted && words[++*offset] == '\0')
+ goto syntax;
+ break;
- /* Otherwise evaluate */
- /* (and re-parse this character) */
- --(*offset);
- goto envsubst;
+ case '\'':
+ if (pattern_is_quoted == 0)
+ pattern_is_quoted = 1;
+ else if (pattern_is_quoted == 1)
+ pattern_is_quoted = 0;
- case '}':
- if (words[start] != '{')
- --(*offset);
+ break;
- if (action != '\0' || remove != RP_NONE)
- {
- if (--depth)
- {
- pattern = w_addchar (pattern, &pat_length, &pat_maxlen,
- words[*offset]);
- if (pattern == NULL)
- goto no_space;
+ case '"':
+ if (pattern_is_quoted == 0)
+ pattern_is_quoted = 2;
+ else if (pattern_is_quoted == 2)
+ pattern_is_quoted = 0;
- break;
- }
+ break;
}
- /* Evaluate */
+ pattern = w_addchar (pattern, &pat_length, &pat_maxlen,
+ words[*offset]);
+ if (pattern == NULL)
+ goto no_space;
+
+ continue;
+ }
+
+ switch (words[*offset])
+ {
+ case '}':
+ if (!brace)
+ goto end_of_word;
+
+ if (env == NULL)
+ goto syntax;
+
+ /* Evaluate. */
goto envsubst;
case '#':
@@ -1100,173 +1145,104 @@ parse_param (char **word, size_t *word_length, size_t *max_length,
goto envsubst;
}
- if (words[start] != '{')
- {
- /* Evaluate */
- /* (and re-parse this character) */
- --(*offset);
- goto envsubst;
- }
+ if (!brace)
+ /* Evaluate */
+ /* (and re-parse this character) */
+ goto end_of_word;
/* At the start? (i.e. 'string length') */
- if (*offset == start + 1)
+ if (env == NULL)
{
seen_hash = 1;
- break;
+ continue;
}
else if (seen_hash)
goto syntax;
- /* Separating variable name from prefix pattern? */
- if (remove == RP_NONE)
- {
- remove = RP_SHORT_LEFT;
- break;
- }
- else if (remove == RP_SHORT_LEFT)
+ action = ACT_RP_SHORT_LEFT;
+ if (words[1 + *offset] == '#')
{
- remove = RP_LONG_LEFT;
- break;
+ ++*offset;
+ action = ACT_RP_LONG_LEFT;
}
- /* Must be part of prefix/suffix pattern. */
- pattern = w_addchar (pattern, &pat_length, &pat_maxlen,
- words[*offset]);
- if (pattern == NULL)
- goto no_space;
-
- break;
+ continue;
case '%':
+ if (!brace)
+ /* Re-parse this character after substitution */
+ goto end_of_word;
+
if (!env || !*env)
goto syntax;
- /* Separating variable name from suffix pattern? */
- if (remove == RP_NONE)
- {
- remove = RP_SHORT_RIGHT;
- break;
- }
- else if (remove == RP_SHORT_RIGHT)
+ if (seen_hash)
+ goto syntax;
+
+ action = ACT_RP_SHORT_RIGHT;
+ if (words[1 + *offset] == '%')
{
- remove = RP_LONG_RIGHT;
- break;
+ ++*offset;
+ action = ACT_RP_LONG_RIGHT;
}
- /* Must be part of prefix/suffix pattern. */
- pattern = w_addchar (pattern, &pat_length, &pat_maxlen,
- words[*offset]);
- if (pattern == NULL)
- goto no_space;
-
- break;
+ continue;
case ':':
+ if (!brace)
+ goto end_of_word;
+
if (!env || !*env)
goto syntax;
- if (action != '\0' || remove != RP_NONE)
- {
- pattern = w_addchar (pattern, &pat_length, &pat_maxlen,
- words[*offset]);
- if (pattern == NULL)
- goto no_space;
-
- break;
- }
+ if (seen_hash)
+ goto syntax;
- if ((words[1 + *offset] == '-') || (words[1 + *offset] == '=')
- || (words[1 + *offset] == '?') || (words[1 + *offset] == '+'))
- {
- colon_seen = 1;
- break;
- }
+ if (words[1 + *offset] != '-' && words[1 + *offset] != '='
+ && words[1 + *offset] != '?' && words[1 + *offset] != '+')
+ goto syntax;
- goto syntax;
+ colon_seen = 1;
+ action = words[++*offset];
+ continue;
case '-':
case '=':
case '?':
case '+':
- if (!env || !*env)
- goto syntax;
+ if (!brace)
+ goto end_of_word;
- if (seen_hash)
+ if (!env || !*env)
goto syntax;
- if (action != '\0' || remove != RP_NONE)
- {
- pattern = w_addchar (pattern, &pat_length, &pat_maxlen,
- words[*offset]);
- if (pattern == NULL)
- goto no_space;
-
- break;
- }
-
action = words[*offset];
- break;
-
- case '\\':
- if (action != '\0' || remove != RP_NONE)
- {
- /* Um. Is this right? */
- error = parse_qtd_backslash (word, word_length, max_length,
- words, offset);
- if (error == 0)
- break;
- }
- else
- {
- error = WRDE_SYNTAX;
- }
-
- if (env)
- free (env);
-
- if (pattern != NULL)
- free (pattern);
-
- return error;
-
- default:
- if (action != '\0' || remove != RP_NONE)
- {
- pattern = w_addchar (pattern, &pat_length, &pat_maxlen,
- words[*offset]);
- if (pattern == NULL)
- goto no_space;
-
- break;
- }
- else
- {
- int special = (strchr ("*@$", words[*offset]) != NULL
- || isdigit (words[*offset]));
+ continue;
+ }
- if (isalpha (words[*offset]) || special)
- {
- env = w_addchar (env, &env_length, &env_maxlen,
- words[*offset]);
- if (env == NULL)
- goto no_space;
+ special = (strchr ("*@$", words[*offset]) != NULL
+ || isdigit (words[*offset]));
- if (special && words[start] != '{')
- goto envsubst;
+ if (!isalpha (words[*offset]) && !special)
+ /* Stop and evaluate, remembering char we stopped at */
+ break;
- /* Keep going (get next char) */
- break;
- }
+ env = w_addchar (env, &env_length, &env_maxlen,
+ words[*offset]);
+ if (env == NULL)
+ goto no_space;
- /* Stop and evaluate, remembering char we stopped at */
- --(*offset);
- goto envsubst;
- }
+ if (special)
+ {
+ if (brace)
+ ++*offset;
+ goto envsubst;
}
}
/* End of input string -- remember to reparse the character that we stopped
* at. */
+end_of_word:
--(*offset);
envsubst:
@@ -1381,53 +1357,39 @@ envsubst:
free (env);
/* Each parameter is a separate word ("$@") */
- if (__libc_argv[0] == NULL)
- {
- /* This can happen if the application is started without any
- parameter, not even a name. This is legal according to
- POSIX since the giving parameters is only a "should" rule. */
- *word = __strdup ("");
- *max_length = *word_length = 0;
- }
- else
+ if (__libc_argv[0] != NULL && __libc_argv[1] != NULL)
{
+ /* Append first parameter to current word. */
int p;
- for (p = 1; __libc_argv[p + 1]; p++)
- {
- char *copy = __strdup (__libc_argv[p]);
- if (copy == NULL)
- return WRDE_NOSPACE;
-
- error = w_addword (pwordexp, copy);
- if (error)
- {
- free (copy);
- return error;
- }
- }
+ *word = w_addstr (*word, word_length, max_length, __libc_argv[1]);
+ if (*word == NULL)
+ return WRDE_NOSPACE;
- /* Last parameter becomes current word */
- if (__libc_argv[p])
+ for (p = 1; __libc_argv[p]; p++)
{
+ if (w_addword (pwordexp, *word))
+ return WRDE_NOSPACE;
*word = __strdup (__libc_argv[p]);
+ *max_length = *word_length = strlen (*word);
if (*word == NULL)
return WRDE_NOSPACE;
-
- *max_length = *word_length = strlen (*word);
}
}
-
+
return 0;
}
value = getenv (env);
- if (action != '\0' || remove != RP_NONE)
+ if (action != ACT_NONE)
{
switch (action)
{
- case 0:
+ case ACT_RP_SHORT_LEFT:
+ case ACT_RP_LONG_LEFT:
+ case ACT_RP_SHORT_RIGHT:
+ case ACT_RP_LONG_RIGHT:
{
char *p;
char c;
@@ -1441,9 +1403,9 @@ envsubst:
if (value == NULL)
break;
- switch (remove)
+ switch (action)
{
- case RP_SHORT_LEFT:
+ case ACT_RP_SHORT_LEFT:
for (p = value; p <= end; ++p)
{
c = *p;
@@ -1459,7 +1421,7 @@ envsubst:
break;
- case RP_LONG_LEFT:
+ case ACT_RP_LONG_LEFT:
for (p = end; p >= value; --p)
{
c = *p;
@@ -1475,7 +1437,7 @@ envsubst:
break;
- case RP_SHORT_RIGHT:
+ case ACT_RP_SHORT_RIGHT:
for (p = end; p >= value; --p)
{
if (fnmatch (pattern, p, 0) != FNM_NOMATCH)
@@ -1487,7 +1449,7 @@ envsubst:
break;
- case RP_LONG_RIGHT:
+ case ACT_RP_LONG_RIGHT:
for (p = value; p <= end; ++p)
{
if (fnmatch (pattern, p, 0) != FNM_NOMATCH)
@@ -1500,13 +1462,13 @@ envsubst:
break;
default:
- assert (! "Unexpected `remove' value\n");
+ break;
}
break;
}
- case '?':
+ case ACT_NULL_ERROR:
if (value && *value)
/* Substitute parameter */
break;
@@ -1519,9 +1481,6 @@ envsubst:
return 0;
}
- /* Error - exit */
- fprintf (stderr, "%s: ", env);
-
if (*pattern)
{
/* Expand 'pattern' and write it to stderr */
@@ -1533,9 +1492,11 @@ envsubst:
{
int i;
+ fprintf (stderr, "%s:", env);
+
for (i = 0; i < we.we_wordc; ++i)
{
- fprintf (stderr, "%s%s", i ? " " : "", we.we_wordv[i]);
+ fprintf (stderr, " %s", we.we_wordv[i]);
}
fprintf (stderr, "\n");
@@ -1548,12 +1509,12 @@ envsubst:
return error;
}
- fprintf (stderr, "parameter null or not set\n");
+ fprintf (stderr, "%s: parameter null or not set\n", env);
free (env);
free (pattern);
return WRDE_BADVAL;
- case '-':
+ case ACT_NULL_SUBST:
if (value && *value)
/* Substitute parameter */
break;
@@ -1577,11 +1538,15 @@ envsubst:
/* No field-splitting is allowed, so imagine
quotes around the word. */
char *qtd_pattern = malloc (3 + strlen (pattern));
- sprintf (qtd_pattern, "\"%s\"", pattern);
+ if (qtd_pattern)
+ sprintf (qtd_pattern, "\"%s\"", pattern);
free (pattern);
pattern = qtd_pattern;
}
+ if (pattern == NULL && (pattern = __strdup("")) == NULL)
+ goto no_space;
+
error = wordexp (pattern, &we, flags);
if (error)
{
@@ -1606,7 +1571,7 @@ envsubst:
goto no_space;
}
- if (action == '=')
+ if (action == ACT_NULL_ASSIGN)
{
char *words;
char *cp;
@@ -1634,7 +1599,7 @@ envsubst:
return 0;
}
- case '+':
+ case ACT_NONNULL_SUBST:
if (value && *value)
goto subst_word;
@@ -1646,7 +1611,7 @@ envsubst:
free (pattern);
return 0;
- case '=':
+ case ACT_NULL_ASSIGN:
if (value && *value)
/* Substitute parameter */
break;
@@ -1818,8 +1783,17 @@ parse_dollars (char **word, size_t *word_length, size_t *max_length,
{
/* Differentiate between $((1+3)) and $((echo);(ls)) */
int i = 3 + *offset;
- while (words[i] && words[i] != ')')
- ++i;
+ int depth = 0;
+ while (words[i] && !(depth == 0 && words[i] == ')'))
+ {
+ if (words[i] == '(')
+ ++depth;
+ else if (words[i] == ')')
+ --depth;
+
+ ++i;
+ }
+
if (words[i] == ')' && words[i + 1] == ')')
{
(*offset) += 3;