summary refs log tree commit diff
path: root/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1996-12-30 01:47:46 +0000
committerUlrich Drepper <drepper@redhat.com>1996-12-30 01:47:46 +0000
commitd38cd08ca397c59fc98dba8c4d0b4bd96c899c9e (patch)
tree46ffb93f070ec805f4288ef6cdb379ba0e6ae621 /posix
parent01c901a56b165e57a17db349cc110f84f1b839c7 (diff)
downloadglibc-d38cd08ca397c59fc98dba8c4d0b4bd96c899c9e.tar.gz
glibc-d38cd08ca397c59fc98dba8c4d0b4bd96c899c9e.tar.xz
glibc-d38cd08ca397c59fc98dba8c4d0b4bd96c899c9e.zip
update from main archive 961229 cvs/libc20x-970306 cvs/libc-961231 cvs/libc-961230
Mon Dec 30 01:32:59 1996  Ulrich Drepper  <drepper@cygnus.com>

	* tme/localtime.c: Rewrite so that localtime_r does not call tzset,
	but localtime does.

	* features.h: Rename ANSI C to ISO C.
	Mention __GLIBC__ and __GLIBC_MINOR__ macros.

	* gnu-versions.h: Add _GNU_GETOPT_INTERFACE_VERSION.
	* posix/getopt.c: Use _GNU_GETOPT_INTERFACE_VERSION to check
	whether we can elide the code.
	* posix/getopt1.c: Likewise.
	* posix/Makefile: Correct copyright.

	* elf/dl-error.c (_dl_catch_error): Clear `catch' also when error
	occurred.
	* elf/dl-support.c (_dl_sysdep_open_zero_fill): Don't define if
	MAP_ANON is defined.
	* elf/eval.c: Use __getline instead of getline.
	* elf/rtld.c (dl_main): Check return value of _dl_new_object
	function for NULL.
	* sysdeps/generic/dl-cache.c: Update copyright.

	* signal/Makefile: Correct copyright.
	(routines): Remove gsignal and ssignal.  Add bsd_signal.
	* signal/gsignal.c: Removed.  Now is made an alias.
	* signal/ssignal.c: Likewise.
	* sysdeps/posix/raise.c: Add alias gsignal.
	* sysdeps/stub/raise.c: Likewise.
	* sysdeps/posix/signal.c: Add alias ssignal.
	* sysdeps/stub/signal.c: Likewise.
	* signal/signal.h: Declare bsd_signal.  Define signal as bsd_signal
	if __FAVOR_BSD.
	* sysdeps/posix/bsd_signal.c: New file.  Implementation of XPG
	function.

	* sysdeps/unix/sysv/linux/signal.c: Add explanation.

	* socket/sys/un.h: Define SUN_LEN according to POSIX.1g.

	* stdio-common/Makefile (tests): Add scanf10.
	* stdio-common/scanf10.c: New file.
	* stdio-common/vfscanf.c: Decrement counter if EOF is read while
	reading string.

	* sysdeps/libm-i387/e_acos.S: Use END, not PSEUDO_END.
	* sysdeps/libm-i387/e_acosl.S: Likewise.
	* sysdeps/libm-i387/e_asin.S: Likewise.
	* sysdeps/libm-i387/e_asinl.S: Likewise.
	* sysdeps/libm-i387/e_atan2.S: Likewise.
	* sysdeps/libm-i387/e_atan2f.S: Likewise.
	* sysdeps/libm-i387/e_atan2l.S: Likewise.
	* sysdeps/libm-i387/e_exp.S: Likewise.
	* sysdeps/libm-i387/e_expl.S: Likewise.
	* sysdeps/libm-i387/e_fmod.S: Likewise.
	* sysdeps/libm-i387/e_fmodl.S: Likewise.
	* sysdeps/libm-i387/e_log.S: Likewise.
	* sysdeps/libm-i387/e_log10.S: Likewise.
	* sysdeps/libm-i387/e_log10l.S: Likewise.
	* sysdeps/libm-i387/e_logl.S: Likewise.
	* sysdeps/libm-i387/e_remainder.S: Likewise.
	* sysdeps/libm-i387/e_remainderf.S: Likewise.
	* sysdeps/libm-i387/e_remainderl.S: Likewise.
	* sysdeps/libm-i387/e_scalb.S: Likewise.
	* sysdeps/libm-i387/e_scalbl.S: Likewise.
	* sysdeps/libm-i387/e_sqrt.S: Likewise.
	* sysdeps/libm-i387/e_sqrtf.S: Likewise.
	* sysdeps/libm-i387/e_sqrtl.S: Likewise.
	* sysdeps/libm-i387/s_atan.S: Likewise.
	* sysdeps/libm-i387/s_atanf.S: Likewise.
	* sysdeps/libm-i387/s_atanl.S: Likewise.
	* sysdeps/libm-i387/s_ceil.S: Likewise.
	* sysdeps/libm-i387/s_ceilf.S: Likewise.
	* sysdeps/libm-i387/s_ceill.S: Likewise.
	* sysdeps/libm-i387/s_copysign.S: Likewise.
	* sysdeps/libm-i387/s_copysignf.S: Likewise.
	* sysdeps/libm-i387/s_copysignl.S: Likewise.
	* sysdeps/libm-i387/s_cos.S: Likewise.
	* sysdeps/libm-i387/s_cosf.S: Likewise.
	* sysdeps/libm-i387/s_cosl.S: Likewise.
	* sysdeps/libm-i387/s_finite.S: Likewise.
	* sysdeps/libm-i387/s_finitef.S: Likewise.
	* sysdeps/libm-i387/s_finitel.S: Likewise.
	* sysdeps/libm-i387/s_floor.S: Likewise.
	* sysdeps/libm-i387/s_floorf.S: Likewise.
	* sysdeps/libm-i387/s_floorl.S: Likewise.
	* sysdeps/libm-i387/s_ilogb.S: Likewise.
	* sysdeps/libm-i387/s_ilogbf.S: Likewise.
	* sysdeps/libm-i387/s_ilogbl.S: Likewise.
	* sysdeps/libm-i387/s_log1p.S: Likewise.
	* sysdeps/libm-i387/s_log1pf.S: Likewise.
	* sysdeps/libm-i387/s_log1pl.S: Likewise.
	* sysdeps/libm-i387/s_logb.S: Likewise.
	* sysdeps/libm-i387/s_logbf.S: Likewise.
	* sysdeps/libm-i387/s_logbl.S: Likewise.
	* sysdeps/libm-i387/s_rint.S: Likewise.
	* sysdeps/libm-i387/s_rintf.S: Likewise.
	* sysdeps/libm-i387/s_rintl.S: Likewise.
	* sysdeps/libm-i387/s_scalbn.S: Likewise.
	* sysdeps/libm-i387/s_scalbnf.S: Likewise.
	* sysdeps/libm-i387/s_scalbnl.S: Likewise.
	* sysdeps/libm-i387/s_significand.S: Likewise.
	* sysdeps/libm-i387/s_significandf.S: Likewise.
	* sysdeps/libm-i387/s_significandl.S: Likewise.
	* sysdeps/libm-i387/s_sin.S: Likewise.
	* sysdeps/libm-i387/s_sinf.S: Likewise.
	* sysdeps/libm-i387/s_sinl.S: Likewise.

	* sysdeps/libm-i387/e_log.S: Use fyl2xp1 instruction for values
	near 1 to increase precision.
	* sysdeps/libm-i387/e_log10.S: Likewise.
	* sysdeps/libm-i387/e_log10l.S: Likewise.
	* sysdeps/libm-i387/e_logl.S: Likewise.

	* sysdeps/libm-i387/s_cos.S: Use testl instead of andw.
	* sysdeps/libm-i387/s_cosl.S: Likewise.
	* sysdeps/libm-i387/s_sin.S: Likewise.
	* sysdeps/libm-i387/s_sinl.S: Likewise.
	* sysdeps/libm-i387/s_tan.S: Likewise.
	* sysdeps/libm-i387/s_tanl.S: Likewise.

	* sysdeps/libm-i387/e_acosf.S: New file.  Add float versions.
	* sysdeps/libm-i387/e_asinf.S: Likewise.
	* sysdeps/libm-i387/e_expf.S: Likewise.
	* sysdeps/libm-i387/e_fmodf.S: Likewise.
	* sysdeps/libm-i387/e_log10f.S: Likewise.
	* sysdeps/libm-i387/e_logf.S: Likewise.
	* sysdeps/libm-i387/e_scalbf.S: Likewise.

	* sysdeps/libm-i387/e_acosh.S: New file.  Highly optimized versions.
	* sysdeps/libm-i387/e_acoshf.S: Likewise.
	* sysdeps/libm-i387/e_acoshl.S: Likewise.
	* sysdeps/libm-i387/e_atanh.S: Likewise.
	* sysdeps/libm-i387/e_atanhf.S: Likewise.
	* sysdeps/libm-i387/e_atanhl.S: Likewise.
	* sysdeps/libm-i387/e_asinh.S: Likewise.
	* sysdeps/libm-i387/e_asinhf.S: Likewise.
	* sysdeps/libm-i387/e_asinhl.S: Likewise.

	* sysdeps/libm-ieee754/s_asinhf.c: Tweak a bit.  Use lower levels
	for simplified handling.

	* sysdeps/unix/sysv/linux/syscalls.list: Add query_module.

Sun Dec 22 01:39:29 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* inet/rcmd.c (rcmd): Set h_errno before calling herror.
	* inet/rexec.c (rexec): Likewise.

Sat Dec 21 21:47:08 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/unix/sysv/linux/m68k/setjmp.c (__setjmp): Make it really
	compatible.

Sun Dec 22 03:23:33 1996  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/libm-i387/s_log1p.S: Use fyl2xp1 for numbers in range
	-0.29 <= x <= 0.29, otherwise the old method.
	* sysdeps/libm-i387/s_log1pf.S: Likewise.
	* sysdeps/libm-i387/s_log1pl.S: Likewise.
Diffstat (limited to 'posix')
-rw-r--r--posix/Makefile6
-rw-r--r--posix/getopt.c37
-rw-r--r--posix/getopt1.c44
3 files changed, 59 insertions, 28 deletions
diff --git a/posix/Makefile b/posix/Makefile
index fcf7cbae9e..1a2f6ae798 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -12,9 +12,9 @@
 # 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., 675 Mass Ave,
-# Cambridge, MA 02139, USA.
+# 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.
 
 #
 #	Sub-makefile for POSIX portion of the library.
diff --git a/posix/getopt.c b/posix/getopt.c
index 01adee0fe5..a5fb9921a7 100644
--- a/posix/getopt.c
+++ b/posix/getopt.c
@@ -52,7 +52,15 @@
    program understand `configure --with-gnu-libc' and omit the object files,
    it is simpler to just do this in the source for each such file.  */
 
