aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-08-04 14:31:26 +0000
committerUlrich Drepper <drepper@redhat.com>1997-08-04 14:31:26 +0000
commit55c14926be46b12fda4e01d0977911d3b0883db7 (patch)
tree2bb9829379008a2d0d59bb849d12f2491624c1fb
parent8f2ece695d8822e9ecc63ecd157e90bf17a6fe65 (diff)
downloadglibc-55c14926be46b12fda4e01d0977911d3b0883db7.zip
glibc-55c14926be46b12fda4e01d0977911d3b0883db7.tar.gz
glibc-55c14926be46b12fda4e01d0977911d3b0883db7.tar.bz2
1997-08-04 15:29 Ulrich Drepper <drepper@cygnus.com> * locale/programs/localedef.c (main): Set bit in avail for those categories which are successfully read. * locale/programs/locfile.c (check_all_categories): Don't check categories if they are not available. (write_all_categories): Don't write categories if they are not available. * login/setutent_r.c (setutent_unknown): Change return type to int and return result of called function. * manual/arith.texi: Mark floating-point test macro from ISO C 9X as macros (not functions). * manual/libc.texinfo (UPDATED): Update. * manual/math.texi: Document exceptions, functions to handle exceptions, mathematical constants, FP comparison functions and several new functions from ISO C 9X. Change parameter of drand48, lrand48, and mrand48 to void (not empty). * manual/pattern.texi: Remove paragraph which explained that wordexp is executed by running a shell. * manual/time.texi: Explain difficulties with strftime if the functions returns 0 and no error occurred. * math/math.h: Correct comment for some M_* constants. (isgreater, isgreaterequal, isless, islessequal, islessgreater, inunordered): Rewrite to make sure the arguments are evaluated exactly once. * nis/rpcsvc/nis.x: Undo last change. * nis/rpcsvc/nis.h: Likewise. * nis/rpcsvc/nislib.h: File moved back to here. * posix/sys/types.h: Don't define socklen_t. Pretty print. * socket/sys/socket.h (bind, getsockname, connect, sendto, recvfrom, getsockopt, setsockopt, accept): Change size argument to type socklen_t. Pretty print. * manual/socket.texi: Describe socklen_t and change prototypes of socket functions to use socklen_t. * sysdeps/generic/bits/socket.h: Define socklen_t. (struct msghdr): Correct types to use socklen_t. * sysdeps/unix/sysv/linux/bits/socket.h: Likewise. * sysdeps/unix/sysv/linux/mips/bits/socket.h: Likewise. * stdio-common/printf_fp.c (__printf_fp): Correct rouding of number 1.0 < x < 8.0. * stdio-common/tfformat.c: Add new tests for above bug. * stdlib/strtod.c: Fix typo. * string/Makefile (headers): Add bits/string.h. (CFLAGS-*): Add -D__NO_STRING_INLINES. * string/string.h: Include <bits/string.h> if optimizing and __NO_STRING_INLINES is not defined. * sysdeps/stub/bits/string.h: New file. * sysdeps/powerpc/bits/fenv.h: Fix typos. * sysdeps/unix/sysv/linux/if_index.c: Let functions return ENOSYS if SIOGIFINDEX is not defined. * sysdeps/wordsize-32/inttypes.h: Pretty print. * sysdeps/wordsize-64/inttypes.h: Pretty print. * termios/cfsetspeed.c: Rewrite loop to do what it shall do. * wcsmbs/Makefile (tests): Add tst-wcstof. * wcsmbs/tst-wcstof.c: New file. 1997-08-01 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de> * sysdeps/m68k/__longjmp.c: Replace call to abort by infinite loop, to avoid dragging stdio into the dynamic linker. 1997-08-02 19:44 H.J. Lu <hjl@gnu.ai.mit.edu> * nis/nis_findserv.c (xid, xid_seed, xid_lookup): Make them u_int32_t. 1997-08-03 Andreas Jaeger <aj@arthur.rhein-neckar.de> * posix/wordexp.c (parse_tilde): Fix calls to __getpwnam_r and __getpwuid_r. Include <stdio.h> to get prototypes of *printf. (exec_comm): Remove unneeded variable *sh. * libc.map: Add wordexp, wordfree. * posix/Makefile (routines): Add wordexp. 1997-08-03 Andreas Jaeger <aj@arthur.rhein-neckar.de> * posix/wordexp.c: Correct typo in comment. (wordexp): Likewise. * manual/errno.texi (Error Codes): Fix typo. 1997-08-03 15:28 Ulrich Drepper <drepper@cygnus.com> * csu/initfini.c (SECTION): Don't put quotes around section name since this is not understood by all assemblers. Patch by Klaus Espenlaub <kespenla@hydra.informatik.uni-ulm.de>.
-rw-r--r--BUGS22
-rw-r--r--ChangeLog105
-rw-r--r--bits/socket.h15
-rw-r--r--csu/initfini.c2
-rw-r--r--libc.map6
-rw-r--r--locale/programs/localedef.c7
-rw-r--r--locale/programs/locfile.c36
-rw-r--r--login/getutent_r.c13
-rw-r--r--manual/arith.texi16
-rw-r--r--manual/errno.texi2
-rw-r--r--manual/libc.texinfo2
-rw-r--r--manual/math.texi757
-rw-r--r--manual/pattern.texi3
-rw-r--r--manual/socket.texi38
-rw-r--r--manual/texinfo.tex22
-rw-r--r--manual/time.texi29
-rw-r--r--math/math.h36
-rw-r--r--nis/nis_findserv.c6
-rw-r--r--nis/rpcsvc/nis.h2
-rw-r--r--nis/rpcsvc/nis.x2
-rw-r--r--nis/rpcsvc/nislib.h268
-rw-r--r--posix/Makefile2
-rw-r--r--posix/sys/types.h35
-rw-r--r--posix/wordexp.c16
-rw-r--r--socket/sys/socket.h36
-rw-r--r--stdio-common/printf_fp.c17
-rw-r--r--stdio-common/tfformat.c10
-rw-r--r--stdlib/strtod.c2
-rw-r--r--string/Makefile8
-rw-r--r--string/string.h7
-rw-r--r--sysdeps/generic/bits/socket.h15
-rw-r--r--sysdeps/gnu/errlist.c2
-rw-r--r--sysdeps/m68k/__longjmp.c4
-rw-r--r--sysdeps/powerpc/bits/fenv.h4
-rw-r--r--sysdeps/stub/bits/string.h12
-rw-r--r--sysdeps/unix/sysv/linux/bits/socket.h7
-rw-r--r--sysdeps/unix/sysv/linux/if_index.c49
-rw-r--r--sysdeps/unix/sysv/linux/mips/bits/socket.h15
-rw-r--r--sysdeps/wordsize-32/inttypes.h2
-rw-r--r--sysdeps/wordsize-64/inttypes.h2
-rw-r--r--termios/cfsetspeed.c10
-rw-r--r--wcsmbs/Makefile2
-rw-r--r--wcsmbs/tst-wcstof.c23
43 files changed, 1464 insertions, 205 deletions
diff --git a/BUGS b/BUGS
index a9f2c2c..3d449f3 100644
--- a/BUGS
+++ b/BUGS
@@ -1,7 +1,7 @@
List of known bugs (certainly very incomplete)
----------------------------------------------
-Time-stamp: <1997-08-01T05:37:51+0200 drepper>
+Time-stamp: <1997-08-04T00:50:04+0200 drepper>
This following list contains those bugs which I'm aware of. Please
make sure that bugs you report are not listed here. If you can fix one
@@ -23,20 +23,8 @@ in this database as useful as possible please report bugs always using the
Severity: [ *] to [***]
-[ **] For GNU libc on Linux, there is still no solution for the UTMP
- problem.
- [Among others: PR libc/39]
-
[ **] There are problems with signal handling when using LinuxThreads.
-[ **] The `cbrtl' function for ix86 does not work in the moment.
-
-[ **] Not really a bug, but it could lead to such:
- The RPC code is ugly ugly ugly. It's more or less verbatim taken
- from Sun's code and therefore mostly lacks complete prototypes and
- (more important) the use of `const'. It *definitely* needs to be
- cleaned.
-
[ *] The precision of the `sinhl' and/or `asinhl' function do not seem
to be the best.
@@ -56,6 +44,14 @@ Severity: [ *] to [***]
symbols in <linux/limits.h> available.
[PR libc/140]
+[ *] The localedef program should not generate errors if for categories
+ which are not used for the output there are characters referenced
+ which are not defined in the charmap.
+ [PR libc/229]
+
+[ *] The rcmd() functions (more concrete: the handling of .rhosts) does
+ not support netgroups and wildcards (+).
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Ulrich Drepper
drepper@cygnus.com
diff --git a/ChangeLog b/ChangeLog
index a72ab06..622e38d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,108 @@
+1997-08-04 15:29 Ulrich Drepper <drepper@cygnus.com>
+
+ * locale/programs/localedef.c (main): Set bit in avail for those
+ categories which are successfully read.
+ * locale/programs/locfile.c (check_all_categories): Don't check
+ categories if they are not available.
+ (write_all_categories): Don't write categories if they are not
+ available.
+
+ * login/setutent_r.c (setutent_unknown): Change return type to
+ int and return result of called function.
+
+ * manual/arith.texi: Mark floating-point test macro from ISO C 9X
+ as macros (not functions).
+ * manual/libc.texinfo (UPDATED): Update.
+ * manual/math.texi: Document exceptions, functions to handle
+ exceptions, mathematical constants, FP comparison functions
+ and several new functions from ISO C 9X.
+ Change parameter of drand48, lrand48, and mrand48 to void (not
+ empty).
+ * manual/pattern.texi: Remove paragraph which explained that wordexp
+ is executed by running a shell.
+ * manual/time.texi: Explain difficulties with strftime if the
+ functions returns 0 and no error occurred.
+
+ * math/math.h: Correct comment for some M_* constants.
+ (isgreater, isgreaterequal, isless, islessequal, islessgreater,
+ inunordered): Rewrite to make sure the arguments are evaluated
+ exactly once.
+
+ * nis/rpcsvc/nis.x: Undo last change.
+ * nis/rpcsvc/nis.h: Likewise.
+ * nis/rpcsvc/nislib.h: File moved back to here.
+
+ * posix/sys/types.h: Don't define socklen_t. Pretty print.
+ * socket/sys/socket.h (bind, getsockname, connect, sendto, recvfrom,
+ getsockopt, setsockopt, accept): Change size argument to type
+ socklen_t.
+ Pretty print.
+ * manual/socket.texi: Describe socklen_t and change prototypes of
+ socket functions to use socklen_t.
+ * sysdeps/generic/bits/socket.h: Define socklen_t.
+ (struct msghdr): Correct types to use socklen_t.
+ * sysdeps/unix/sysv/linux/bits/socket.h: Likewise.
+ * sysdeps/unix/sysv/linux/mips/bits/socket.h: Likewise.
+
+ * stdio-common/printf_fp.c (__printf_fp): Correct rouding of number
+ 1.0 < x < 8.0.
+ * stdio-common/tfformat.c: Add new tests for above bug.
+
+ * stdlib/strtod.c: Fix typo.
+
+ * string/Makefile (headers): Add bits/string.h.
+ (CFLAGS-*): Add -D__NO_STRING_INLINES.
+ * string/string.h: Include <bits/string.h> if optimizing and
+ __NO_STRING_INLINES is not defined.
+ * sysdeps/stub/bits/string.h: New file.
+
+ * sysdeps/powerpc/bits/fenv.h: Fix typos.
+
+ * sysdeps/unix/sysv/linux/if_index.c: Let functions return ENOSYS
+ if SIOGIFINDEX is not defined.
+
+ * sysdeps/wordsize-32/inttypes.h: Pretty print.
+ * sysdeps/wordsize-64/inttypes.h: Pretty print.
+
+ * termios/cfsetspeed.c: Rewrite loop to do what it shall do.
+
+ * wcsmbs/Makefile (tests): Add tst-wcstof.
+ * wcsmbs/tst-wcstof.c: New file.
+
+1997-08-01 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * sysdeps/m68k/__longjmp.c: Replace call to abort by infinite
+ loop, to avoid dragging stdio into the dynamic linker.
+
+1997-08-02 19:44 H.J. Lu <hjl@gnu.ai.mit.edu>
+
+ * nis/nis_findserv.c (xid, xid_seed, xid_lookup): Make them
+ u_int32_t.
+
+1997-08-03 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * posix/wordexp.c (parse_tilde): Fix calls to __getpwnam_r and
+ __getpwuid_r.
+ Include <stdio.h> to get prototypes of *printf.
+ (exec_comm): Remove unneeded variable *sh.
+
+ * libc.map: Add wordexp, wordfree.
+
+ * posix/Makefile (routines): Add wordexp.
+
+1997-08-03 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * posix/wordexp.c: Correct typo in comment.
+ (wordexp): Likewise.
+
+ * manual/errno.texi (Error Codes): Fix typo.
+
+1997-08-03 15:28 Ulrich Drepper <drepper@cygnus.com>
+
+ * csu/initfini.c (SECTION): Don't put quotes around section name
+ since this is not understood by all assemblers.
+ Patch by Klaus Espenlaub <kespenla@hydra.informatik.uni-ulm.de>.
+
1997-08-02 21:27 Ulrich Drepper <drepper@cygnus.com>
* inet/Makefile (headers): Rename netinet/inbits.h to bits/in.h.
diff --git a/bits/socket.h b/bits/socket.h
index d12d96c..af42dfa 100644
--- a/bits/socket.h
+++ b/bits/socket.h
@@ -24,11 +24,14 @@
#include <features.h>
-__BEGIN_DECLS
-
#define __need_size_t
#include <stddef.h>
+__BEGIN_DECLS
+
+/* Type for length arguments in socket calls. */
+typedef unsigned int socklen_t;
+
/* Types of sockets. */
enum __socket_type
@@ -145,13 +148,15 @@ enum
struct msghdr
{
__ptr_t msg_name; /* Address to send to/receive from. */
- size_t msg_namelen; /* Length of address data. */
+ socklen_t msg_namelen; /* Length of address data. */
struct iovec *msg_iov; /* Vector of data to send/receive into. */
- size_t msg_iovlen; /* Number of elements in the vector. */
+ int msg_iovlen; /* Number of elements in the vector. */
__ptr_t msg_accrights; /* Access rights information. */
- size_t msg_accrightslen; /* Length of access rights information. */
+ socklen_t msg_accrightslen; /* Length of access rights information. */
+
+ int msg_flags; /* Flags in received message. */
};
diff --git a/csu/initfini.c b/csu/initfini.c
index 6906c90..8f8ce2f 100644
--- a/csu/initfini.c
+++ b/csu/initfini.c
@@ -40,7 +40,7 @@
/* We use embedded asm for .section unconditionally, as this makes it
easier to insert the necessary directives into crtn.S. */
-#define SECTION(x) asm (".section \"" x "\"");
+#define SECTION(x) asm (".section " x );
/* Embed an #include to pull in the alignment and .end directives. */
asm ("\n#include \"defs.h\"");
diff --git a/libc.map b/libc.map
index 587c71e..bb44c59 100644
--- a/libc.map
+++ b/libc.map
@@ -374,7 +374,11 @@ GLIBC_2.0 {
wcstoul; wcstoull; wcstouq; wcswcs; wcswidth; wcsxfrm; wctob; wctomb;
wctrans; wctype; wcwidth;
- wmemchr; wmemcmp; wmemcpy; wmemmove; wmemset; write; writev;
+ wmemchr; wmemcmp; wmemcpy; wmemmove; wmemset;
+
+ wordexp; wordfree;
+
+ write; writev;
# x*
xdecrypt; xdr_accepted_reply; xdr_array; xdr_authdes_cred;
diff --git a/locale/programs/localedef.c b/locale/programs/localedef.c
index 34c7394..2062469 100644
--- a/locale/programs/localedef.c
+++ b/locale/programs/localedef.c
@@ -234,8 +234,11 @@ main (int argc, char *argv[])
{
avail = act_add_locdef->locale->categories[cat].generic != NULL;
if (avail)
- localedef->categories[cat].generic
- = act_add_locdef->locale->categories[cat].generic;
+ {
+ localedef->categories[cat].generic
+ = act_add_locdef->locale->categories[cat].generic;
+ localedef->avail |= 1 << cat;
+ }
}
if (! avail)
diff --git a/locale/programs/locfile.c b/locale/programs/locfile.c
index aecc891..7749f6a 100644
--- a/locale/programs/locfile.c
+++ b/locale/programs/locfile.c
@@ -920,17 +920,23 @@ void
check_all_categories (struct localedef_t *locale, struct charset_t *charset)
{
/* Call the finishing functions for all locales. */
- if ((locale->binary & (1 << LC_CTYPE)) == 0)
+ if ((locale->avail & (1 << LC_CTYPE)) != 0
+ && (locale->binary & (1 << LC_CTYPE)) == 0)
ctype_finish (locale, charset);
- if ((locale->binary & (1 << LC_COLLATE)) == 0)
+ if ((locale->avail & (1 << LC_COLLATE)) != 0
+ && (locale->binary & (1 << LC_COLLATE)) == 0)
collate_finish (locale, charset);
- if ((locale->binary & (1 << LC_MONETARY)) == 0)
+ if ((locale->avail & (1 << LC_MONETARY)) != 0
+ && (locale->binary & (1 << LC_MONETARY)) == 0)
monetary_finish (locale);
- if ((locale->binary & (1 << LC_NUMERIC)) == 0)
+ if ((locale->avail & (1 << LC_NUMERIC)) != 0
+ && (locale->binary & (1 << LC_NUMERIC)) == 0)
numeric_finish (locale);
- if ((locale->binary & (1 << LC_TIME)) == 0)
+ if ((locale->avail & (1 << LC_TIME)) != 0
+ && (locale->binary & (1 << LC_TIME)) == 0)
time_finish (locale);
- if ((locale->binary & (1 << LC_MESSAGES)) == 0)
+ if ((locale->avail & (1 << LC_MESSAGES)) != 0
+ && (locale->binary & (1 << LC_MESSAGES)) == 0)
messages_finish (locale);
}
@@ -940,12 +946,18 @@ write_all_categories (struct localedef_t *locale, struct charset_t *charset,
const char *output_path)
{
/* Call all functions to write locale data. */
- ctype_output (locale, charset, output_path);
- collate_output (locale, charset, output_path);
- monetary_output (locale, output_path);
- numeric_output (locale, output_path);
- time_output (locale, output_path);
- messages_output (locale, output_path);
+ if ((locale->avail & (1 << LC_CTYPE)) != 0)
+ ctype_output (locale, charset, output_path);
+ if ((locale->avail & (1 << LC_COLLATE)) != 0)
+ collate_output (locale, charset, output_path);
+ if ((locale->avail & (1 << LC_MONETARY)) != 0)
+ monetary_output (locale, output_path);
+ if ((locale->avail & (1 << LC_NUMERIC)) != 0)
+ numeric_output (locale, output_path);
+ if ((locale->avail & (1 << LC_TIME)) != 0)
+ time_output (locale, output_path);
+ if ((locale->avail & (1 << LC_MESSAGES)) != 0)
+ messages_output (locale, output_path);
}
diff --git a/login/getutent_r.c b/login/getutent_r.c
index ed4c330..98c5469 100644
--- a/login/getutent_r.c
+++ b/login/getutent_r.c
@@ -31,7 +31,7 @@
/* The various backends we have. */
static int getutent_r_unknown (struct utmp *buffer, struct utmp **result);
static struct utmp *pututline_unknown (const struct utmp *data);
-static void setutent_unknown (void);
+static int setutent_unknown (void);
static void endutent_unknown (void);
/* Initial Jump table. */
@@ -79,17 +79,22 @@ weak_alias (__endutent, endutent)
weak_alias (__endutent, endutxent)
-static void
+static int
setutent_unknown (void)
{
+ int result;
+
/* See whether utmpd is running. */
- if ((*__libc_utmp_daemon_functions.setutent) ())
+ result = (*__libc_utmp_daemon_functions.setutent) ();
+ if (result)
__libc_utmp_jump_table = &__libc_utmp_daemon_functions;
else
{
- (*__libc_utmp_file_functions.setutent) ();
+ result = (*__libc_utmp_file_functions.setutent) ();
__libc_utmp_jump_table = &__libc_utmp_file_functions;
}
+
+ return result;
}
diff --git a/manual/arith.texi b/manual/arith.texi
index 1268e37..7f8c205 100644
--- a/manual/arith.texi
+++ b/manual/arith.texi
@@ -201,7 +201,7 @@ better to use those in this section which are introduced in the @w{ISO C
@comment math.h
@comment ISO
-@deftypefun int fpclassify (@emph{float-type} @var{x})
+@deftypefn {Macro} int fpclassify (@emph{float-type} @var{x})
This is a generic macro which works on all floating-point types and
which returns a value of type @code{int}. The possible values are:
@@ -227,7 +227,7 @@ plain floating-point number without special meaning.
This macro is useful if more than property of a number must be
tested. If one only has to test for, e.g., a NaN value, there are
function which are faster.
-@end deftypefun
+@end deftypefn
The remainder of this section introduces some more specific functions.
They might be implemented faster than the call to @code{fpclassify} and
@@ -236,7 +236,7 @@ should be used (and not @code{fpclassify}).
@comment math.h
@comment ISO
-@deftypefun int isfinite (@emph{float-type} @var{x})
+@deftypefn {Macro} int isfinite (@emph{float-type} @var{x})
The value returned by this macro is nonzero if the value of @var{x} is
not plus or minus infinity and not NaN. I.e., it could be implemented as
@@ -247,11 +247,11 @@ not plus or minus infinity and not NaN. I.e., it could be implemented as
@code{isfinite} is also implemented as a macro which can handle all
floating-point types. Programs should use this function instead of
@var{finite} (@pxref{Predicates on Floats}).
-@end deftypefun
+@end deftypefn
@comment math.h
@comment ISO
-@deftypefun int isnormal (@emph{float-type} @var{x})
+@deftypefn {Macro} int isnormal (@emph{float-type} @var{x})
If @code{isnormal} returns a nonzero value the value or @var{x} is
neither a NaN, infinity, zero, nor a denormalized number. I.e., it
could be implemented as
@@ -259,11 +259,11 @@ could be implemented as
@smallexample
(fpclassify (x) == FP_NORMAL)
@end smallexample
-@end deftypefun
+@end deftypefn
@comment math.h
@comment ISO
-@deftypefun int isnan (@emph{float-type} @var{x})
+@deftypefn {Macro} int isnan (@emph{float-type} @var{x})
The situation with this macro is a bit complicated. Here @code{isnan}
is a macro which can handle all kinds of floating-point types. It
returns a nonzero value is @var{x} does not represent a NaN value and
@@ -287,7 +287,7 @@ situation the function be absolutely necessary one can use
to avoid the macro expansion. Using the macro has two big adavantages:
it is more portable and one does not have to choose the right function
among @code{isnan}, @code{isnanf}, and @code{isnanl}.
-@end deftypefun
+@end deftypefn
@node Operations on Complex
diff --git a/manual/errno.texi b/manual/errno.texi
index 800b039..c073deb 100644
--- a/manual/errno.texi
+++ b/manual/errno.texi
@@ -430,7 +430,7 @@ until some external condition makes it possible to read, write, or
connect (whatever the operation). You can use @code{select} to find out
when the operation will be possible; @pxref{Waiting for I/O}.
-@strong{Portability Note:} In older many Unix systems, this condition
+@strong{Portability Note:} In many older Unix systems, this condition
was indicated by @code{EWOULDBLOCK}, which was a distinct error code
different from @code{EAGAIN}. To make your program portable, you should
check for both codes and treat them the same.
diff --git a/manual/libc.texinfo b/manual/libc.texinfo
index 2d79d96..cb1769f 100644
--- a/manual/libc.texinfo
+++ b/manual/libc.texinfo
@@ -19,7 +19,7 @@
@c sold 0.06/1.09, print run out 21may96
@set EDITION 0.07 DRAFT
@set VERSION 2.00 Beta
-@set UPDATED 20 Jun 1997
+@set UPDATED 04 Aug 1997
@set ISBN 1-882114-53-1
@ifinfo
diff --git a/manual/math.texi b/manual/math.texi
index e2adccd..d4449bb 100644
--- a/manual/math.texi
+++ b/manual/math.texi
@@ -1,3 +1,11 @@
+@c We need some definitions here.
+@iftex
+@set TEXFORMULAS
+@end iftex
+@ifhtml
+@set cdot ·
+@end ifhtml
+
@node Mathematics, Arithmetic, Low-Level Terminal Interface, Top
@chapter Mathematics
@@ -25,13 +33,18 @@ in case of double using @code{double} is a good compromise.
@menu
-* Domain and Range Errors:: Detecting overflow conditions and the like.
-* Trig Functions:: Sine, cosine, and tangent.
-* Inverse Trig Functions:: Arc sine, arc cosine, and arc tangent.
-* Exponents and Logarithms:: Also includes square root.
-* Hyperbolic Functions:: Hyperbolic sine and friends.
-* Pseudo-Random Numbers:: Functions for generating pseudo-random
- numbers.
+* Domain and Range Errors:: Detecting overflow conditions and the like.
+* Exceptions in Math Functions:: Signalling exception in math functions.
+* Mathematical Constants:: Precise numeric values for often used
+ constant.
+* FP Comparison Functions:: Special functions to compare floating-point
+ numbers.
+* Trig Functions:: Sine, cosine, and tangent.
+* Inverse Trig Functions:: Arc sine, arc cosine, and arc tangent.
+* Exponents and Logarithms:: Also includes square root.
+* Hyperbolic Functions:: Hyperbolic sine and friends.
+* Pseudo-Random Numbers:: Functions for generating pseudo-random
+ numbers.
@end menu
@node Domain and Range Errors
@@ -72,11 +85,11 @@ and test @code{errno} afterward. As a consequence of this use of
@code{errno}, use of the mathematical functions is not reentrant if you
check for errors.
-@c !!! this isn't always true at the moment....
-None of the mathematical functions ever generates signals as a result of
-domain or range errors. In particular, this means that you won't see
-@code{SIGFPE} signals generated within these functions. (@xref{Signal
-Handling}, for more information about signals.)
+@c ### This is no longer true. --drepper
+@c None of the mathematical functions ever generates signals as a result of
+@c domain or range errors. In particular, this means that you won't see
+@c @code{SIGFPE} signals generated within these functions. (@xref{Signal
+@c Handling}, for more information about signals.)
@comment math.h
@comment ISO
@@ -111,13 +124,662 @@ This macro is introduced in @w{ISO C 9X}.
@end deftypevr
-@comment
+A special case is the @code{ilogb} function @pxref{Exponents and
+Logarithms}. Since the return value is an integer value, one cannot
+compare with @code{HUGE_VAL} etc. Therefore two further values are
+defined.
+
+@comment math.h
+@comment ISO
+@deftypevr Macro int FP_ILOGB0
+This value is returned by @code{ilogb} if the argument is @code{0}. The
+numeric value is either @code{INT_MIN} or @code{-INT_MAX}.
+
+This macro is introduced in @w{ISO C 9X}.
+@end deftypevr
+
+@comment math.h
+@comment ISO
+@deftypevr Macro int FP_ILOGBNAN
+This value is returned by @code{ilogb} if the argument is @code{NaN}. The
+numeric value is either @code{INT_MIN} or @code{INT_MAX}.
+
+This macro is introduced in @w{ISO C 9X}.
+@end deftypevr
+
For more information about floating-point representations and limits,
see @ref{Floating Point Parameters}. In particular, the macro
@code{DBL_MAX} might be more appropriate than @code{HUGE_VAL} for many
uses other than testing for an error in a mathematical function.
+
+@node Exceptions in Math Functions
+@section Exceptions in Math Functions
+@cindex exception
+@cindex signal
+
+Due to the restrictions in the size of the floating-point number
+representation or the limitation of the input range of certain functions
+some of the mathematical operations and functions have to signal
+exceptional situations. The @w{IEEE 754} standard specifies which
+exceptions have to be supported and how they can be handled.
+
+@w{IEEE 754} specifies two actions for floating-point exception: taking
+a trap or continuing without doing so. If the trap is taken a
+(possibly) user defined trap handler is called and this function can
+correct the argument or react somehow else on the call. If the trap
+handler returns, its return value is taken as the result of the
+operation.
+
+If no trap handler is called each of the known exceptions has a default
+action. This consists of setting a corresponding bit in the
+floating-point status word to indicate which kind of exception was
+raised and to return a default value, which depends on the exception
+(see the table below).
+
+@noindent
+The exceptions defined in @w{IEEE 754} are:
+
+@table @samp
+@item Invalid Operation
+This exception is raised if the given operands are invalid for the
+operation to be performed. Examples are
+(see @w{IEEE 754}, @w{section 7}):
+@enumerate
+@item
+Any operation on a signalling NaN.
+@item
+Addition or subtraction; magnitude subtraction of infinities such as
+@iftex
+@tex
+$(+\infty) + (-\infty)$.
+@end tex
+@end iftex
+@ifclear TEXFORMULAS
+@math{(+oo) + (-oo)}.
+@end ifclear
+@item
+Multiplication:
+@iftex
+@tex
+$0 \cdot \infty$.
+@end tex
+@end iftex
+@ifclear TEXFORMULAS
+@ifset cdot
+@math{0 @value{cdot} oo}.
+@end ifset
+@ifclear cdot
+@math{0 x oo}.
+@end ifclear
+@end ifclear
+
+@item
+Division: @math{0/0} or
+@iftex
+@tex
+$\infty/\infty$.
+@end tex
+@end iftex
+@ifclear TEXFORMULAS
+@math{oo/oo}.
+@end ifclear
+
+@item
+Remainder: @math{x} REM @math{y}, where @math{y} is zero or @math{x} is
+infinite.
+@item
+Squre root if the operand is less then zero.
+@item
+Conversion of an internal floating-point number to an integer or toa
+decimal string when overflow, infinity, or NaN precludes a faithful
+representation in that format and this cannot otherwise be signaled.
+@item
+Conversion of an unrecognizable input string.
+@item
+Comparison via predicates involving @math{<} or @math{>}, without
+@code{?}, when the operands are @dfn{unordered}. (@math{?>} means the
+unordered greater relation, @xref{FP Comparison Functions}).
+@end enumerate
+
+If the exception does not cause a trap handler to be called the result
+of the operation is taken as a quiet NaN.
+
+@item Division by Zero
+This exception is raised of the devisor is zero and the dividend is a
+finite nonzero number. If no trap occurs the result is either
+@iftex
+@tex
+$\infty$
+@end tex
+@end iftex
+@ifclear TEXFORMULAS
+@math{+oo}
+@end ifclear
+or
+@iftex
+@tex
+$-\infty$
+@end tex
+@end iftex
+@ifclear TEXFORMULAS
+@math{-oo}
+@end ifclear
+, depending on the
+signs of the operands.
+
+@item Overflow
+This exception is signalled whenever if the result cannot be represented
+as a finite value in the destination precision's format. If no trap
+occurs the result depends on the sign of the intermediate result and the
+current rounding mode (@w{IEEE 754}, @w{section 7.3}):
+@enumerate
+@item
+Round to nearest carries all overflows to
+@iftex
+@tex
+$\infty$
+@end tex
+@end iftex
+@ifclear TEXFORMULAS
+@math{oo}
+@end ifclear
+with the sign of the intermediate result.
+@item
+Round towards @math{0} carries all overflows to the precision's largest
+finite number with the sign of the intermediate result.
+@item
+Round towards
+@iftex
+@tex
+$-\infty$
+@end tex
+@end iftex
+@ifclear TEXFORMULAS
+@math{-oo}
+@end ifclear
+carries positive overflows to the
+precision's largest finite number and carries negative overflows to
+@iftex
+@tex
+$-\infty$.
+@end tex
+@end iftex
+@ifclear TEXFORMULAS
+@math{-oo}.
+@end ifclear
+
+@item
+Round towards
+@iftex
+@tex
+$\infty$
+@end tex
+@end iftex
+@ifclear TEXFORMULAS
+@math{oo}
+@end ifclear
+carries negative overflows to the
+precision's most negative finite number and carries positive overflows
+to
+@iftex
+@tex
+$\infty$.
+@end tex
+@end iftex
+@ifclear TEXFORMULAS
+@math{oo}.
+@end ifclear
+@end enumerate
+
+@item Underflow
+The underflow exception is created when a intermediate result is too
+small for the operation or if the operations result rounded to the
+destination precision causes a loss of accuracy by approximating the
+result by denormalized numbers.
+
+When no trap is installed for the underflow exception, underflow shall
+be signaled (via the underflow flag) only when both tininess and loss of
+accuracy have been detected. If no trap handler is installed the
+operation continues witht he inprecise small value or zero if the
+destination precision cannot hold the small exact result.
+
+@item Inexact
+This exception is signaled if the rounded result is not exact (such as
+computing the square root of two) or the result overflows without an
+overflow trap.
+@end table
+
+To control whether an exception causes a trap to occur all @w{IEEE 754}
+conformant floating-point implementation (either hardware or software)
+have a control word. By setting specific bits for each exception in
+this control word the programmer can decide whether a trap is wanted or
+not.
+
+@w{ISO C 9X} introduces a set of function which can be used to control
+exceptions. There are functions to manipulate the control word, to
+query the status word or to save and restore the whole state of the
+floating-point unit. There are also functions to control the rounding
+mode used.
+
+@menu
+* Status bit operations:: Manipulate the FP status word.
+* FPU environment:: Controlling the status of the FPU.
+* Rounding Modes:: Controlling the rounding mode.
+@end menu
+
+@node Status bit operations
+@subsection Controlling the FPU status word
+
+To control the five types of exceptions defined in @w{IEEE 754} some
+functions are defined which abstract the interface to the FPU. The
+actual implementation can be very different, depending on the underlying
+hardware or software.
+
+To address the single exception the @file{fenv.h} headers defines a
+number macros:
+
+@vtable @code
+@comment fenv.h
+@comment ISO
+@item FE_INEXACT
+Represent the inexact exception iff the FPU supports this exception.
+@comment fenv.h
+@comment ISO
+@item FE_DIVBYZERO
+Represent the divide by zero exception iff the FPU supports this exception.
+@comment fenv.h
+@comment ISO
+@item FE_UNDERFLOW
+Represent the underflow exception iff the FPU supports this exception.
+@comment fenv.h
+@comment ISO
+@item FE_OVERFLOW
+Represent the overflow exception iff the FPU supports this exception.
+@comment fenv.h
+@comment ISO
+@item FE_INVALID
+Represent the invalid exception iff the FPU supports this exception.
+@end vtable
+
+The macro @code{FE_ALL_EXCEPT} is the bitwise OR of all exception macros
+which are supported by the FP implementation.
+
+Each of the supported exception flag can either be set or unset. The
+@w{ISO C 9X} standard defines functions to set, unset and test the
+status of the flags.
+
+@comment fenv.h
+@comment ISO
+@deftypefun void feclearexcept (int @var{excepts})
+This functions clears all of the supported exception flags denoted by
+@var{excepts} in the status word.
+@end deftypefun
+
+To safe the current status of the flags in the status word @file{fenv.h}
+defines the type @code{fexcept_t} which can hold all the information.
+The following function can be used to retrieve the current setting.
+
+@comment fenv.h
+@comment ISO
+@deftypefun void fegetexceptflag (fexcept_t *@var{flagp}, int @var{excepts})
+Store in the variable pointed to by @var{flagp} an
+implementation-defined value representing the current setting of the
+exception flags indicated by the parameter @var{excepts}.
+@end deftypefun
+
+@noindent
+To restore the previously saved values one can use this functions:
+
+@comment fenv.h
+@comment ISO
+@deftypefun void fesetexceptflag (const fexcept_t *@var{flagp}, int @var{excepts})
+Restore from the variable pointed to by @var{flagp} the setting of the
+flags for the exceptions denoted by the value of the parameter
+@var{excepts}.
+@end deftypefun
+
+The last function allows to query the current status of the flags. The
+flags can be set either explicitely (using @code{fesetexceptflag} or
+@code{feclearexcept}) or by a floating-point operation which happened
+before. Since the flags are accumulative, the flags must be explicitely
+reset using @code{feclearexcept} if one wants to test for a certain
+exceptions raised by a specific piece of code.
+
+@comment fenv.h
+@comment ISO
+@deftypefun int fetestexcept (int @var{excepts})
+Test whether a subset of the flags indicated by the parameter
+@var{except} is currently set. If yes, a nonzero value is returned
+which specifies which exceptions are set. Otherwise the result is zero.
+@end deftypefun
+
+@noindent
+Code which uses the @code{fetestexcept} function could look like this:
+
+@smallexample
+@{
+ double f;
+ int raised;
+ feclearexcept (FE_ALL_EXCEPT);
+ f = compute ();
+ raised = fetestexcept (FE_OVERFLOW | FE_INVALID);
+ if (raised & FE_OVERFLOW) @{ /* ... */ @}
+ if (raised & FE_INVALID) @{ /* ... */ @}
+ /* ... */
+@}
+@end smallexample
+
+Please note that the return value of @code{fetestexcept} is @code{int}
+but this does not mean that the @code{fexcept_t} type is generally
+representable as an integer. These are completely independent types.
+
+
+@node FPU environment
+@subsection Controlling the Floating-Point environment
+
+It is sometimes necessary so save the complete status of the
+floating-point unit for a certain time to perform some completely
+different actions. Beside the status of the exception flags, the
+control word for the exceptions and the rounding mode can be safed.
+
+The file @file{fenv.h} defines the type @code{fenv_t}. The layout of a
+variable of this type is implementation defined but the variable is able
+to contain the complete status informations. To fill a variable of this
+type one can use this function:
+
+@comment fenv.h
+@comment ISO
+@deftypefun void fegetenv (fenv_t *@var{envp})
+Store the current floating-point environment in the object pointed to by
+@var{envp}.
+@end deftypefun
+
+@noindent
+Another possibility which is useful is several situations is
+
+@comment fenv.h
+@comment ISO
+@deftypefun int feholdexcept (fenv_t *@var{envp})
+Store the current floating-point environment in the object pointed to by
+@var{envp}. Afterwards, all exception flags are cleared and if
+available a mode is installed which continues on all exception and does
+not cause a trap to occur. In ths case a nonzero value is returned.
+
+If the floating-point implementation does not support such a non-stop
+mode, the return value is zero.
+@end deftypefun
+
+The functions which allow a state of the floating-point unit to be
+restored can take two kinds of arguments:
+
+@itemize @bullet
+@item
+Pointed to objects which previously were initialized by a call to
+@code{fegetenv} or @code{feholdexcept}.
+@item
+@vindex FE_DFL_ENV
+The special macro @code{FE_DFL_ENV} which represents the floating-point
+environment as it was available at program start.
+@item
+Implementation defined macros with names starting with @code{FE_}.
+
+@vindex FE_NOMASK_ENV
+If possible, the GNU C Library defines a macro @code{FE_NOMASK_ENV}
+which represents an environment where no exception is masked and so each
+raised exception causes a trap to occur. Whether this macro is available can easily be tested using @code{#ifdef}.
+
+Some platforms might define further predefined environments.
+@end itemize
+
+@noindent
+To set any of the environments there are two functions defined.
+
+@deftypefun void fesetenv (const fenv_t *@var{envp})
+Establish the floating-point environment described in the object pointed
+to by @var{envp}. Even if one or more exceptions flags in the restored
+environment are set no exception is raised.
+@end deftypefun
+
+In some situations the previous status of the exception flags must not
+simply be discarded and so this function is useful:
+
+@deftypefun void feupdateenv (const fenv_t *@var{envp})
+The current status of the floating-point unit is preserved in some
+automatic storage before the environment described by the object pointed
+to by @var{envp} is installed. Once this is finished all exceptions set
+in the original environment which is saved in the automatic storage, is
+raised.
+@end deftypefun
+
+This function can be used to execute a part of the program with an
+environment which masks all exceptions and before switching back remove
+unwanted exception and raise the remaining exceptions.
+
+
+@node Rounding Modes
+@subsection Rounding modes of the Floating-Point Unit
+
+@w{IEEE 754} defines four different rounding modes. If the rounding
+mode is supported by the floating-point implementation the corresponding
+of the following macros is defined:
+
+@vtable @code
+@comment fenv.h
+@comment ISO
+@item FE_TONEAREST
+Round to nearest. This is the default mode and should always be used
+except when a different mode is explicitely required. Only rounding to
+nearest guarantees numeric stability of the computations.
+
+@comment fenv.h
+@comment ISO
+@item FE_UPWARD
+Round toward
+@iftex
+@tex
+$+\infty$.
+@end tex
+@end iftex
+@ifclear TEXFORMULAS
+@math{+oo}.
+@end ifclear
+
+@comment fenv.h
+@comment ISO
+@item FE_DOWNWARD
+Round toward
+@iftex
+@tex
+$-\infty$.
+@end tex
+@end iftex
+@ifclear TEXFORMULAS
+@math{-oo}.
+@end ifclear
+
+@comment fenv.h
+@comment ISO
+@item FE_TOWARDZERO
+Round toward zero.
+@end vtable
+
+At any time one of the four rounding modes above is selected. To get
+information about the currently selected mode one can use this function:
+
+@comment fenv.h
+@comment ISO
+@deftypefun int fegetround (void)
+Return the currently selected rounding mode, represented by one of the
+values of the defined rouding mode macros.
+@end deftypefun
+
+@noindent
+To set a specific rounding mode the next function can be used.
+
+@comment fenv.h
+@comment ISO
+@deftypefun int fesetround (int @var{round})
+Change the currently selected rounding mode to the mode described by the
+parameter @var{round}. If @var{round} does not correspond to one of the
+supported rounding modes nothing is changed.
+
+The function return a nonzero value iff the requested rounding mode can
+be established. Otherwise zero is returned.
+@end deftypefun
+
+Changing the rounding mode can be necessary for various reasons. But
+changing the mode only to round a given number normally is no good idea.
+The standard defines a set of functions which can be used to round an
+argument according to some rules and for all of the rounding modes there
+is a corresponding function.
+
+If a large set of number has to be rounded it might be good to change
+the rounding mode and do not use the function the library provides. So
+the perhaps necessary switching of the rounding mode in the library
+function can be avoided. But since not all rounding modes are
+guaranteed to exist on any platform this possible implementation cannot
+be portably used. A default method has to be implemented as well.
+
+
+@node Mathematical Constants
+@section Predefined Mathematical Constants
+@cindex constants
+@cindex mathematical constants
+
+The header @file{math.h} defines a series of mathematical constants if
+@code{_BSD_SOURCE} or a more general feature select macro is defined
+before including this file. All values are defined as preprocessor
+macros starting with @code{M_}. The collection includes:
+
+@vtable @code
+@item M_E
+The value is that of the base of the natural logarithm.
+@item M_LOG2E
+The value is computed as the logarithm to base @code{2} of @code{M_E}.
+@item M_LOG10E
+The value is computed as the logarithm to base @code{10} of @code{M_E}.
+@item M_LN2
+The value is computed as the natural logarithm of @code{2}.
+@item M_LN10
+The value is computed as the natural logarithm of @code{10}.
+@item M_PI
+The value is those of the number pi.
+@item M_PI_2
+The value is those of the number pi divided by two.
+@item M_PI_4
+The value is those of the number pi divided by four.
+@item M_1_PI
+The value is the reziprocal of the value of the number pi.
+@item M_2_PI
+The value is two times the reziprocal of the value of the number pi.
+@item M_2_SQRTPI
+The value is two times the reziprocal of the square root of the number pi.
+@item M_SQRT2
+The value is the square root of the value of the number pi.
+@item M_SQRT1_2
+The value is the reziprocal of the square root of the value of the number pi.
+@end vtable
+
+ALl values are defined as @code{long double} values unless the compiler
+does not support this type or @code{__STDC__} is not defined (both is
+unlikey). Historically the numbers were @code{double} values and some
+old code still relies on this so you might want to add explizit casts if
+the extra precision of the @code{long double} value is not needed. One
+critical case are functions with a variable number of arguments, such as
+@code{printf}.
+
+@vindex PI
+@emph{Note:} Some programs use a constant named @code{PI} which has the
+same value as @code{M_PI}. This probably derives from Stroustroup's
+book about his C++ programming language where this value is used in
+examples (and perhaps some AT&T headers contain this value). But due to
+possible name space problems (@code{PI} is a quite frequently used name)
+this value is not added to @file{math.h}. Every program should use
+@code{M_PI} instead or add on the the compiler command line
+@code{-DPI=M_PI}.
+
+
+@node FP Comparison Functions
+@section Floating-Point Comparison Functions
+@cindex unordered comparison
+
+The @w{IEEE 754} standards defines s'a set of functions which allows to
+compare even those numbers which normally would cause an exception to be
+raised since they are unordered. E.g., the expression
+
+@smallexample
+int v = a < 1.0;
+@end smallexample
+
+@noindent
+would raise an exception if @var{a} would be a NaN. Functions to
+compare unordered numbers are part of the FORTRAN language for a long
+time and the extensions in @w{ISO C 9X} finally introduce them as well
+for the C programming language.
+
+All of the operations are implemented as macros which allow their
+arguments to be of either @code{float}, @code{double}, or @code{long
+double} type.
+
+@comment math.h
+@comment ISO
+@deftypefn {Macro} int isgreater (@emph{real-floating} @var{x}, @emph{real-floating} @var{y})
+This macro determines whether the argument @var{x} is greater than
+@var{y}. This is equivalent to @math{(x) > (y)} but no exception is
+raised if @var{x} or @var{y} are unordered.
+@end deftypefn
+
+@comment math.h
+@comment ISO
+@deftypefn {Macro} int isgreaterequal (@emph{real-floating} @var{x}, @emph{real-floating} @var{y})
+This macro determines whether the argument @var{x} is greater than or
+equal to @var{y}. This is equivalent to @math{(x) >= (y)} but no
+exception is raised if @var{x} or @var{y} are unordered.
+@end deftypefn
+
+@comment math.h
+@comment ISO
+@deftypefn {Macro} int isless (@emph{real-floating} @var{x}, @emph{real-floating} @var{y})
+This macro determines whether the argument @var{x} is less than @var{y}.
+This is equivalent @math{(x) < (y)} but no exception is raised if
+@var{x} or @var{y} are unordered.
+@end deftypefn
+
+@comment math.h
+@comment ISO
+@deftypefn {Macro} int islessequal (@emph{real-floating} @var{x}, @emph{real-floating} @var{y})
+This macro determines whether the argument @var{x} is less than or equal
+to @var{y}. This is equivalent to @math{(x) <= (y)} but no exception
+is raised if @var{x} or @var{y} are unordered.
+@end deftypefn
+
+@comment math.h
+@comment ISO
+@deftypefn {Macro} int islessgreater (@emph{real-floating} @var{x}, @emph{real-floating} @var{y})
+This macro determines whether the argument @var{x} is less or greater
+than @var{y}. This is equivalent to @math{(x) < (y) || (x) > (y)}
+(except that @var{x} and @var{y} are only evaluated once) but no
+exception is raised if @var{x} or @var{y} are unordered.
+@end deftypefn
+
+@comment math.h
+@comment ISO
+@deftypefn {Macro} int isunordered (@emph{real-floating} @var{x}, @emph{real-floating} @var{y})
+This macro determines whether its arguments are unordered.
+@end deftypefn
+
+All the macros are defined in a way to ensure that both arguments are
+evaluated exactly once and so they can be used exactly like the builtin
+operators.
+
+On several platform these macros are mapped on very efficient functions
+the processor understands. But on machines missing these functions, the
+macros above might be rather slow. So it is best to use the builtin
+operators unless it is necessary to use unordered comparisons.
+
+
@node Trig Functions
@section Trigonometric Functions
@cindex trigonometric functions
@@ -128,11 +790,9 @@ that pi radians equals 180 degrees.
@cindex pi (trigonometric constant)
The math library does define a symbolic constant for pi in @file{math.h}
-when BSD compliance is required (@pxref{Feature Test Macros}). Beside
-pi several other constants are defined.
-
-@noindent
-In case it is not possible to use this macro one easily can define it:
+(@pxref{Mathematical Constants}) when BSD compliance is required
+(@pxref{Feature Test Macros}). In case it is not possible to use this
+predefined macro one easily can define it:
@smallexample
#define M_PI 3.14159265358979323846264338327
@@ -458,6 +1118,60 @@ different base, it is similar to the @code{log} function. In fact,
@comment math.h
@comment ISO
+@deftypefun double logb (double @var{x})
+@deftypefunx float logbf (float @var{x})
+@deftypefunx {long double} logbl (long double @var{x})
+These functions extract the exponent of @var{x} and return it as a
+signed integer value. If @var{x} is zero, a range error may occur.
+
+A special case are subnormal numbers (if supported by the floating-point
+format). The exponent returned is not the actual value from @var{x}.
+Instead the number is first normalized as if the range of the exponent
+field is large enough.
+@end deftypefun
+
+@comment math.h
+@comment ISO
+@deftypefun int ilogb (double @var{x})
+@deftypefunx int ilogbf (float @var{x})
+@deftypefunx int ilogbl (long double @var{x})
+These functions are equivalent to the corresponding @code{logb}
+functions except that the values are returned as signed integer values.
+Since integer values cannot represent infinity and NaN, there are some
+special symbols defined to help detect these situations.
+
+@vindex FP_ILOGB0
+@vindex FP_ILOGBNAN
+@code{ilogb} returns @code{FP_ILOGB0} if @var{x} is @code{0} and it
+returns @code{FP_ILOGBNAN} if @var{x} is @code{NaN}. These values are
+system specific and no fixed value is assigned. More concrete, these
+values might even have the same value. So a piece of code handling the
+result of @code{ilogb} could look like this:
+
+@smallexample
+i = ilogb (f);
+if (i == FP_ILOGB0 || i == FP_ILOGBNAN)
+ @{
+ if (isnan (f))
+ @{
+ /* @r{Handle NaN.} */
+ @}
+ else if (f == 0.0)
+ @{
+ /* @r{Handle 0.0.} */
+ @}
+ else
+ @{
+ /* @r{Some other value with large exponent,}
+ @r{perhaps +Inf.} */
+ @}
+ @}
+@end smallexample
+
+@end deftypefun
+
+@comment math.h
+@comment ISO
@deftypefun double pow (double @var{base}, double @var{power})
@deftypefunx float powf (float @var{base}, float @var{power})
@deftypefunx {long double} powl (long double @var{base}, long double @var{power})
@@ -758,6 +1472,7 @@ the real valued function @code{atanh} there is not limit for the range
of the argument.
@end deftypefun
+
@node Pseudo-Random Numbers
@section Pseudo-Random Numbers
@cindex random numbers
@@ -928,7 +1643,7 @@ since the state consists of a 48 bit array.
@comment stdlib.h
@comment SVID
-@deftypefun double drand48 ()
+@deftypefun double drand48 (void)
This function returns a @code{double} value in the range of @code{0.0}
to @code{1.0} (exclusive). The random bits are determined by the global
state of the random number generator in the C library.
@@ -953,7 +1668,7 @@ using to get reproducible results.
@comment stdlib.h
@comment SVID
-@deftypefun {long int} lrand48 ()
+@deftypefun {long int} lrand48 (void)
The @code{lrand48} functions return an integer value in the range of
@code{0} to @code{2^31} (exclusive). Even if the size of the @code{long
int} type can take more than 32 bits no higher numbers are returned.
@@ -977,7 +1692,7 @@ the first call to get reproducible results.
@comment stdlib.h
@comment SVID
-@deftypefun {long int} mrand48 ()
+@deftypefun {long int} mrand48 (void)
The @code{mrand48} function is similar to @code{lrand48}. The only
difference is that the numbers returned are in the range @code{-2^31} to
@code{2^31} (exclusive).
diff --git a/manual/pattern.texi b/manual/pattern.texi
index 020a40e..1decfe3 100644
--- a/manual/pattern.texi
+++ b/manual/pattern.texi
@@ -1202,9 +1202,6 @@ expand_and_execute (const char *program, const char *options)
@}
@end smallexample
-In practice, since @code{wordexp} is executed by running a subshell, it
-would be faster to do this by concatenating the strings with spaces
-between them and running that as a shell command using @samp{sh -c}.
@c No sense finishing this for here.
@ignore
diff --git a/manual/socket.texi b/manual/socket.texi
index cc39bec..0353eb7 100644
--- a/manual/socket.texi
+++ b/manual/socket.texi
@@ -128,6 +128,28 @@ protocol} which you can request by specifying 0 as the protocol
number. And that's what you should normally do---use the default.
@end itemize
+Throughout the following description at various places
+variables/parameters to denote sizes are required. And here the trouble
+starts. In the first implementations the type of these variables was
+simply @code{int}. This type was on almost all machines of this time 32
+bits wide and so a de-factor standard required 32 bit variables. This
+is important since references to variables of this type are passed to
+the kernel.
+
+But now the POSIX people came and unified the interface with their words
+"all size values are of type @code{size_t}". But on 64 bit machines
+@code{size_t} is 64 bits wide and so variable references are not anymore
+possible.
+
+A solution provides the Unix98 specification which finally introduces a
+type @code{socklen_t}. This type is used in all of the cases in
+previously changed to use @code{size_t}. The only requirement of this
+type is that it is an unsigned type of at least 32 bits. Therefore,
+implementations which require references to 32 bit variables be passed
+can be as happy as implementations which right from the start of 64 bit
+values.
+
+
@node Communication Styles
@section Communication Styles
@@ -358,7 +380,7 @@ For examples of use, see @ref{File Namespace}, or see @ref{Inet Example}.
@comment sys/socket.h
@comment BSD
-@deftypefun int bind (int @var{socket}, struct sockaddr *@var{addr}, size_t @var{length})
+@deftypefun int bind (int @var{socket}, struct sockaddr *@var{addr}, socklen_t @var{length})
The @code{bind} function assigns an address to the socket
@var{socket}. The @var{addr} and @var{length} arguments specify the
address; the detailed format of the address depends on the namespace.
@@ -406,7 +428,7 @@ Internet socket. The prototype for this function is in the header file
@comment sys/socket.h
@comment BSD
-@deftypefun int getsockname (int @var{socket}, struct sockaddr *@var{addr}, size_t *@var{length-ptr})
+@deftypefun int getsockname (int @var{socket}, struct sockaddr *@var{addr}, socklen_t *@var{length-ptr})
The @code{getsockname} function returns information about the
address of the socket @var{socket} in the locations specified by the
@var{addr} and @var{length-ptr} arguments. Note that the
@@ -1688,7 +1710,7 @@ program must do, using the @code{connect} function, which is declared in
@comment sys/socket.h
@comment BSD
-@deftypefun int connect (int @var{socket}, struct sockaddr *@var{addr}, size_t @var{length})
+@deftypefun int connect (int @var{socket}, struct sockaddr *@var{addr}, socklen_t @var{length})
The @code{connect} function initiates a connection from the socket
with file descriptor @var{socket} to the socket whose address is
specified by the @var{addr} and @var{length} arguments. (This socket
@@ -1833,7 +1855,7 @@ queue.
@comment sys/socket.h
@comment BSD
-@deftypefun int accept (int @var{socket}, struct sockaddr *@var{addr}, size_t *@var{length-ptr})
+@deftypefun int accept (int @var{socket}, struct sockaddr *@var{addr}, socklen_t *@var{length-ptr})
This function is used to accept a connection request on the server
socket @var{socket}.
@@ -2327,7 +2349,7 @@ more information about the @code{connect} function.
@comment sys/socket.h
@comment BSD
-@deftypefun int sendto (int @var{socket}, void *@var{buffer}. size_t @var{size}, int @var{flags}, struct sockaddr *@var{addr}, size_t @var{length})
+@deftypefun int sendto (int @var{socket}, void *@var{buffer}. size_t @var{size}, int @var{flags}, struct sockaddr *@var{addr}, socklen_t @var{length})
The @code{sendto} function transmits the data in the @var{buffer}
through the socket @var{socket} to the destination address specified
by the @var{addr} and @var{length} arguments. The @var{size} argument
@@ -2356,7 +2378,7 @@ also tells you where it was sent from. This function is declared in
@comment sys/socket.h
@comment BSD
-@deftypefun int recvfrom (int @var{socket}, void *@var{buffer}, size_t @var{size}, int @var{flags}, struct sockaddr *@var{addr}, size_t *@var{length-ptr})
+@deftypefun int recvfrom (int @var{socket}, void *@var{buffer}, size_t @var{size}, int @var{flags}, struct sockaddr *@var{addr}, socklen_t *@var{length-ptr})
The @code{recvfrom} function reads one packet from the socket
@var{socket} into the buffer @var{buffer}. The @var{size} argument
specifies the maximum number of bytes to be read.
@@ -2583,7 +2605,7 @@ They are declared in @file{sys/socket.h}.
@comment sys/socket.h
@comment BSD
-@deftypefun int getsockopt (int @var{socket}, int @var{level}, int @var{optname}, void *@var{optval}, size_t *@var{optlen-ptr})
+@deftypefun int getsockopt (int @var{socket}, int @var{level}, int @var{optname}, void *@var{optval}, socklen_t *@var{optlen-ptr})
The @code{getsockopt} function gets information about the value of
option @var{optname} at level @var{level} for socket @var{socket}.
@@ -2613,7 +2635,7 @@ The @var{optname} doesn't make sense for the given @var{level}.
@comment sys/socket.h
@comment BSD
-@deftypefun int setsockopt (int @var{socket}, int @var{level}, int @var{optname}, void *@var{optval}, size_t @var{optlen})
+@deftypefun int setsockopt (int @var{socket}, int @var{level}, int @var{optname}, void *@var{optval}, socklen_t @var{optlen})
This function is used to set the socket option @var{optname} at level
@var{level} for socket @var{socket}. The value of the option is passed
in the buffer @var{optval}, which has size @var{optlen}.
diff --git a/manual/texinfo.tex b/manual/texinfo.tex
index 813d3c2..35bc0b0 100644
--- a/manual/texinfo.tex
+++ b/manual/texinfo.tex
@@ -1,5 +1,5 @@
%% TeX macros to handle Texinfo files.
-%% $Id: texinfo.tex,v 2.211 1997/07/28 21:55:24 drepper Exp $
+%% $Id: texinfo.tex,v 2.212 1997/08/04 14:14:11 drepper Exp $
% Copyright (C) 1985, 86, 88, 90, 91, 92, 93,
% 94, 95, 96, 97 Free Software Foundation, Inc.
@@ -36,7 +36,7 @@
% This automatically updates the version number based on RCS.
\def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}}
-\deftexinfoversion$Revision: 2.211 $
+\deftexinfoversion$Revision: 2.212 $
\message{Loading texinfo package [Version \texinfoversion]:}
% If in a .fmt file, print the version number
@@ -121,7 +121,7 @@
% For @cropmarks command.
% Do @cropmarks to get crop marks.
-%
+%
\newif\ifcropmarks
\let\cropmarks = \cropmarkstrue
%
@@ -1396,10 +1396,6 @@ where each line of input produces a line of output.}
% the catcodes are wrong for parsearg to work.)
\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}
-% If you use @setkbdinputexample, then @kbd produces slanted tty font
-% only inside of @example and friends.
-\def\setkbdinputexample{\gdef\kbdexamplefont\ttsl}
-
\def\xkey{\key}
\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}%
\ifx\one\xkey\ifx\threex\three \key{#2}%
@@ -1412,7 +1408,7 @@ where each line of input produces a line of output.}
% @uref (abbreviation for `urlref') takes an optional second argument
% specifying the text to display. First (mandatory) arg is the url.
% Perhaps eventually put in a hypertex \special here.
-%
+%
\def\uref#1{\urefxxx #1,,\finish}
\def\urefxxx#1,#2,#3\finish{%
\setbox0 = \hbox{\ignorespaces #2}%
@@ -2645,7 +2641,7 @@ width0pt\relax} \fi
\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns
% Grab any single-column material above us.
\output = {\global\setbox\partialpage = \vbox{%
- %
+ %
% Here is a possibility not foreseen in manmac: if we accumulate a
% whole lot of material, we might end up calling this \output
% routine twice in a row (see the doublecol-lose test, which is
@@ -4402,15 +4398,15 @@ width0pt\relax} \fi
% Read the last existing aux file, if any. No error if none exists.
\def\readauxfile{\begingroup
\catcode`\^^@=\other
- \catcode`\^=\other
- \catcode`\^=\other
+ \catcode`\^^A=\other
+ \catcode`\^^B=\other
\catcode`\^^C=\other
\catcode`\^^D=\other
\catcode`\^^E=\other
\catcode`\^^F=\other
\catcode`\^^G=\other
\catcode`\^^H=\other
- \catcode`\^ =\other
+ \catcode`\^^K=\other
\catcode`\^^L=\other
\catcode`\^^N=\other
\catcode`\^^P=\other
@@ -4617,7 +4613,7 @@ width0pt\relax} \fi
% @image. We use the macros from epsf.tex to support this.
% If epsf.tex is not installed and @image is used, we complain.
-%
+%
% Check for and read epsf.tex up front. If we read it only at @image
% time, we might be inside a group, and then its definitions would get
% undone and the next image would fail.
diff --git a/manual/time.texi b/manual/time.texi
index d0b0e0a..1022e1a 100644
--- a/manual/time.texi
+++ b/manual/time.texi
@@ -885,11 +885,30 @@ A literal @samp{%} character.
The @var{size} parameter can be used to specify the maximum number of
characters to be stored in the array @var{s}, including the terminating
null character. If the formatted time requires more than @var{size}
-characters, the excess characters are discarded. The return value from
-@code{strftime} is the number of characters placed in the array @var{s},
-not including the terminating null character. If the value equals
-@var{size}, it means that the array @var{s} was too small; you should
-repeat the call, providing a bigger array.
+characters, @code{strftime} return zero and the content of the array
+@var{s} is indetermined. Otherwise the return value indicates the
+number of characters placed in the array @var{s}, not including the
+terminating null character.
+
+@emph{Warning:} This convention for the return value which is prescribed
+in @w{ISO C} can lead to problems in some situations. For certain
+format strings and certain locales the output really can be the empty
+string and this cannot be discovered by testing the return value only.
+E.g., in most locales the AM/PM time format is not supported (most of
+the world uses the 24 hour time representation). In such locales
+@code{"%p"} will return the empty string, i.e., the return value is
+zero. To detect situations like this something similar to the following
+code should be used:
+
+@smallexample
+buf[0] = '\1';
+len = strftime (buf, bufsize, format, tp);
+if (len == 0 && buf[0] != '\0')
+ @{
+ /* Something went wrong in the strftime call. */
+ @dots{}
+ @}
+@end smallexample
If @var{s} is a null pointer, @code{strftime} does not actually write
anything, but instead returns the number of characters it would have written.
diff --git a/math/math.h b/math/math.h
index f1f8260..762ccbe 100644
--- a/math/math.h
+++ b/math/math.h
@@ -264,10 +264,10 @@ extern int matherr __P ((struct exception *__exc));
/* Some useful constants. */
# define M_E _Mldbl(2.7182818284590452354) /* e */
-# define M_LOG2E _Mldbl(1.4426950408889634074) /* log 2e */
-# define M_LOG10E _Mldbl(0.43429448190325182765) /* log 10e */
-# define M_LN2 _Mldbl(0.69314718055994530942) /* log e2 */
-# define M_LN10 _Mldbl(2.30258509299404568402) /* log e10 */
+# define M_LOG2E _Mldbl(1.4426950408889634074) /* log_2 e */
+# define M_LOG10E _Mldbl(0.43429448190325182765) /* log_10 e */
+# define M_LN2 _Mldbl(0.69314718055994530942) /* log_e 2 */
+# define M_LN10 _Mldbl(2.30258509299404568402) /* log_e 10 */
# define M_PI _Mldbl(3.14159265358979323846) /* pi */
# define M_PI_2 _Mldbl(1.57079632679489661923) /* pi/2 */
# define M_PI_4 _Mldbl(0.78539816339744830962) /* pi/4 */
@@ -312,34 +312,50 @@ extern int matherr __P ((struct exception *__exc));
/* Return nonzero value if X is greater than Y. */
# ifndef isgreater
-# define isgreater(x, y) (!isunordered ((x), (y)) && (x) > (y))
+# define isgreater(x, y) \
+ (__extension__ \
+ ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
+ !isunordered (__x, __y) && __x > __y; }))
# endif
/* Return nonzero value if X is greater than or equal to Y. */
# ifndef isgreaterequal
-# define isgreaterequal(x, y) (!isunordered ((x), (y)) && (x) >= (y))
+# define isgreaterequal(x, y) \
+ (__extension__ \
+ ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
+ !isunordered (__x, __y) && __x >= __y; }))
# endif
/* Return nonzero value if X is less than Y. */
# ifndef isless
-# define isless(x, y) (!isunordered ((x), (y)) && (x) < (y))
+# define isless(x, y) \
+ (__extension__ \
+ ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
+ !isunordered (__x, __y) && __x < __y; }))
# endif
/* Return nonzero value if X is less than or equal to Y. */
# ifndef islessequal
-# define islessequal(x, y) (!isunordered ((x), (y)) && (x) <= (y))
+# define islessequal(x, y) \
+ (__extension__ \
+ ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
+ !isunordered (__x, __y) && __x <= __y; }))
# endif
/* Return nonzero value if either X is less than Y or Y is less than X. */
# ifndef islessgreater
# define islessgreater(x, y) \
- (!isunordered ((x), (y)) && ((x) < (y) || (y) < (x)))
+ (__extension__ \
+ ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
+ !isunordered (__x, __y) && (__x < __y || __y < __x); }))
# endif
/* Return nonzero value if arguments are unordered. */
# ifndef isunordered
# define isunordered(x, y) \
- (fpclassify (x) == FP_NAN || fpclassify (y) == FP_NAN)
+ (__extension__ \
+ ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
+ fpclassify (__x) == FP_NAN || fpclassify (__y) == FP_NAN; }))
# endif
#endif
diff --git a/nis/nis_findserv.c b/nis/nis_findserv.c
index a04abd8..5ab369c 100644
--- a/nis/nis_findserv.c
+++ b/nis/nis_findserv.c
@@ -134,7 +134,7 @@ nis_null_3_recv (void *argp, CLIENT * clnt)
struct findserv_req
{
struct sockaddr_in sin;
- u_long xid;
+ u_int32_t xid;
u_int server_nr;
u_int server_ep;
};
@@ -146,7 +146,7 @@ __nis_findfastest (dir_binding * bind)
struct findserv_req **pings;
struct sockaddr_in sin;
int found = -1;
- time_t xid_seed, xid_lookup;
+ uint32_t xid_seed, xid_lookup;
int sock, dontblock = 1;
CLIENT *clnt;
void *foo = NULL;
@@ -157,7 +157,7 @@ __nis_findfastest (dir_binding * bind)
for multihomed hosts */
pings_count = 0;
pings = malloc (sizeof (struct findserv_req *) * pings_max);
- xid_seed = time (NULL) ^ getpid ();
+ xid_seed = (uint32_t) (time (NULL) ^ getpid ());
memset (&sin, '\0', sizeof (sin));
sin.sin_family = AF_INET;
diff --git a/nis/rpcsvc/nis.h b/nis/rpcsvc/nis.h
index e24c7d0..b91ce19 100644
--- a/nis/rpcsvc/nis.h
+++ b/nis/rpcsvc/nis.h
@@ -767,7 +767,7 @@ typedef enum name_pos name_pos;
#endif
/* Prototypes, and extern declarations for the NIS library functions. */
-#include <bits/nislib.h>
+#include <rpcsvc/nislib.h>
#endif /* __NIS_RPCGEN_H */
/* EDIT_START */
diff --git a/nis/rpcsvc/nis.x b/nis/rpcsvc/nis.x
index e68114c..20a4733 100644
--- a/nis/rpcsvc/nis.x
+++ b/nis/rpcsvc/nis.x
@@ -423,7 +423,7 @@ program NIS_PROG {
%#endif
%
%/* Prototypes, and extern declarations for the NIS library functions. */
-%#include <bits/nislib.h>
+%#include <rpcsvc/nislib.h>
%#endif /* __NIS_RPCGEN_H */
%/* EDIT_START */
%
diff --git a/nis/rpcsvc/nislib.h b/nis/rpcsvc/nislib.h
new file mode 100644
index 0000000..73b3804
--- /dev/null
+++ b/nis/rpcsvc/nislib.h
@@ -0,0 +1,268 @@
+/* Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef __RPCSVC_NISLIB_H__
+#define __RPCSVC_NISLIB_H__
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+typedef const char *const_nis_name;
+
+/* nis_names: These functions are used to locate and manipulate all NIS+
+ * objects except the NIS+ entry objects.
+ *
+ * nis_lookup (name, flags) resolves a NIS+ name and returns a copy of
+ * that object from a NIS+ server.
+ * const nis_name name: name of the object to be resolved
+ * u_long flags: logically ORing zero or more flags (FOLLOW_LINKS,
+ * HARD_LOOKUP, [NO_CACHE], MASTER_ONLY, EXPAND_NAME)
+ *
+ * nis_add (name, obj) adds objects to the NIS+ namespace.
+ * const nis_name name: fully qualified NIS+ name.
+ * const nis_object *obj: object members zo_name and zo_domain will be
+ * constructed from name.
+ *
+ * nis_remove (name, obj) removes objects from the NIS+ namespace.
+ * const nis_name name: fully qualified NIS+ name.
+ * const nis_object *obj: if not NULL, it is assumed to point to a copy
+ * of the object being removed. In this case, if
+ * the object on the server does not have the same
+ * object identifier as the object being passed,
+ * the operation will fail with the NIS_NOTSAMEOBJ
+ * error.
+ *
+ * nis_modify (name, obj) can change specific attributes of an object
+ * that already exists in the namespace.
+ */
+extern nis_result *nis_lookup __P ((const_nis_name name, u_long flags));
+extern nis_result *nis_add __P ((const_nis_name name, const nis_object *obj));
+extern nis_result *nis_remove __P ((const_nis_name name,
+ const nis_object *obj));
+extern nis_result *nis_modify __P ((const_nis_name name,
+ const nis_object *obj));
+
+/* nis_tables: These functions are used to search and modify NIS+ tables.
+ *
+ * nis_list (table_name, flags, callback(table_name, obj, userdata), userdata)
+ * search a table in the NIS+ namespace.
+ * const nis_name table_name: indexed name ([xx=yy],table.dir)
+ * u_long flags: logically ORing one or more flags (FOLLOW_LINKS,
+ * [FOLLOW_PATH], HARD_LOOKUP, [ALL_RESULTS], [NO_CACHE],
+ * MASTER_ONLY, EXPAND_NAME, RETURN_RESULT)
+ * callback(): callback is an optional pointer to a function that will
+ * process the ENTRY type objects that are returned from the
+ * search. If this pointer is NULL, then all entries that match
+ * the search criteria are returned in the nis_result structure,
+ * otherwise this function will be called once for each
+ * entry returned.
+ * void *userdata: passed to callback function along with the returned
+ * entry object.
+ *
+ * nis_add_entry (table_name, obj, flags) will add the NIS+ object to the
+ * NIS+ table_name.
+ * const nis_name table_name
+ * const nis_object *obj
+ * u_long flags: 0, ADD_OVERWRITE, RETURN_RESULT
+ *
+ * nis_modify_entry (name, obj, flags) modifies an object identified by name.
+ * const nis_name name: object identifier
+ * const nis_object *obj: should point to an entry with the EN_MODIFIED
+ * flag set in each column that contains new
+ * information.
+ * u_long flags: 0, MOD_SAMEOBJ, RETURN_RESULT
+ *
+ * nis_remove_entry (table_name, obj, flags) removes a set of entries
+ * identified by table_name from the table.
+ * const nis_name table_name: indexed NIS+ name
+ * const nis_object *obj: if obj is non-null, it is presumed to point to
+ * a cached copy of the entry. When the removal is
+ * attempted, and the object that would be removed
+ * is not the same as the cached object pointed to
+ * by object then the operation will fail with an
+ * NIS_NOTSAMEOBJ error
+ * u_long flags: 0, REM_MULTIPLE
+ *
+ * nis_first_entry (table_name) fetches entries from a table one at a time.
+ * const nis_name table_name
+ *
+ * nis_next_entry (table_name, cookie) retrieves the "next" entry from a
+ * table specified by table_name.
+ * const nis_name table_name:
+ * const netobj *cookie: The value of cookie from the nis_result structure
+ * form the previous call.
+ */
+extern nis_result *nis_list __P ((const_nis_name name, u_long flags,
+ int (*callback)(const_nis_name table_name,
+ const nis_object *obj,
+ const void *userdata),
+ const void *userdata));
+extern nis_result *nis_add_entry __P ((const_nis_name table_name,
+ const nis_object *obj, u_long flags));
+extern nis_result *nis_modify_entry __P ((const_nis_name name,
+ const nis_object *obj,
+ u_long flags));
+extern nis_result *nis_remove_entry __P ((const_nis_name table_name,
+ const nis_object *obj,
+ u_long flags));
+extern nis_result *nis_first_entry __P ((const_nis_name table_name));
+extern nis_result *nis_next_entry __P ((const_nis_name table_name,
+ const netobj *cookie));
+/*
+** nis_server
+*/
+extern nis_error nis_mkdir __P ((const_nis_name dirname,
+ const nis_server *machine));
+extern nis_error nis_rmdir __P ((const_nis_name dirname,
+ const nis_server *machine));
+extern nis_error nis_servstate __P ((const nis_server *machine,
+ const nis_tag *tags, int numtags,
+ nis_tag **result));
+extern nis_error nis_stats __P ((const nis_server *machine,
+ const nis_tag *tags, int numtags,
+ nis_tag **result));
+extern void nis_freetags __P ((nis_tag *tags, int numtags));
+extern nis_server **nis_getservlist __P ((const_nis_name dirname));
+extern void nis_freeservlist __P ((nis_server **machines));
+
+/*
+** nis_subr
+*/
+extern nis_name nis_leaf_of __P ((const_nis_name name));
+extern nis_name nis_leaf_of_r __P ((const_nis_name name, char *buffer,
+ size_t buflen));
+extern nis_name nis_name_of __P ((const_nis_name name));
+extern nis_name nis_name_of_r __P ((const_nis_name name, char *buffer,
+ size_t buflen));
+extern nis_name nis_domain_of __P ((const_nis_name name));
+extern nis_name nis_domain_of_r __P ((const_nis_name name, char *buffer,
+ size_t buflen));
+extern nis_name *nis_getnames __P ((const_nis_name name));
+extern void nis_freenames __P ((nis_name *namelist));
+extern name_pos nis_dir_cmp __P ((const_nis_name n1, const_nis_name n2));
+extern nis_object *nis_clone_object __P ((const nis_object *src,
+ nis_object *dest));
+extern void nis_destroy_object __P ((nis_object *obj));
+extern void nis_print_object __P ((const nis_object *obj));
+
+/*
+** nis_local_names
+*/
+extern nis_name nis_local_group __P ((void));
+extern nis_name nis_local_directory __P ((void));
+extern nis_name nis_local_principal __P ((void));
+extern nis_name nis_local_host __P ((void));
+
+/*
+** nis_error
+*/
+extern const char *nis_sperrno __P ((const nis_error status));
+extern void nis_perror __P ((const nis_error status, const char *label));
+extern void nis_lerror __P ((const nis_error status, const char *label));
+extern char *nis_sperror __P ((const nis_error status, const char *label));
+extern char *nis_sperror_r __P ((const nis_error status, const char *label,
+ char *buffer, size_t buflen));
+/*
+** nis_groups
+*/
+extern bool_t nis_ismember __P ((const_nis_name principal,
+ const_nis_name group));
+extern nis_error nis_addmember __P ((const_nis_name member,
+ const_nis_name group));
+extern nis_error nis_removemember __P ((const_nis_name member,
+ const_nis_name group));
+extern nis_error nis_creategroup __P ((const_nis_name group, u_long flags));
+extern nis_error nis_destroygroup __P ((const_nis_name group));
+extern void nis_print_group_entry __P ((const_nis_name group));
+extern nis_error nis_verifygroup __P ((const_nis_name group));
+
+/*
+** nis_ping
+*/
+extern void nis_ping __P ((const_nis_name dirname, u_long utime,
+ const nis_object *dirobj));
+extern nis_result *nis_checkpoint __P ((const_nis_name dirname));
+
+/*
+** nis_print (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!)
+*/
+extern void nis_print_result __P ((const nis_result *result));
+extern void nis_print_rights __P ((u_long rights));
+extern void nis_print_directory __P ((const directory_obj *dirobj));
+extern void nis_print_group __P ((const group_obj *grpobj));
+extern void nis_print_table __P ((const table_obj *tblobj));
+extern void nis_print_link __P ((const link_obj *lnkobj));
+extern void nis_print_entry __P ((const entry_obj *enobj));
+
+/*
+** nis_file (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!)
+*/
+extern directory_obj *readColdStartFile __P ((void));
+extern bool_t writeColdStartFile __P ((const directory_obj *dirobj));
+extern nis_object *nis_read_obj __P ((const char *obj));
+extern bool_t nis_write_obj __P ((const char *file, const nis_object *obj));
+
+/*
+** nis_clone - (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!)
+*/
+extern directory_obj *nis_clone_directory __P ((const directory_obj *src,
+ directory_obj *dest));
+extern group_obj *nis_clone_group __P ((const group_obj *src,
+ group_obj *dest));
+extern table_obj *nis_clone_table __P ((const table_obj *src,
+ table_obj *dest));
+extern entry_obj *nis_clone_entry __P ((const entry_obj *src,
+ entry_obj *dest));
+extern link_obj *nis_clone_link __P ((const link_obj *src, link_obj *dest));
+extern objdata *nis_clone_objdata __P ((const objdata *src, objdata *dest));
+extern nis_result *nis_clone_result __P ((const nis_result *src,
+ nis_result *dest));
+
+/* nis_free - nis_freeresult */
+extern void nis_freeresult __P ((nis_result *result));
+/* (XXX THE FOLLOWING ARE INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) */
+extern void nis_free_attr __P ((nis_attr *attr));
+extern void nis_free_request __P ((ib_request *req));
+extern void nis_free_endpoints __P ((endpoint *ep, unsigned int count));
+extern void nis_free_servers __P ((nis_server *machine, unsigned int count));
+extern void nis_free_directory __P ((directory_obj *dirobj));
+extern void nis_free_group __P ((group_obj *grpobj));
+extern void nis_free_table __P ((table_obj *tblobj));
+extern void nis_free_entry __P ((entry_obj *enobj));
+extern void nis_free_link __P ((link_obj *lnkobj));
+extern void nis_free_object __P ((nis_object *obj));
+
+/* (XXX INTERNAL FUNCTIONS, SHOULD NOT BE USED !!) */
+extern nis_name __nis_default_owner __P ((char *));
+extern nis_name __nis_default_group __P ((char *));
+extern u_long __nis_default_ttl __P ((char *));
+extern u_long __nis_default_access __P ((char *, u_long));
+extern fd_result *__nis_finddirectory __P ((directory_obj *, const_nis_name));
+extern u_long __nis_hash __P ((const void *keyarg, register size_t len));
+extern log_result *__nis_dumplog __P ((nis_server *,nis_name, u_long));
+extern log_result *__nis_dump __P ((nis_server *, nis_name,
+ int (*)(nis_name, nis_object *, void *)));
+/* NIS+ cache locking */
+extern int __nis_lock_cache __P ((void));
+extern int __nis_unlock_cache __P ((void));
+
+__END_DECLS
+
+#endif /* __RPCSVC_NISLIB_H__ */
diff --git a/posix/Makefile b/posix/Makefile
index 29d73c3..285f3b3 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -47,7 +47,7 @@ routines := \
getopt getopt1 getopt_init \
sched_setp sched_getp sched_sets sched_gets sched_yield sched_primax \
sched_primin sched_rr_gi \
- getaddrinfo gai_strerror
+ getaddrinfo gai_strerror wordexp
aux := init-posix environ
tests := tstgetopt testfnm runtests
diff --git a/posix/sys/types.h b/posix/sys/types.h
index 1319660..4519610 100644
--- a/posix/sys/types.h
+++ b/posix/sys/types.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 1992, 1994, 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -51,7 +51,7 @@ typedef __uid_t uid_t;
#ifndef ssize_t
typedef __ssize_t ssize_t;
-#define ssize_t ssize_t
+# define ssize_t ssize_t
#endif
#ifdef __USE_BSD
@@ -68,7 +68,6 @@ typedef __key_t key_t;
#define __need_size_t
#include <stddef.h>
-typedef size_t socklen_t;
#ifdef __USE_MISC
/* Old compatibility names for C types. */
@@ -82,41 +81,41 @@ typedef unsigned int uint;
#if !defined (__GNUC__) || __GNUC__ < 2 || __GNUC_MINOR__ < 7
/* These types are defined by the ISO C 9x header <inttypes.h>. */
-#ifndef __int8_t_defined
-#define __int8_t_defined
+# ifndef __int8_t_defined
+# define __int8_t_defined
typedef char int8_t;
typedef short int int16_t;
typedef int int32_t;
-#ifdef __GNUC__
+# ifdef __GNUC__
typedef long long int int64_t;
-#endif
-#endif
+# endif
+# endif
/* But these were defined by ISO C without the first `_'. */
typedef unsigned char u_int8_t;
typedef unsigned short int u_int16_t;
typedef unsigned int u_int32_t;
-#ifdef __GNUC__
+# ifdef __GNUC__
typedef unsigned long long int u_int64_t;
-#endif
+# endif
typedef int register_t;
#else
/* For GCC 2.7 and later, we can use specific type-size attributes. */
-#define __intN_t(N, MODE) \
+# define __intN_t(N, MODE) \
typedef int int##N##_t __attribute__ ((__mode__ (MODE)))
-#define __u_intN_t(N, MODE) \
+# define __u_intN_t(N, MODE) \
typedef unsigned int u_int##N##_t __attribute__ ((__mode__ (MODE)))
-#ifndef __int8_t_defined
-#define __int8_t_defined
+# ifndef __int8_t_defined
+# define __int8_t_defined
__intN_t (8, __QI__);
__intN_t (16, __HI__);
__intN_t (32, __SI__);
__intN_t (64, __DI__);
-#endif
+# endif
__u_intN_t (8, __QI__);
__u_intN_t (16, __HI__);
@@ -128,16 +127,16 @@ typedef int register_t __attribute__ ((__mode__ (__word__)));
/* Some code from BIND tests this macro to see if the types above are
defined. */
-#define __BIT_TYPES_DEFINED__ 1
#endif
+#define __BIT_TYPES_DEFINED__ 1
#ifdef __USE_BSD
/* In BSD <sys/types.h> is expected to define BYTE_ORDER. */
-#include <endian.h>
+# include <endian.h>
/* It also defines `fd_set' and the FD_* macros for `select'. */
-#include <sys/select.h>
+# include <sys/select.h>
#endif /* Use BSD. */
diff --git a/posix/wordexp.c b/posix/wordexp.c
index b204f65..2f6f081 100644
--- a/posix/wordexp.c
+++ b/posix/wordexp.c
@@ -21,6 +21,7 @@
#include <wordexp.h>
#include <signal.h>
#include <stdlib.h>
+#include <stdio.h>
#include <pwd.h>
#include <sys/types.h>
#include <string.h>
@@ -52,7 +53,7 @@ parse_backtick (char **word, size_t *word_length, const char *words,
static int
eval_expr (char *expr, int *result);
-/* The w_*() unctions manipulate word lists. */
+/* The w_*() functions manipulate word lists. */
static char*
w_extend (char *word, size_t *word_length, size_t by)
@@ -206,7 +207,7 @@ parse_tilde (char **word, size_t *word_length, const char *words,
size_t *offset, size_t wordc)
{
/* We are poised _at_ a tilde */
- int i;
+ size_t i;
if (*word_length != 0)
{
@@ -245,7 +246,7 @@ parse_tilde (char **word, size_t *word_length, const char *words,
uid = getuid ();
- while ((result = __getpwuid_r (uid, pwd, buffer, buflen, &tpwd)) != 0
+ while ((result = __getpwuid_r (uid, &pwd, buffer, buflen, &tpwd)) != 0
&& errno == ERANGE)
{
buflen += 1000;
@@ -268,14 +269,13 @@ parse_tilde (char **word, size_t *word_length, const char *words,
else
{
/* Look up user name in database to get home directory */
- uid_t uid;
- char *user = strndup (&words[1 + *offset], i - *offset);
+ char *user = strndupa (&words[1 + *offset], i - *offset);
struct passwd pwd, *tpwd;
int buflen = 1000;
char* buffer = __alloca (buflen);
int result;
- while ((result = __getpwnam_r (uid, pwd, buffer, buflen, &tpwd)) != 0
+ while ((result = __getpwnam_r (user, &pwd, buffer, buflen, &tpwd)) != 0
&& errno == ERANGE)
{
buflen += 1000;
@@ -683,7 +683,7 @@ exec_comm (char *comm, char **word, size_t *word_length, int flags,
int buflen;
int state = 0;
int i;
- char *sh, *buffer;
+ char *buffer;
pid_t pid;
/* 'state' is:
* 0 until first non-(whitespace-ifs)
@@ -1397,7 +1397,7 @@ wordexp (const char *words, wordexp_t *pwordexp, int flags)
while (*ifsch != '\0')
if ((*ifsch == ' ') || (*ifsch == '\t') || (*ifsch == '\n'))
{
- /* White space IFS. Se first whether it is already in our
+ /* White space IFS. See first whether it is already in our
collection. */
char *runp = ifs_white;
diff --git a/socket/sys/socket.h b/socket/sys/socket.h
index aa2309c..9ba7d9a 100644
--- a/socket/sys/socket.h
+++ b/socket/sys/socket.h
@@ -1,5 +1,5 @@
/* Declarations of socket constants, types, and functions.
- Copyright (C) 1991, 92, 94, 95, 96 Free Software Foundation, Inc.
+ Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -49,14 +49,14 @@ struct osockaddr
uses with any of the listed types to be allowed without complaint.
G++ 2.7 does not support transparent unions so there we want the
old-style declaration, too. */
-#if (!defined (__GNUC__) || __GNUC__ < 2 || defined(__cplusplus) || \
+#if (!defined __GNUC__ || __GNUC__ < 2 || defined __cplusplus || \
(__GNUC__ == 2 && __GNUC_MINOR__ < 7))
-#define __SOCKADDR_ARG struct sockaddr *
-#define __CONST_SOCKADDR_ARG __const struct sockaddr *
+# define __SOCKADDR_ARG struct sockaddr *
+# define __CONST_SOCKADDR_ARG __const struct sockaddr *
#else
/* Add more `struct sockaddr_AF' types here as necessary.
These are all the ones I found on NetBSD and Linux. */
-#define __SOCKADDR_ALLTYPES \
+# define __SOCKADDR_ALLTYPES \
__SOCKADDR_ONETYPE (sockaddr) \
__SOCKADDR_ONETYPE (sockaddr_at) \
__SOCKADDR_ONETYPE (sockaddr_ax25) \
@@ -71,14 +71,14 @@ struct osockaddr
__SOCKADDR_ONETYPE (sockaddr_un) \
__SOCKADDR_ONETYPE (sockaddr_x25)
-#define __SOCKADDR_ONETYPE(type) struct type *__##type##__;
+# define __SOCKADDR_ONETYPE(type) struct type *__##type##__;
typedef union { __SOCKADDR_ALLTYPES
} __SOCKADDR_ARG __attribute__ ((__transparent_union__));
-#undef __SOCKADDR_ONETYPE
-#define __SOCKADDR_ONETYPE(type) __const struct type *__##type##__;
+# undef __SOCKADDR_ONETYPE
+# define __SOCKADDR_ONETYPE(type) __const struct type *__##type##__;
typedef union { __SOCKADDR_ALLTYPES
} __CONST_SOCKADDR_ARG __attribute__ ((__transparent_union__));
-#undef __SOCKADDR_ONETYPE
+# undef __SOCKADDR_ONETYPE
#endif
@@ -95,20 +95,20 @@ extern int socketpair __P ((int __domain, int __type, int __protocol,
int __fds[2]));
/* Give the socket FD the local address ADDR (which is LEN bytes long). */
-extern int bind __P ((int __fd, __CONST_SOCKADDR_ARG __addr, size_t __len));
+extern int bind __P ((int __fd, __CONST_SOCKADDR_ARG __addr, socklen_t __len));
/* Put the local address of FD into *ADDR and its length in *LEN. */
extern int getsockname __P ((int __fd, __SOCKADDR_ARG __addr,
- size_t *__len));
+ socklen_t *__len));
/* Open a connection on socket FD to peer at ADDR (which LEN bytes long).
For connectionless socket types, just set the default address to send to
and the only address from which to accept transmissions.
Return 0 on success, -1 for errors. */
extern int __connect __P ((int __fd,
- __CONST_SOCKADDR_ARG __addr, size_t __len));
+ __CONST_SOCKADDR_ARG __addr, socklen_t __len));
extern int connect __P ((int __fd,
- __CONST_SOCKADDR_ARG __addr, size_t __len));
+ __CONST_SOCKADDR_ARG __addr, socklen_t __len));
/* Put the address of the peer connected to socket FD into *ADDR
(which is *LEN bytes long), and its actual length into *LEN. */
@@ -130,14 +130,14 @@ extern int recv __P ((int __fd, __ptr_t __buf, size_t __n, int __flags));
ADDR_LEN bytes long). Returns the number sent, or -1 for errors. */
extern int sendto __P ((int __fd, __const __ptr_t __buf, size_t __n,
int __flags, __CONST_SOCKADDR_ARG __addr,
- size_t __addr_len));
+ socklen_t __addr_len));
/* Read N bytes into BUF through socket FD.
If ADDR is not NULL, fill in *ADDR_LEN bytes of it with tha address of
the sender, and store the actual size of the address in *ADDR_LEN.
Returns the number of bytes read or -1 for errors. */
extern int recvfrom __P ((int __fd, __ptr_t __buf, size_t __n, int __flags,
- __SOCKADDR_ARG __addr, size_t *__addr_len));
+ __SOCKADDR_ARG __addr, socklen_t *__addr_len));
/* Send a message described MESSAGE on socket FD.
@@ -154,13 +154,13 @@ extern int recvmsg __P ((int __fd, struct msghdr *__message, int __flags));
into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's
actual length. Returns 0 on success, -1 for errors. */
extern int getsockopt __P ((int __fd, int __level, int __optname,
- __ptr_t __optval, size_t *__optlen));
+ __ptr_t __optval, socklen_t *__optlen));
/* Set socket FD's option OPTNAME at protocol level LEVEL
to *OPTVAL (which is OPTLEN bytes long).
Returns 0 on success, -1 for errors. */
extern int setsockopt __P ((int __fd, int __level, int __optname,
- __ptr_t __optval, size_t __optlen));
+ __ptr_t __optval, socklen_t __optlen));
/* Prepare to accept connections on socket FD.
@@ -174,7 +174,7 @@ extern int listen __P ((int __fd, unsigned int __n));
peer and *ADDR_LEN to the address's actual length, and return the
new socket's descriptor, or -1 for errors. */
extern int accept __P ((int __fd, __SOCKADDR_ARG __addr,
- size_t *__addr_len));
+ socklen_t *__addr_len));
/* Shut down all or part of the connection open on socket FD.
HOW determines what to shut down:
diff --git a/stdio-common/printf_fp.c b/stdio-common/printf_fp.c
index 9240355..85286be 100644
--- a/stdio-common/printf_fp.c
+++ b/stdio-common/printf_fp.c
@@ -812,13 +812,24 @@ __printf_fp (FILE *fp,
{
char *tp = cp;
- if (digit == '5')
+ if (digit == '5' && (*(cp - 1) & 1) == 0)
/* This is the critical case. */
if (fracsize == 1 && frac[0] == 0)
/* Rest of the number is zero -> round to even.
(IEEE 754-1985 4.1 says this is the default rounding.) */
- if ((*(cp - 1) & 1) == 0)
- goto do_expo;
+ goto do_expo;
+ else if (scalesize == 0)
+ {
+ /* Here we have to see whether all limbs are zero since no
+ normalization happened. */
+ size_t lcnt = fracsize;
+ while (lcnt >= 1 && frac[lcnt - 1] == 0)
+ --lcnt;
+ if (lcnt == 0)
+ /* Rest of the number is zero -> round to even.
+ (IEEE 754-1985 4.1 says this is the default rounding.) */
+ goto do_expo;
+ }
if (fracdig_no > 0)
{
diff --git a/stdio-common/tfformat.c b/stdio-common/tfformat.c
index cc9a384..f00d0de 100644
--- a/stdio-common/tfformat.c
+++ b/stdio-common/tfformat.c
@@ -14,7 +14,7 @@ sprint_double_type sprint_doubles[] =
{
{__LINE__, 30.3, "< +30.3>", "<%+15.10g>"},
{__LINE__, 10.0, "<10.00>", "<%5.2f>"},
-
+
{__LINE__, 1.002121970718271e+05, "100212.19707 ", "%0-15.5f"},
{__LINE__, -1.002121970718271e+05, "-100212.19707 ", "%0-15.5f"},
{__LINE__, 1.002121970718271e+05, "000100212.19707", "%015.5f"},
@@ -25,7 +25,7 @@ sprint_double_type sprint_doubles[] =
{__LINE__, -1.002121970718271e+05, "-00100212.19707", "% 015.5f"},
{__LINE__, 1.002121970718271e+05, "+100212.19707 ", "%+-15.5f"},
{__LINE__, -1.002121970718271e+05, "-100212.19707 ", "%+-15.5f"},
-
+
{__LINE__, -1.002121970718271e+29, "-1.0E+29", "%.1E"},
{__LINE__, -1.002126048612756e-02, "-1.002126E-02", "%+#E"},
{__LINE__, -1.002653755271637e+00, "-1.00265", "%G"},
@@ -4005,7 +4005,11 @@ sprint_double_type sprint_doubles[] =
#endif
{__LINE__, 9.978034352999867e+15, "9.978034e+15", "%2.6e"},
{__LINE__, 9.998315286730175e-30, "9.998315e-30", "%6e"},
-
+ {__LINE__, 1.25, "1.2", "%.1f"},
+ {__LINE__, 11.25, "11.2", "%.1f"},
+ {__LINE__, 1.75, "1.8", "%.1f"},
+ {__LINE__, 11.75, "11.8", "%.1f"},
+
{0 }
};
diff --git a/stdlib/strtod.c b/stdlib/strtod.c
index 1c13af7..0618b30 100644
--- a/stdlib/strtod.c
+++ b/stdlib/strtod.c
@@ -509,7 +509,7 @@ INTERNAL (STRTOF) (nptr, endptr, group LOCALE_PARAM)
&& ((STRNCASECMP (cp, L_("inf"), 3) == 0 && (matched = 3))
|| (STRNCASECMP (cp, L_("infinity"), 8) == 0 && (matched = 8))))
{
- /* Return +/- inifity. */
+ /* Return +/- infinity. */
if (endptr != NULL)
*endptr = (STRING_TYPE *) (cp + matched);
diff --git a/string/Makefile b/string/Makefile
index 3b895dc..ac04557 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -22,7 +22,7 @@
subdir := string
headers := string.h strings.h memory.h endian.h bits/endian.h \
- argz.h envz.h byteswap.h bits/byteswap.h
+ argz.h envz.h byteswap.h bits/byteswap.h bits/string.h
routines := strcat strchr strcmp strcoll strcpy strcspn \
strverscmp strdup strndup \
@@ -48,9 +48,9 @@ distribute := memcopy.h pagecopy.h tst-svc.expect
include ../Rules
tester-ENV = LANGUAGE=C
-CFLAGS-tester.c = -fno-builtin
-CFLAGS-tst-strlen.c = -fno-builtin
-CFLAGS-stratcliff.c = -fno-builtin
+CFLAGS-tester.c = -fno-builtin -D__NO_STRING_INLINES
+CFLAGS-tst-strlen.c = -fno-builtin -D__NO_STRING_INLINES
+CFLAGS-stratcliff.c = -fno-builtin -D__NO_STRING_INLINES
tests: $(objpfx)tst-svc.out
cmp tst-svc.expect $(objpfx)tst-svc.out
diff --git a/string/string.h b/string/string.h
index 5621dfb..a434c3a 100644
--- a/string/string.h
+++ b/string/string.h
@@ -282,6 +282,13 @@ extern __ptr_t memfrob __P ((__ptr_t __s, size_t __n));
extern char *basename __P ((__const char *__filename));
#endif
+
+/* Some functions might be implemented as optimized inline assembler
+ functions. */
+#if !defined __NO_STRING_INLINES && defined __OPTIMIZE__
+# include <bits/string.h>
+#endif
+
__END_DECLS
#endif /* string.h */
diff --git a/sysdeps/generic/bits/socket.h b/sysdeps/generic/bits/socket.h
index d12d96c..af42dfa 100644
--- a/sysdeps/generic/bits/socket.h
+++ b/sysdeps/generic/bits/socket.h
@@ -24,11 +24,14 @@
#include <features.h>
-__BEGIN_DECLS
-
#define __need_size_t
#include <stddef.h>
+__BEGIN_DECLS
+
+/* Type for length arguments in socket calls. */
+typedef unsigned int socklen_t;
+
/* Types of sockets. */
enum __socket_type
@@ -145,13 +148,15 @@ enum
struct msghdr
{
__ptr_t msg_name; /* Address to send to/receive from. */
- size_t msg_namelen; /* Length of address data. */
+ socklen_t msg_namelen; /* Length of address data. */
struct iovec *msg_iov; /* Vector of data to send/receive into. */
- size_t msg_iovlen; /* Number of elements in the vector. */
+ int msg_iovlen; /* Number of elements in the vector. */
__ptr_t msg_accrights; /* Access rights information. */
- size_t msg_accrightslen; /* Length of access rights information. */
+ socklen_t msg_accrightslen; /* Length of access rights information. */
+
+ int msg_flags; /* Flags in received message. */
};
diff --git a/sysdeps/gnu/errlist.c b/sysdeps/gnu/errlist.c
index 3333f1d..7c0e78a 100644
--- a/sysdeps/gnu/errlist.c
+++ b/sysdeps/gnu/errlist.c
@@ -249,7 +249,7 @@ TRANS until some external condition makes it possible to read, write, or
TRANS connect (whatever the operation). You can use @code{select} to find out
TRANS when the operation will be possible; @pxref{Waiting for I/O}.
TRANS
-TRANS @strong{Portability Note:} In older many Unix systems, this condition
+TRANS @strong{Portability Note:} In many older Unix systems, this condition
TRANS was indicated by @code{EWOULDBLOCK}, which was a distinct error code
TRANS different from @code{EAGAIN}. To make your program portable, you should
TRANS check for both codes and treat them the same.
diff --git a/sysdeps/m68k/__longjmp.c b/sysdeps/m68k/__longjmp.c
index c3e400c..e6ec43c 100644
--- a/sysdeps/m68k/__longjmp.c
+++ b/sysdeps/m68k/__longjmp.c
@@ -50,6 +50,6 @@ __longjmp (__jmp_buf env, int val)
because this code always jumps out anyway. */
);
- /* This call avoids `volatile function does return' warnings. */
- abort ();
+ /* Avoid `volatile function does return' warnings. */
+ for (;;);
}
diff --git a/sysdeps/powerpc/bits/fenv.h b/sysdeps/powerpc/bits/fenv.h
index 9158a54..08d998e 100644
--- a/sysdeps/powerpc/bits/fenv.h
+++ b/sysdeps/powerpc/bits/fenv.h
@@ -119,10 +119,10 @@ typedef double fenv_t;
/* If the default argument is used we use this value. */
extern const fenv_t __fe_dfl_env;
-#define FE_DFL_ENV (&__fe_dfl_env);
+#define FE_DFL_ENV (&__fe_dfl_env)
#ifdef __USE_GNU
/* Floating-point environment where none of the exceptions are masked. */
extern const fenv_t __fe_nomask_env;
-# define FE_NOMASK_ENV (&__fe_nomask_env);
+# define FE_NOMASK_ENV (&__fe_nomask_env)
#endif
diff --git a/sysdeps/stub/bits/string.h b/sysdeps/stub/bits/string.h
new file mode 100644
index 0000000..bd1b774
--- /dev/null
+++ b/sysdeps/stub/bits/string.h
@@ -0,0 +1,12 @@
+/* This file should provide inline versions of math functions.
+
+ Surround GCC-specific parts with #ifdef __GNUC__, and use `extern __inline'.
+
+ This file should define __STRING_INLINES if functions are actually defined
+ as inlines. */
+
+#ifndef _BITS_STRING_H
+#define _BITS_STRING_H 1
+
+
+#endif /* bits/string.h */
diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h
index a17c37f..fd13e12 100644
--- a/sysdeps/unix/sysv/linux/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/bits/socket.h
@@ -32,6 +32,9 @@
__BEGIN_DECLS
+/* Type for length arguments in socket calls. */
+typedef unsigned int socklen_t;
+
/* Types of sockets. */
enum __socket_type
{
@@ -130,14 +133,14 @@ enum
struct msghdr
{
__ptr_t msg_name; /* Address to send to/receive from. */
- int msg_namelen; /* Length of address data. */
- /* XXX Should be type `socklen_t' according to POSIX.1g. */
+ socklen_t msg_namelen; /* Length of address data. */
struct iovec *msg_iov; /* Vector of data to send/receive into. */
size_t msg_iovlen; /* Number of elements in the vector. */
__ptr_t msg_control; /* Ancillary data (eg BSD filedesc passing). */
socklen_t msg_controllen; /* Ancillary data buffer length. */
+
int msg_flags; /* Flags on received message. */
};
diff --git a/sysdeps/unix/sysv/linux/if_index.c b/sysdeps/unix/sysv/linux/if_index.c
index 41bd053..c8eefa9 100644
--- a/sysdeps/unix/sysv/linux/if_index.c
+++ b/sysdeps/unix/sysv/linux/if_index.c
@@ -66,20 +66,27 @@ opensock (void)
unsigned int
if_nametoindex (const char *ifname)
{
+#ifndef SIOGIFINDEX
+ __set_errno (ENOSYS);
+#else
struct ifreq ifr;
+ int rc;
int fd = opensock ();
if (fd < 0)
return 0;
strncpy (ifr.ifr_name, ifname, sizeof (ifr.ifr_name));
- if (ioctl (fd, SIOGIFINDEX, &ifr) < 0)
+ rc = ioctl (fd, SIOGIFINDEX, &ifr);
+ if (rc < 0)
{
close (fd);
+ __set_errno (rc == -EINVAL ? ENOSYS : -rc);
return 0;
}
close (fd);
return ifr.ifr_ifindex;
+#endif
}
void
@@ -98,6 +105,11 @@ if_freenameindex (struct if_nameindex *ifn)
struct if_nameindex *
if_nameindex (void)
{
+#ifndef SIOGIFINDEX
+ __set_errno (ENOSYS);
+ return NULL;
+#else
+ int rc;
int fd = opensock ();
struct ifconf ifc;
unsigned int rq_ifs = 4, nifs, i;
@@ -141,10 +153,12 @@ if_nameindex (void)
goto jump;
}
strcpy (idx[i].if_name, ifr->ifr_name);
- if (ioctl (fd, SIOGIFINDEX, ifr) < 0)
+ rc = ioctl (fd, SIOGIFINDEX, ifr);
+ if (rc < 0)
{
free (idx);
idx = NULL;
+ __set_errno (rc == -EINVAL ? ENOSYS : -rc);
goto jump;
}
idx[i].if_index = ifr->ifr_ifindex;
@@ -156,22 +170,33 @@ jump:
free (ifc.ifc_buf);
close (fd);
return idx;
+#endif
}
char *
if_indextoname (unsigned int ifindex, char *ifname)
{
+#ifndef SIOGIFINDEX
+ __set_errno (ENOSYS);
+ return NULL;
+#else
struct if_nameindex *idx = if_nameindex ();
struct if_nameindex *p;
+ char *result;
- for (p = idx; p->if_index || p->if_name; ++p)
- if (p->if_index == ifindex)
- {
- strncpy (ifname, p->if_name, IFNAMSIZ);
- if_freenameindex (idx);
- return ifname;
- }
-
- if_freenameindex (idx);
- return NULL;
+ if (idx == NULL)
+ result = NULL;
+ else
+ {
+ for (p = idx; p->if_index || p->if_name; ++p)
+ if (p->if_index == ifindex)
+ {
+ result = strncpy (ifname, p->if_name, IFNAMSIZ);
+ break;
+ }
+
+ if_freenameindex (idx);
+ }
+ return result;
+#endif
}
diff --git a/sysdeps/unix/sysv/linux/mips/bits/socket.h b/sysdeps/unix/sysv/linux/mips/bits/socket.h
index 15f420f..02f1d22 100644
--- a/sysdeps/unix/sysv/linux/mips/bits/socket.h
+++ b/sysdeps/unix/sysv/linux/mips/bits/socket.h
@@ -28,9 +28,11 @@
#define __need_NULL
#include <stddef.h>
-
__BEGIN_DECLS
+/* Type for length arguments in socket calls. */
+typedef unsigned int socklen_t;
+
/* Supported address families. */
#define PF_UNSPEC 0
#define PF_UNIX 1 /* Unix domain sockets */
@@ -103,25 +105,22 @@ enum
struct msghdr
{
__ptr_t msg_name; /* Address to send to/receive from. */
- int msg_namelen; /* Length of address data. */
- /* XXX Should be type `size_t' according to POSIX.1g. */
+ socklen_t msg_namelen; /* Length of address data. */
struct iovec *msg_iov; /* Vector of data to send/receive into. */
int msg_iovlen; /* Number of elements in the vector. */
- /* XXX Should be type `size_t' according to POSIX.1g. */
__ptr_t msg_control; /* Ancillary data (eg BSD filedesc passing). */
- int msg_controllen; /* Ancillary data buffer length. */
- /* XXX Should be type `size_t' according to POSIX.1g. */
+ socklen_t msg_controllen; /* Ancillary data buffer length. */
+
int msg_flags; /* Flags on received message. */
};
/* Structure used for storage of ancillary data object information. */
struct cmsghdr
{
- int cmsg_len; /* Length of data in cmsg_data plus length
+ socklen_t cmsg_len; /* Length of data in cmsg_data plus length
of cmsghdr structure. */
- /* XXX Should be type `size_t' according to POSIX.1g. */
int cmsg_level; /* Originating protocol. */
int cmsg_type; /* Protocol specific type. */
#if !defined __STRICT_ANSI__ && defined __GNUC__ && __GNUC__ >= 2
diff --git a/sysdeps/wordsize-32/inttypes.h b/sysdeps/wordsize-32/inttypes.h
index 42434b1..a5ff12e 100644
--- a/sysdeps/wordsize-32/inttypes.h
+++ b/sysdeps/wordsize-32/inttypes.h
@@ -31,7 +31,7 @@
/* There is some amount of overlap with <sys/types.h> as known by inet code */
#ifndef __int8_t_defined
-#define __int8_t_defined
+# define __int8_t_defined
typedef signed char int8_t;
typedef short int int16_t;
typedef int int32_t;
diff --git a/sysdeps/wordsize-64/inttypes.h b/sysdeps/wordsize-64/inttypes.h
index cc420e8..f1dd2ff 100644
--- a/sysdeps/wordsize-64/inttypes.h
+++ b/sysdeps/wordsize-64/inttypes.h
@@ -31,7 +31,7 @@
/* There is some amount of overlap with <sys/types.h> as known by inet code */
#ifndef __int8_t_defined
-#define __int8_t_defined
+# define __int8_t_defined
typedef signed char int8_t;
typedef short int int16_t;
typedef int int32_t;
diff --git a/termios/cfsetspeed.c b/termios/cfsetspeed.c
index da31073..b3c8aa3 100644
--- a/termios/cfsetspeed.c
+++ b/termios/cfsetspeed.c
@@ -107,13 +107,19 @@ cfsetspeed (struct termios *termios_p, speed_t speed)
{
size_t cnt;
- for (cnt = 0; cnt < sizeof (speeds); ++cnt)
- if (speed == speeds[cnt].value)
+ for (cnt = 0; cnt < sizeof (speeds) / sizeof (speeds[0]); ++cnt)
+ if (speed == speeds[cnt].internal)
{
cfsetispeed (termios_p, speed);
cfsetospeed (termios_p, speed);
return;
}
+ else if (speed == speeds[cnt].value)
+ {
+ cfsetispeed (termios_p, speeds[cnt].internal);
+ cfsetospeed (termios_p, speeds[cnt].internal);
+ return;
+ }
__set_errno (EINVAL);
}
diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile
index e39ba61..985f595 100644
--- a/wcsmbs/Makefile
+++ b/wcsmbs/Makefile
@@ -38,6 +38,8 @@ routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
wcscoll_l wcsxfrm_l \
wcscasecmp wcsncase wcscasecmp_l wcsncase_l
+tests := tst-wcstof
+
include ../Rules
CFLAGS-wcwidth.c = -I../wctype
diff --git a/wcsmbs/tst-wcstof.c b/wcsmbs/tst-wcstof.c
new file mode 100644
index 0000000..197cb5c
--- /dev/null
+++ b/wcsmbs/tst-wcstof.c
@@ -0,0 +1,23 @@
+#define _GNU_SOURCE 1
+#include <wchar.h>
+#include <stdio.h>
+#include <string.h>
+#include <wctype.h>
+
+int
+main (void)
+{
+ int result = 0;
+ char buf[100];
+ wchar_t tmp[3];
+ tmp[0] = '8';
+ tmp[1] = '1';
+ tmp[2] = 0;
+
+ snprintf (buf, 100, "%S = %f", tmp, wcstof (tmp, NULL));
+ printf ("\"%s\" -> %s\n", buf,
+ strcmp (buf, "81 = 81.000000") == 0 ? "okay" : "buggy");
+ result |= strcmp (buf, "81 = 81.000000") != 0;
+
+ return result;
+}