-#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
+#define GETOPT_INTERFACE_VERSION 1
+#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2
+#include <gnu-versions.h>
+#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
+#define ELIDE_CODE
+#endif
+#endif
+
+#ifndef ELIDE_CODE
 
 
 /* This needs to come after some library #include
@@ -124,8 +132,14 @@ char *optarg = NULL;
    Otherwise, `optind' communicates from one call to the next
    how much of ARGV has been scanned so far.  */
 
-/* XXX 1003.2 says this must be 1 before any call.  */
-int optind = 0;
+/* 1003.2 says this must be 1 before any call.  */
+int optind = 1;
+
+/* Formerly, initialization of getopt depended on optind==0, which
+   causes problems with re-calling getopt as programs generally don't
+   know that. */
+
+int __getopt_initialized = 0;
 
 /* The next char to be scanned in the option-element
    in which the last option character we returned was found.
@@ -431,10 +445,11 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
 {
   optarg = NULL;
 
-  if (optind == 0)
+  if (!__getopt_initialized)
     {
       optstring = _getopt_initialize (optstring);
       optind = 1;		/* Don't scan ARGV[0], the program name.  */
+      __getopt_initialized = 1;
     }
 
   /* Test whether ARGV[optind] points to a non-option argument.
@@ -500,6 +515,11 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
 	     that we previously skipped, so the caller will digest them.  */
 	  if (first_nonopt != last_nonopt)
 	    optind = first_nonopt;
+
+	  /* Before we can be provide the next result we must be
+	     reinitialized.  */
+	  __getopt_initialized = 0;
+
 	  return EOF;
 	}
 
@@ -509,7 +529,12 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
       if (NONOPTION_P)
 	{
 	  if (ordering == REQUIRE_ORDER)
-	    return EOF;
+	    {
+	      /* Before we can be provide the next result we must be
+		 reinitialized.  */
+	      __getopt_initialized = 0;
+	      return EOF;
+	    }
 	  optarg = argv[optind++];
 	  return 1;
 	}
@@ -880,7 +905,7 @@ getopt (argc, argv, optstring)
 			   0);
 }
 
-#endif	/* _LIBC or not __GNU_LIBRARY__.  */
+#endif	/* Not ELIDE_CODE.  */
 
 #ifdef TEST
 
diff --git a/posix/getopt1.c b/posix/getopt1.c
index de8e2ad567..358935db69 100644
--- a/posix/getopt1.c
+++ b/posix/getopt1.c
@@ -1,24 +1,24 @@
 /* getopt_long and getopt_long_only entry points for GNU getopt.
-   Copyright (C) 1987, 88, 89, 90, 91, 92, 1993, 1994
+   Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 1996
 	Free Software Foundation, Inc.
 
-This file is part of the GNU C Library.  Its master source is NOT part of
-the C library, however.  The master source lives in /gd/gnu/lib.
+   This file is part of the GNU C Library.  Its master source is NOT part of
+   the C library, however.  The master source lives in /gd/gnu/lib.
 
-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 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.
+   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., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+   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.  */
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
@@ -44,15 +44,21 @@ Cambridge, MA 02139, USA.  */
    program understand `configure --with-gnu-libc' and omit the object files,
    it is simpler to just do this in the source for each such file.  */
 
-#if defined (_LIBC) || !defined (__GNU_LIBRARY__)
+#define GETOPT_INTERFACE_VERSION 1
+#if !defined (_LIBC) && defined (__GLIBC__) && __GLIBC__ >= 2
+#include <gnu-versions.h>
+#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
+#define ELIDE_CODE
+#endif
+#endif
+
+#ifndef ELIDE_CODE
 
 
 /* This needs to come after some library #include
    to get __GNU_LIBRARY__ defined.  */
 #ifdef __GNU_LIBRARY__
 #include <stdlib.h>
-#else
-char *getenv ();
 #endif
 
 #ifndef	NULL
@@ -87,7 +93,7 @@ getopt_long_only (argc, argv, options, long_options, opt_index)
 }
 
 
-#endif	/* _LIBC or not __GNU_LIBRARY__.  */
+#endif	/* Not ELIDE_CODE.  */
 
 #ifdef TEST