]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
update from main archive 970225 cvs/libc-970225
authorUlrich Drepper <drepper@redhat.com>
Tue, 25 Feb 1997 05:18:05 +0000 (05:18 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 25 Feb 1997 05:18:05 +0000 (05:18 +0000)
1997-02-24 23:05  Wolfram Gloger  <wmglo@dent.med.uni-muenchen.de>

* malloc/malloc.c (malloc_get_state): New function.
Saves global malloc state to an opaque data structure which
is dynamically allocated in the heap.
* malloc/malloc.c (malloc_set_state): New function.
Restore previously obtained state.
* malloc/malloc.h: Add declaration of malloc_get_state()
and malloc_set_state().

1997-02-24 23:27  Ulrich Drepper  <drepper@cygnus.com>

* sysdeps/libm-ieee754/s_cbrtl.c: Shift B1_EXP value to right
position.

1997-02-24 17:38  Ulrich Drepper  <drepper@cygnus.com>

* misc/error.c: Make error and error_at_line weak aliases of
__error and __error_at_line respectively.
Suggested by David Mosberger-Tang <davidm@AZStarNet.COM>.

* sysdeps/unix/sysv/linux/i386/socket.S: Update copyright.

1997-02-22 11:30  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

* elf/ldd.bash.in: Run the program directly, not as argument
to the dynamic linker, if it contains an interpreter segment.
* elf/ldd.sh.in: Likewise.

* elf/rtld.c (dl_main): In verify mode check whether the dynamic
object contains an interpreter segment and exit with 2 if not.

1997-02-23 01:23  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

* Makefile (distribute): Remove nsswitch.h, netgroup.h, mcheck.h
and xlocale.h.  Make-dist adds them automagically.

1997-02-22 12:25  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

* locale/C-time.c (_nl_C_LC_TIME): Add missing entry for
time-era-num-entries.

1997-02-06 13:49  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

* rellns-sh: No need to check for existance of first parameter.

1997-02-24 15:20  Jonathan T. Agnew  <jtagnew@amherst.edu>

* glibcbug.in: Don't mention destination on MAIL_AGENT command line
to avoid duplicate mail.

1997-02-24 03:51  Ulrich Drepper  <drepper@cygnus.com>

* Makefile (distribute): Add isomac.c.
(tests): Run isomac test.

* features.h (__USE_ISOC9X): New macro.

* catgets/catgets.c: Don't use global variable `optind'.  Instead
use result computed by argp_parse.
* db/makedb: Likewise.
* locale/programs/locale.c: Likewise.
* locale/programs/localedef.c: Likewise.

* libio/stdio.h: Rewrite.  Make it more readable and add comments.

* libio/clearerr.c: Remove clearerr_locked alias.
* libio/feof.c: Remove feof_locked alias.
* libio/ferror.c: Remove feof_locked alias.
* libio/fileno.c: Remove fileno_locked alias.
* libio/fputc.c: Remove fputc_locked alias.
* libio/getc.c: Remove getc_locked alias.
* libio/getchar.c: Remove getchar_locked alias.
* libio/iofflush.c: Remove fflush_locked alias.
* libio/putc.c: Remove putc_locked alias.
* libio/putc.c: Remove putchar_locked alias.

* stdio-common/printf_fp.c: When number is inifinity print INF
or inf depending on case of specifier.  Same for NaN where NAN
or nan is printed.  Specified in ISO C 9X.

* misc/sys/cdefs.h (__restrict): Define to empty string for now.
* stdio/stdio.h: Add __restrict to prototypes where necessary.
* libio/stdio.h: Likewise.
* stdlib/stdlib.h: Likewise.
* string/string.h: Likewise.
* time/time.h: Likewise.
* wcsmbs/wchar.h: Likewise.

* stdlib/strtod.c: Change to recognize INF, INFINITY, NAN, and
NAN(...).

* sysdeps/ieee754/huge_val.h: Define HUGE_VALF and HUGE_VALL instead
of HUGE_VALf and HUGE_VALL.
* stdlib/strtof.c (FLOAT_HUGE_VAL): Use standard name HUGE_VALF
instead of HUGE_VALf.
* wcsmbs/wcstof.c: Likewise.
* stdlib/strtold.c (FLOAT_HUGE_VAL): Use standard name HUGE_VALL
instead of HUGE_VALl.
* wcsmbs/wcstold.c: Likewise.

* sysdeps/posix/gai_strerror.c: Use size_t for counter variable to
avoid warning.

* wcsmbs/Makefile (routines): Add wcscasecmp and wcsncase.
* wcsmbs/wchar.h: Add prototypes for wcscasecmp and wcsncase.
* wcsmbs/wcscasecmp.c: New file.
* wcsmbs/wcsncase.c: New file.

* stdlib/strtol.c: Define wide character quad word functions as
wcstoll and wcstoull and normal versions as strtoll and strtoull.
* wcsmbs/wchar.h: Add prototypes for wcstoll and wcstoull.
* wcsmbs/wcstoq: Renamed to wcstoll.c.
* wcsmbs/wcstouq: Renamed to wcstoull.c.
* wcsmbs/wcstoll.c: Renamed from wcstoq.c.  Make wcstoq a weak
alias of wcstoll.
* wcsmbs/wcstoull.c: Renamed from wcstouq.c.  Make wcstouq a weak
alias of wcstoull.
* wcsmbs/Makefile (routines): Replace wcstoq and wcstouq by
wcstoll and wcstoull respectively.
* stdlib/strtoq.c: Rename to strtoll.c.
* stdlib/strtouq.c: Rename to strtoull.c.
* stdlib/strtoll.c: Renamed from strtoq.c.  Make strtoq a weak
alias of strtoll.
* stdlib/strtoll.c: Renamed from strtouq.c.  Make strtouq a weak
alias of strtoull.
* stdlib/Makefile (routines): Replace strtoq and strtouq by
strtoll and strtoull respectively.
* stdio-common/vfscanf.c: Don't use __strtoq_internal and
__strtouq_internal but instead __strtoll_internal and
__strtoull_internal respectively.
* stdlib/stdlib.h (strtoq): Use __internal_strtoll in inline version.
(strtouq): Similar with __internal_strtoull.
* wcsmbs/wchar.h (wcstoq): Use __internal_wcstoll in inline version.
(wcstouq): Similar with __internal_wcstoull.

1997-02-23 04:38  Ulrich Drepper  <drepper@cygnus.com>

* stdlib/strtol.c (STRTOL): It is not illegal to parse a minus
sign in the strtouXX functions.  The results gets simply negated.
* stdio-common/tstscanf.c: Add testcase for above case.
* stdlib/tst-strtol.c: Correct tests.

* manual/stdio-fp.c: New file.  Generate output for example program
in stdio.texi.

* stdio-common/Makefile (routines): Add printf_fphex.
* stdio-common/vfprintf.c: Add handling of %a and %A specifier.
* stdio-common/printf_fphex.c: New file.  Implement %a and %A
specifier.

1997-02-22 03:01  Ulrich Drepper  <drepper@cygnus.com>

* sysdeps/unix/sysv/linux/timebits.h (CLK_TCK): Don't defined if
__STRICT_ANSI__.

* math/math.h: Prevent definition of struct exception when using
C++.

1997-02-22 01:45  Ulrich Drepper  <drepper@cygnus.com>

* sysdeps/unix/syscalls.list: Dup takes only one argument.
Reported by Greg McGary.

1997-02-21 00:22  Miles Bader  <miles@gnu.ai.mit.edu>
1997-02-20 01:28  Miles Bader  <miles@gnu.ai.mit.edu>
1997-02-19 13:56  Miles Bader  <miles@gnu.ai.mit.edu>
1997-02-18 15:39  Miles Bader  <miles@gnu.ai.mit.edu>
1997-02-17 10:58  Miles Bader  <miles@gnu.ai.mit.edu>
1997-02-15 10:23  Miles Bader  <miles@gnu.ai.mit.edu>
(mutex_lock, mutex_unlock, mutex_trylock): Defined in terms of
__mutex_*.
(mutex_t): Type removed & replaced by new macro.
(tsd_key_t): Typedef to int instead of pthread_key_t.
(tsd_key_create, tsd_setspecific, tsd_getspecific): New macros.
(__pthread_initialize): New macro, work around assumption of pthreads.

* sysdeps/mach/hurd/i386/init-first.c (__libc_argv, __libc_argc):
__hurd_sigthread_stack_end, __hurd_sigthread_stack_variables,
__hurd_threadvar_max, __hurd_threadvar_stack_offset,
__hurd_threadvar_stack_mask): Variables removed.
1997-02-14 14:07  Miles Bader  <miles@gnu.ai.mit.edu>
* hurd/hurd.h (_hurd_pids_changed_stamp, _hurd_pids_changed_sync):
1997-02-24 17:06  Geoffrey Keating  <geoffk@discus.anu.edu.au>

* sysdeps/unix/sysv/linux/accept.S (NARGS): Describe number of
arguments taken, for sysdeps/unix/sysv/linux/powerpc/socket.S.
* sysdeps/unix/sysv/linux/bind.S: Likewise.
* sysdeps/unix/sysv/linux/connect.S: Likewise.
* sysdeps/unix/sysv/linux/getpeername.S: Likewise.
* sysdeps/unix/sysv/linux/getsockname.S: Likewise.
* sysdeps/unix/sysv/linux/getsockopt.S: Likewise.
* sysdeps/unix/sysv/linux/listen.S: Likewise.
* sysdeps/unix/sysv/linux/recv.S: Likewise.
* sysdeps/unix/sysv/linux/recvfrom.S: Likewise.
* sysdeps/unix/sysv/linux/recvmsg.S: Likewise.
* sysdeps/unix/sysv/linux/send.S: Likewise.
* sysdeps/unix/sysv/linux/sendmsg.S: Likewise.
* sysdeps/unix/sysv/linux/sendto.S: Likewise.
* sysdeps/unix/sysv/linux/setsockopt.S: Likewise.
* sysdeps/unix/sysv/linux/shutdown.S: Likewise.
* sysdeps/unix/sysv/linux/socketpair.S: Likewise.

1997-02-15 04:51  Ulrich Drepper  <drepper@cygnus.com>

81 files changed:
ChangeLog
Makefile
catgets/gencat.c
db/makedb.c
elf/ldd.bash.in
elf/ldd.sh.in
elf/rtld.c
features.h
glibcbug.in
isomac.c [new file with mode: 0644]
libio/clearerr.c
libio/feof.c
libio/ferror.c
libio/fileno.c
libio/fputc.c
libio/getc.c
libio/getchar.c
libio/iofflush.c
libio/putc.c
libio/putchar.c
libio/stdio.h
locale/C-time.c
locale/programs/locale.c
locale/programs/localedef.c
malloc/malloc.c
malloc/malloc.h
malloc/thread-m.h
manual/stdio-fp.c [new file with mode: 0644]
manual/stdio.texi
math/math.h
misc/error.c
misc/sys/cdefs.h
rellns-sh
stdio-common/Makefile
stdio-common/printf_fp.c
stdio-common/printf_fphex.c [new file with mode: 0644]
stdio-common/tstscanf.c
stdio-common/vfprintf.c
stdio-common/vfscanf.c
stdio/stdio.h
stdlib/Makefile
stdlib/stdlib.h
stdlib/strtod.c
stdlib/strtof.c
stdlib/strtol.c
stdlib/strtold.c
stdlib/strtoll.c [moved from stdlib/strtoq.c with 97% similarity]
stdlib/strtoull.c [moved from stdlib/strtouq.c with 96% similarity]
stdlib/tst-strtol.c
string/string.h
sysdeps/ieee754/huge_val.h
sysdeps/libm-ieee754/s_cbrtl.c
sysdeps/posix/gai_strerror.c
sysdeps/unix/syscalls.list
sysdeps/unix/sysv/linux/accept.S
sysdeps/unix/sysv/linux/bind.S
sysdeps/unix/sysv/linux/connect.S
sysdeps/unix/sysv/linux/getpeername.S
sysdeps/unix/sysv/linux/getsockname.S
sysdeps/unix/sysv/linux/getsockopt.S
sysdeps/unix/sysv/linux/i386/socket.S
sysdeps/unix/sysv/linux/listen.S
sysdeps/unix/sysv/linux/recv.S
sysdeps/unix/sysv/linux/recvfrom.S
sysdeps/unix/sysv/linux/recvmsg.S
sysdeps/unix/sysv/linux/send.S
sysdeps/unix/sysv/linux/sendmsg.S
sysdeps/unix/sysv/linux/sendto.S
sysdeps/unix/sysv/linux/setsockopt.S
sysdeps/unix/sysv/linux/shutdown.S
sysdeps/unix/sysv/linux/socketpair.S
sysdeps/unix/sysv/linux/timebits.h
time/time.h
wcsmbs/Makefile
wcsmbs/wchar.h
wcsmbs/wcscasecmp.c [new file with mode: 0644]
wcsmbs/wcsncase.c [new file with mode: 0644]
wcsmbs/wcstof.c
wcsmbs/wcstold.c
wcsmbs/wcstoll.c [moved from wcsmbs/wcstoq.c with 97% similarity]
wcsmbs/wcstoull.c [moved from wcsmbs/wcstouq.c with 97% similarity]

index 58f22b69171ca67771deb2f3cbea9b865d4a4c37..c6bc83d74757b949d5c7eef20d576d317fa89dfa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,168 @@
-Fri Feb 21 00:22:28 1997  Miles Bader  <miles@gnu.ai.mit.edu>
+1997-02-24 23:05  Wolfram Gloger  <wmglo@dent.med.uni-muenchen.de>
+
+       * malloc/malloc.c (malloc_get_state): New function.
+       Saves global malloc state to an opaque data structure which
+       is dynamically allocated in the heap.
+       * malloc/malloc.c (malloc_set_state): New function.
+       Restore previously obtained state.
+       * malloc/malloc.h: Add declaration of malloc_get_state()
+       and malloc_set_state().
+
+1997-02-24 23:27  Ulrich Drepper  <drepper@cygnus.com>
+
+       * sysdeps/libm-ieee754/s_cbrtl.c: Shift B1_EXP value to right
+       position.
+
+1997-02-24 17:38  Ulrich Drepper  <drepper@cygnus.com>
+
+       * misc/error.c: Make error and error_at_line weak aliases of
+       __error and __error_at_line respectively.
+       Suggested by David Mosberger-Tang <davidm@AZStarNet.COM>.
+
+       * sysdeps/unix/sysv/linux/i386/socket.S: Update copyright.
+
+1997-02-22 11:30  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+       * elf/ldd.bash.in: Run the program directly, not as argument
+       to the dynamic linker, if it contains an interpreter segment.
+       * elf/ldd.sh.in: Likewise.
+
+       * elf/rtld.c (dl_main): In verify mode check whether the dynamic
+       object contains an interpreter segment and exit with 2 if not.
+
+1997-02-23 01:23  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+       * Makefile (distribute): Remove nsswitch.h, netgroup.h, mcheck.h
+       and xlocale.h.  Make-dist adds them automagically.
+
+1997-02-22 12:25  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+       * locale/C-time.c (_nl_C_LC_TIME): Add missing entry for
+       time-era-num-entries.
+
+1997-02-06 13:49  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
+
+       * rellns-sh: No need to check for existance of first parameter.
+
+1997-02-24 15:20  Jonathan T. Agnew  <jtagnew@amherst.edu>
+
+       * glibcbug.in: Don't mention destination on MAIL_AGENT command line
+       to avoid duplicate mail.
+
+1997-02-24 03:51  Ulrich Drepper  <drepper@cygnus.com>
+
+       * Makefile (distribute): Add isomac.c.
+       (tests): Run isomac test.
+
+       * features.h (__USE_ISOC9X): New macro.
+
+       * catgets/catgets.c: Don't use global variable `optind'.  Instead
+       use result computed by argp_parse.
+       * db/makedb: Likewise.
+       * locale/programs/locale.c: Likewise.
+       * locale/programs/localedef.c: Likewise.
+
+       * libio/stdio.h: Rewrite.  Make it more readable and add comments.
+
+       * libio/clearerr.c: Remove clearerr_locked alias.
+       * libio/feof.c: Remove feof_locked alias.
+       * libio/ferror.c: Remove feof_locked alias.
+       * libio/fileno.c: Remove fileno_locked alias.
+       * libio/fputc.c: Remove fputc_locked alias.
+       * libio/getc.c: Remove getc_locked alias.
+       * libio/getchar.c: Remove getchar_locked alias.
+       * libio/iofflush.c: Remove fflush_locked alias.
+       * libio/putc.c: Remove putc_locked alias.
+       * libio/putc.c: Remove putchar_locked alias.
+
+       * stdio-common/printf_fp.c: When number is inifinity print INF
+       or inf depending on case of specifier.  Same for NaN where NAN
+       or nan is printed.  Specified in ISO C 9X.
+
+       * misc/sys/cdefs.h (__restrict): Define to empty string for now.
+       * stdio/stdio.h: Add __restrict to prototypes where necessary.
+       * libio/stdio.h: Likewise.
+       * stdlib/stdlib.h: Likewise.
+       * string/string.h: Likewise.
+       * time/time.h: Likewise.
+       * wcsmbs/wchar.h: Likewise.
+
+       * stdlib/strtod.c: Change to recognize INF, INFINITY, NAN, and
+       NAN(...).
+
+       * sysdeps/ieee754/huge_val.h: Define HUGE_VALF and HUGE_VALL instead
+       of HUGE_VALf and HUGE_VALL.
+       * stdlib/strtof.c (FLOAT_HUGE_VAL): Use standard name HUGE_VALF
+       instead of HUGE_VALf.
+       * wcsmbs/wcstof.c: Likewise.
+       * stdlib/strtold.c (FLOAT_HUGE_VAL): Use standard name HUGE_VALL
+       instead of HUGE_VALl.
+       * wcsmbs/wcstold.c: Likewise.
+
+       * sysdeps/posix/gai_strerror.c: Use size_t for counter variable to
+       avoid warning.
+
+       * wcsmbs/Makefile (routines): Add wcscasecmp and wcsncase.
+       * wcsmbs/wchar.h: Add prototypes for wcscasecmp and wcsncase.
+       * wcsmbs/wcscasecmp.c: New file.
+       * wcsmbs/wcsncase.c: New file.
+
+       * stdlib/strtol.c: Define wide character quad word functions as
+       wcstoll and wcstoull and normal versions as strtoll and strtoull.
+       * wcsmbs/wchar.h: Add prototypes for wcstoll and wcstoull.
+       * wcsmbs/wcstoq: Renamed to wcstoll.c.
+       * wcsmbs/wcstouq: Renamed to wcstoull.c.
+       * wcsmbs/wcstoll.c: Renamed from wcstoq.c.  Make wcstoq a weak
+       alias of wcstoll.
+       * wcsmbs/wcstoull.c: Renamed from wcstouq.c.  Make wcstouq a weak
+       alias of wcstoull.
+       * wcsmbs/Makefile (routines): Replace wcstoq and wcstouq by
+       wcstoll and wcstoull respectively.
+       * stdlib/strtoq.c: Rename to strtoll.c.
+       * stdlib/strtouq.c: Rename to strtoull.c.
+       * stdlib/strtoll.c: Renamed from strtoq.c.  Make strtoq a weak
+       alias of strtoll.
+       * stdlib/strtoll.c: Renamed from strtouq.c.  Make strtouq a weak
+       alias of strtoull.
+       * stdlib/Makefile (routines): Replace strtoq and strtouq by
+       strtoll and strtoull respectively.
+       * stdio-common/vfscanf.c: Don't use __strtoq_internal and
+       __strtouq_internal but instead __strtoll_internal and
+       __strtoull_internal respectively.
+       * stdlib/stdlib.h (strtoq): Use __internal_strtoll in inline version.
+       (strtouq): Similar with __internal_strtoull.
+       * wcsmbs/wchar.h (wcstoq): Use __internal_wcstoll in inline version.
+       (wcstouq): Similar with __internal_wcstoull.
+
+1997-02-23 04:38  Ulrich Drepper  <drepper@cygnus.com>
+
+       * stdlib/strtol.c (STRTOL): It is not illegal to parse a minus
+       sign in the strtouXX functions.  The results gets simply negated.
+       * stdio-common/tstscanf.c: Add testcase for above case.
+       * stdlib/tst-strtol.c: Correct tests.
+
+       * manual/stdio-fp.c: New file.  Generate output for example program
+       in stdio.texi.
+
+       * stdio-common/Makefile (routines): Add printf_fphex.
+       * stdio-common/vfprintf.c: Add handling of %a and %A specifier.
+       * stdio-common/printf_fphex.c: New file.  Implement %a and %A
+       specifier.
+
+1997-02-22 03:01  Ulrich Drepper  <drepper@cygnus.com>
+
+       * sysdeps/unix/sysv/linux/timebits.h (CLK_TCK): Don't defined if
+       __STRICT_ANSI__.
+
+       * math/math.h: Prevent definition of struct exception when using
+       C++.
+
+1997-02-22 01:45  Ulrich Drepper  <drepper@cygnus.com>
+
+       * sysdeps/unix/syscalls.list: Dup takes only one argument.
+       Reported by Greg McGary.
+
+1997-02-21 00:22  Miles Bader  <miles@gnu.ai.mit.edu>
 
        * sysdeps/mach/hurd/readlink.c (__readlink): Use io_read rather
        than file_get_translator.
@@ -6,12 +170,12 @@ Fri Feb 21 00:22:28 1997  Miles Bader  <miles@gnu.ai.mit.edu>
        * sysdeps/mach/hurd/defs.c, sysdeps/stub/defs.c, sysdeps/posix/defs.c
        (_cleanup): Use __fcloseall instead of fclose with a NULL stream.
 
-Thu Feb 20 01:28:39 1997  Miles Bader  <miles@gnu.ai.mit.edu>
+1997-02-20 01:28  Miles Bader  <miles@gnu.ai.mit.edu>
 
        * hurd/fchroot.c (fchroot): Reparent DIR to make it a real root.
        * sysdeps/mach/hurd/chroot.c (chroot): Likewise.
 
-Wed Feb 19 13:56:04 1997  Miles Bader  <miles@gnu.ai.mit.edu>
+1997-02-19 13:56  Miles Bader  <miles@gnu.ai.mit.edu>
 
        * sysdeps/mach/hurd/accept.c (accept): Don't segv if ADDR_LEN == 0
        but ADDR also == 0.
@@ -20,7 +184,7 @@ Wed Feb 19 13:56:04 1997  Miles Bader  <miles@gnu.ai.mit.edu>
        now instead of a weak extern, as some old programs expect it to be
        defined by ld.so.
 
-Tue Feb 18 15:39:08 1997  Miles Bader  <miles@gnu.ai.mit.edu>
+1997-02-18 15:39  Miles Bader  <miles@gnu.ai.mit.edu>
 
        * hurd/hurdfault.c (_hurdsig_fault_preempter): New weak alias.
 
@@ -30,7 +194,7 @@ Tue Feb 18 15:39:08 1997  Miles Bader  <miles@gnu.ai.mit.edu>
 
        * malloc/thread-m.h (mutex_trylock): Invert sense of return value.
 
-Mon Feb 17 10:58:14 1997  Miles Bader  <miles@gnu.ai.mit.edu>
+1997-02-17 10:58  Miles Bader  <miles@gnu.ai.mit.edu>
 
        * malloc/thread-m.h (mutex_trylock): Define to be __mutex_trylock,
        not __mutex_try_lock.
@@ -40,24 +204,26 @@ Mon Feb 17 10:58:14 1997  Miles Bader  <miles@gnu.ai.mit.edu>
        * hurd/hurdinit.c (__libc_argv): Remove extern.
        (__libc_argc): New variable.
 
-Sat Feb 15 10:23:32 1997  Miles Bader  <miles@gnu.ai.mit.edu>
+1997-02-15 10:23  Miles Bader  <miles@gnu.ai.mit.edu>
 
        * hurd/hurd/threadvar.h (enum __hurd_threadvar_index): Add
        _HURD_THREADVAR_MALLOC.
        * malloc/thread-m.h
        [_LIBC && !PTHREAD_MUTEX_INITIALIZER && MUTEX_INITIALIZER]
-       (__x_mutex_lock, __x_mutex_unlock): Functions removed.
-       (mutex_lock, mutex_unlock): Defined in terms of __mutex_*.
-       (tsd_key_create, tsd_setspecific, tsd_setspecific): Change to
-       hurd-specific definitions, using __hurd_threadvar_location.
+       (mutex_lock, mutex_unlock, mutex_trylock): Defined in terms of
+       __mutex_*.
+       (mutex_t): Type removed & replaced by new macro.
+       (tsd_key_t): Typedef to int instead of pthread_key_t.
+       (tsd_key_create, tsd_setspecific, tsd_getspecific): New macros.
+       (__pthread_initialize): New macro, work around assumption of pthreads.
        (tsd_keys_alloced): New static variable.
        <hurd/threadvar.h>: New include.
-       
+
        * hurd/report-wait.c (_hurd_itimer_thread): Make a weak extern.
        (_S_msg_report_wait): Check to see if _hurd_itimer_thread is
        defined before using it.
 
-       * sysdeps/mach/hurd/i386/init-first.c (__libc_argv, __libc_argc): 
+       * sysdeps/mach/hurd/i386/init-first.c (__libc_argv, __libc_argc):
        Make extern.
        * hurd/hurdinit.c (__libc_argv): Make extern.
 
@@ -76,13 +242,13 @@ Sat Feb 15 10:23:32 1997  Miles Bader  <miles@gnu.ai.mit.edu>
        (__hurd_threadvar_max, __hurd_threadvar_stack_offset,
        __hurd_threadvar_stack_mask): Variables removed.
        * sysdeps/mach/hurd/dl-sysdep.c (__hurd_sigthread_stack_base,
-       __hurd_sigthread_stack_end, __hurd_sigthread_stack_variables,
-       __hurd_threadvar_max, __hurd_threadvar_stack_offset,
-       __hurd_threadvar_stack_mask): Variables removed.
+       __hurd_sigthread_stack_end, __hurd_sigthread_stack_variables,
+       __hurd_threadvar_max, __hurd_threadvar_stack_offset,
+       __hurd_threadvar_stack_mask): Variables removed.
 
-Fri Feb 14 14:07:19 1997  Miles Bader  <miles@gnu.ai.mit.edu>
+1997-02-14 14:07  Miles Bader  <miles@gnu.ai.mit.edu>
 
-       * hurd/hurd.h (_hurd_pids_changed_stamp, _hurd_pids_changed_sync): 
+       * hurd/hurd.h (_hurd_pids_changed_stamp, _hurd_pids_changed_sync):
        Declare extern.
 
        * malloc/thread-m.h
@@ -103,6 +269,26 @@ Fri Feb 14 14:07:19 1997  Miles Bader  <miles@gnu.ai.mit.edu>
        * locale/weight.h (collate_rules): It's an u_int32_t array.
        (get_weight): Compute initial SLOT value correctly.
 
+1997-02-24 17:06  Geoffrey Keating  <geoffk@discus.anu.edu.au>
+
+       * sysdeps/unix/sysv/linux/accept.S (NARGS): Describe number of
+       arguments taken, for sysdeps/unix/sysv/linux/powerpc/socket.S.
+       * sysdeps/unix/sysv/linux/bind.S: Likewise.
+       * sysdeps/unix/sysv/linux/connect.S: Likewise.
+       * sysdeps/unix/sysv/linux/getpeername.S: Likewise.
+       * sysdeps/unix/sysv/linux/getsockname.S: Likewise.
+       * sysdeps/unix/sysv/linux/getsockopt.S: Likewise.
+       * sysdeps/unix/sysv/linux/listen.S: Likewise.
+       * sysdeps/unix/sysv/linux/recv.S: Likewise.
+       * sysdeps/unix/sysv/linux/recvfrom.S: Likewise.
+       * sysdeps/unix/sysv/linux/recvmsg.S: Likewise.
+       * sysdeps/unix/sysv/linux/send.S: Likewise.
+       * sysdeps/unix/sysv/linux/sendmsg.S: Likewise.
+       * sysdeps/unix/sysv/linux/sendto.S: Likewise.
+       * sysdeps/unix/sysv/linux/setsockopt.S: Likewise.
+       * sysdeps/unix/sysv/linux/shutdown.S: Likewise.
+       * sysdeps/unix/sysv/linux/socketpair.S: Likewise.
+
 1997-02-22 00:17  Ulrich Drepper  <drepper@cygnus.com>
 
        * catgets/gencat.c: Change to use argp.
@@ -436,7 +622,7 @@ Fri Feb 14 14:07:19 1997  Miles Bader  <miles@gnu.ai.mit.edu>
        trying to resolv name as numeric IPv6 address.
        * nss/digits_dots.c: Likewise.
 
-Sat Feb 15 04:51:08 1997  Ulrich Drepper  <drepper@cygnus.com>
+1997-02-15 04:51  Ulrich Drepper  <drepper@cygnus.com>
 
        * locale/setlocale.c (setlocale): Don't try to be clever about
        unused locales.  When the existence of the locale files isn't
index 2d3762a00f394ec396b2dcd657f47ab0f112b65f..02e87d0ce753909073e7aa185058a39b34735cb8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -277,19 +277,25 @@ parent_echo-distinfo:
              $(addprefix +nodist+,$(generated))
 
 \f
+# Run a test on the header files we use.
+tests: $(objpfx)isomac
+       $(objpfx)isomac $(CC) '$(+sysdep-includes)' >$(common-objpfx)isomac.out
+
+$(objpfx)isomac: isomac.c
+       $(native-compile)
+\f
 # Make the distribution tarfile.
 
 distribute  := README INSTALL FAQ NOTES NEWS PROJECTS                  \
               COPYING.LIB COPYING ChangeLog ChangeLog.[0-9]            \
               Makefile Makeconfig Makerules Rules Make-dist MakeTAGS   \
-              extra-lib.mk o-iterator.mk                               \
+              extra-lib.mk o-iterator.mk isomac.c                      \
               ansidecl.h mkinstalldirs move-if-change install-sh       \
               configure configure.in aclocal.m4 config.sub config.guess\
               config.h.in config.make.in config-name.in Makefile.in    \
               autolock.sh rellns-sh munch-tmpl.c munch.awk interp.c    \
               sysdep.h set-hooks.h libc-symbols.h version.h shlib-versions \
-              rpm/Makefile rpm/template rpm/rpmrc nsswitch.h netgroup.h \
-              mcheck.h glibcbug.in xlocale.h
+              rpm/Makefile rpm/template rpm/rpmrc glibcbug.in
 
 distribute := $(strip $(distribute))
 generated := $(generated) stubs.h version-info.h
index 9f1e762f53941c7d3ed6d94d0384cfbe2c137ebf..bee101eb745a72b29f466f6b0b981fb2c5982b48 100644 (file)
@@ -152,6 +152,7 @@ int
 main (int argc, char *argv[])
 {
   struct catalog *result;
+  int remaining;
 
   /* Set program name for messages.  */
   error_print_progname = error_print;
@@ -166,18 +167,18 @@ main (int argc, char *argv[])
   result = NULL;
 
   /* Parse and process arguments.  */
-  argp_parse (&argp, argc, argv, 0, 0, NULL);
+  argp_parse (&argp, argc, argv, 0, &remaining, NULL);
 
   /* Determine output file.  */
   if (output_name == NULL)
-    output_name = optind < argc ? argv[optind++] : "-";
+    output_name = remaining < argc ? argv[remaining++] : "-";
 
   /* Process all input files.  */
   setlocale (LC_CTYPE, "C");
-  if (optind < argc)
+  if (remaining < argc)
     do
-      result = read_input_file (result, argv[optind]);
-    while (++optind < argc);
+      result = read_input_file (result, argv[remaining]);
+    while (++remaining < argc);
   else
     result = read_input_file (NULL, "-");
 
index 9f84ea39fc74a0bfef2fb2fb41a9dede7a4a5f37..32029fbbc621b0edea9e3406ecb0aa80b1e27803 100644 (file)
@@ -99,6 +99,7 @@ main (argc, argv)
   FILE *input_file;
   DB *db_file;
   int status;
+  int remaining;
 
   /* Set locale via LC_ALL.  */
   setlocale (LC_ALL, "");
@@ -110,27 +111,27 @@ main (argc, argv)
   input_name = NULL;
 
   /* Parse and process arguments.  */
-  argp_parse (&argp, argc, argv, 0, 0, NULL);
+  argp_parse (&argp, argc, argv, 0, &remaining, NULL);
 
   /* Determine file names.  */
   if (do_undo || output_name != NULL)
     {
-      if (optind + 1 != argc)
+      if (remaining + 1 != argc)
        {
        wrong_arguments:
          error (0, 0, gettext ("wrong number of arguments"));
          argp_help (&argp, stdout, ARGP_HELP_SEE,
                     program_invocation_short_name);
        }
-      input_name = argv[optind];
+      input_name = argv[remaining];
     }
   else
     {
-      if (optind + 2 != argc)
+      if (remaining + 2 != argc)
        goto wrong_arguments;
 
-      input_name = argv[optind++];
-      output_name = argv[optind];
+      input_name = argv[remaining++];
+      output_name = argv[remaining];
     }
 
   /* Special handling if we are asked to print the database.  */
index dd4fc6ab9687d5395e2069365b4a875d8ac71ef1..48d5c90fd512616b9c97ddd53d734ffb4559484e 100644 (file)
@@ -69,6 +69,7 @@ Report bugs using the \`glibcbug' script to <bugs@gnu.ai.mit.edu>."
   esac
 done
 
+add_env="LD_TRACE_LOADED_OBJECTS=1 LD_WARN=$warn LD_BIND_NOW=$bind_now"
 case $# in
 0)
   echo >&2 $"ldd: missing file arguments"
@@ -86,20 +87,29 @@ case $# in
   elif test -r "$file"; then
     test -x "$file" ||
     echo $"ldd: warning: you do not have execution permission for" "\`$file'"
-      if ${RTLD} --verify "$file"; then
-       LD_TRACE_LOADED_OBJECTS=1 LD_WARN=$warn LD_BIND_NOW=$bind_now \
-        exec ${RTLD} ${RELOCS} "$file" || exit 1
-      else
-       echo $" not a dynamic executable"
-       exit 1
-      fi
+    ${RTLD} --verify "$file"
+    case $? in
+    0)
+      eval $add_env exec '"$file"' || exit 1
+      ;;
+    1)
+      echo $"  not a dynamic executable"
+      exit 1
+      ;;
+    2)
+      eval $add_env exec \${RTLD} '"$file"' || exit 1
+      ;;
+    *)
+      echo $"ldd: ${RTLD} exited with unknown exit code ($?)" >&2
+      exit 1
+      ;;
+    esac
   else
     echo $"ldd: error: you do not have read permission for" "\`$file'"
     exit 1
   fi
   exit ;;
 *)
-  set -e       # Bail out immediately if ${RTLD} loses on any argument.
   result=0
   for file; do
     echo "${file}:"
@@ -113,13 +123,23 @@ case $# in
     elif test -r "$file"; then
       test -x "$file" || echo $"\
 ldd: warning: you do not have execution permission for" "\`$file'"
-      if ${RTLD} --verify "$file"; then
-       LD_TRACE_LOADED_OBJECTS=1 LD_WARN=$warn LD_BIND_NOW=$bind_now \
-        ${RTLD} ${RELOCS} "$file" || result=1
-      else
+      ${RTLD} --verify "$file"
+      case $? in
+      0)
+       eval $add_env '"$file"' || result=1
+       ;;
+      1)
        echo $" not a dynamic executable"
        result=1
-      fi
+       ;;
+      2)
+        eval $add_env ${RTLD} '"$file"' || result=1
+       ;;
+      *)
+       echo $"ldd: ${RTLD} exited with unknown exit code ($?)" >&2
+       exit 1
+       ;;
+      esac
     else
       echo $"ldd: error: you do not have read permission for" "\`$file'"
       result=1
index 0f3ed2e729da6abb8d34929823fb2b99b91cee9a..d5dd54a536471a5e6695d420aaf662dced40b1ab 100644 (file)
@@ -66,6 +66,7 @@ Try \`ldd --help' for more information."
   esac
 done
 
+add_env="LD_TRACE_LOADED_OBJECTS=1 LD_WARN=$warn LD_BIND_NOW=$bind_now"
 case $# in
 0)
   echo >&2 "\
@@ -85,13 +86,23 @@ Try \`ldd --help' for more information."
     if test -r "$file"; then
       test -x "$file" ||
        echo "ldd: warning: you do not have execution permission for \`$file'"
-      if ${RTLD} --verify "$file"; then
-       LD_TRACE_LOADED_OBJECTS=1 LD_WARN=$warn LD_BIND_NOW=$bind_now \
-        exec ${RTLD} "$file" || exit 1
-      else
+      ${RTLD} --verify "$file"
+      case $? in
+      0)
+       eval $add_env exec '"$file"' || exit 1
+       ;;
+      1)
        echo '  not a dynamic executable'
        exit 1
-      fi
+       ;;
+      2)
+       eval $add_env exec \${RTLD} '"$file"' || exit 1
+       ;;
+      *)
+       echo "ldd: ${RTLD} exited with unknown exit code ($?)" >&2
+       exit 1
+       ;;
+      esac
     else
       echo "ldd: error: you do not have read permission for \`$file'"
       exit 1
@@ -114,13 +125,23 @@ Try \`ldd --help' for more information."
       if test -r "$file"; then
        test -x "$file" || echo "\
 ldd: warning: you do not have execution permission for \`$file'"
-       if ${RTLD} --verify "$file"; then
-         LD_TRACE_LOADED_OBJECTS=1 LD_WARN=$warn LD_BIND_NOW=$bind_now \
-          ${RTLD} "$file" || result=1
-       else
+       ${RTLD} --verify "$file"
+       case $? in
+       0)
+         eval $add_env '"$file"' || result=1
+         ;;
+       1)
          echo '        not a dynamic executable'
          result=1
-       fi
+         ;;
+       2)
+         eval $add_env ${RTLD} '"$file"' || result=1
+         ;;
+       *)
+         echo "ldd: ${RTLD} exited with unknown exit code ($?)" >&2
+         exit 1
+         ;;
+       esac
       else
        echo "ldd: error: you do not have read permission for \`$file'"
        result=1
index 26cacef89454804b5f04d8eba9de8331649f427e..eb7b3bec2af59f8690baf7c9b18d1c40a5c29b99 100644 (file)
@@ -155,6 +155,7 @@ dl_main (const ElfW(Phdr) *phdr,
   const char *preloadlist;
   size_t file_size;
   char *file;
+  int has_interp = 0;
 
   mode = getenv ("LD_TRACE_LOADED_OBJECTS") != NULL ? trace : normal;
 
@@ -299,6 +300,7 @@ of this helper program; chances are you did not intend to run this program.\n",
        _dl_rtld_libname.name = (const char *) l->l_addr + ph->p_vaddr;
        _dl_rtld_libname.next = NULL;
        _dl_rtld_map.l_libname = &_dl_rtld_libname;
+       has_interp = 1;
        break;
       }
   if (! _dl_rtld_map.l_libname && _dl_rtld_map.l_name)
@@ -315,7 +317,7 @@ of this helper program; chances are you did not intend to run this program.\n",
   if (mode == verify)
     /* We were called just to verify that this is a dynamic executable
        using us as the program interpreter.  */
-    _exit (l->l_ld == NULL ? EXIT_FAILURE : EXIT_SUCCESS);
+    _exit (l->l_ld == NULL ? 1 : has_interp ? 0 : 2);
 
   /* Extract the contents of the dynamic section for easy access.  */
   elf_get_dynamic_info (l->l_ld, l->l_info);
index 9baaa053fa24cb574446a2b5a5a38bbf1313bc53..a14179b6a3451da0356555b573731398e6170b1b 100644 (file)
@@ -24,6 +24,7 @@
    to specify the desired environment:
 
    __STRICT_ANSI__     ISO Standard C.
+   _ISOC9X_SOURCE      Extensions to ISO C 89 from ISO C 9x.
    _POSIX_SOURCE       IEEE Std 1003.1.
    _POSIX_C_SOURCE     If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2;
                        if >=199309L, add IEEE Std 1003.1b-1993
@@ -44,6 +45,7 @@
    These are defined by this file and are used by the
    header files to decide what to declare or define:
 
+   __USE_ISOC9X                Define ISO C 9X things.
    __USE_POSIX         Define IEEE Std 1003.1 things.
    __USE_POSIX2                Define IEEE Std 1003.2 things.
    __USE_POSIX199309   Define IEEE Std 1003.1b things.
@@ -69,6 +71,7 @@
 
 
 /* Undefine everything, so we get a clean slate.  */
+#undef __USE_ISOC9X
 #undef __USE_POSIX
 #undef __USE_POSIX2
 #undef __USE_POSIX199309
 
 /* If _GNU_SOURCE was defined by the user, turn on all the other features.  */
 #ifdef _GNU_SOURCE
+#undef _ISOC9X_SOURCE
+#define        _ISOC9X_SOURCE  1
 #undef _POSIX_SOURCE
 #define        _POSIX_SOURCE   1
 #undef _POSIX_C_SOURCE
 
 /* If nothing (other than _GNU_SOURCE) is defined,
    define _BSD_SOURCE and _SVID_SOURCE.  */
-#if (!defined __STRICT_ANSI__ && !defined _POSIX_SOURCE && \
-     !defined _POSIX_C_SOURCE && !defined _XOPEN_SOURCE && \
-     !defined _XOPEN_SOURCE_EXTENDED && !defined _BSD_SOURCE && \
-     !defined _SVID_SOURCE)
+#if (!defined __STRICT_ANSI__ && !defined _ISOC9X_SOURCE && \
+     !defined _POSIX_SOURCE && !defined _POSIX_C_SOURCE && \
+     !defined _XOPEN_SOURCE && !defined _XOPEN_SOURCE_EXTENDED && \
+     !defined _BSD_SOURCE && !defined _SVID_SOURCE)
 #define        _BSD_SOURCE     1
 #define        _SVID_SOURCE    1
 #endif
 
+/* This is to enable the ISO C 9x extension.  It will go away as soon
+   as this standard is officially released.  */
+#ifdef _ISOC9X_SOURCE
+#define __USE_ISOC9X   1
+#endif
+
 /* If none of the ANSI/POSIX macros are defined, use POSIX.1 and POSIX.2
    (and IEEE Std 1003.1b-1993 unless _XOPEN_SOURCE is defined).  */
 #if (!defined __STRICT_ANSI__ && !defined _POSIX_SOURCE && \
index 28087892a5f6516469a86437c3f650eec8bb4dba..0d46b325aba32b95d1aac6ca4c84f7977a257335 100644 (file)
@@ -232,7 +232,7 @@ sed  -e "
 /^>Fix:/,/^>[A-Za-z-]*:/s;$FIX_C;;
 " $TEMP > $TEMP.x
 
-if $MAIL_AGENT $BUGGLIBC < $TEMP.x; then
+if $MAIL_AGENT < $TEMP.x; then
   echo "$COMMAND: problem report sent"
   xs=0; exit
 else
diff --git a/isomac.c b/isomac.c
new file mode 100644 (file)
index 0000000..fc6de89
--- /dev/null
+++ b/isomac.c
@@ -0,0 +1,320 @@
+/* Check system header files for ISO 9899:1990 (ISO C) compliance.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Jens Schweikhardt <schweikh@noc.dfn.de>, 1996.
+
+   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.  */
+
+/* This is a simple minded program that tries to find illegal macro
+   definitions in system header files. Illegal macro definitions are
+   those not from the implementation namespace (i.e. not starting with
+   an underscore) or not matching any identifier mandated by The
+   Standard. Some common macro names are considered okay, e.g. all those
+   beginning with E (which may be defined in <errno.h>) or ending in
+   _MAX. See the arrays prefix[] and suffix[] below for details.
+
+   In a compliant implementation no other macros can be defined, because
+   you could write strictly conforming programs that may fail to compile
+   due to syntax errors: suppose <stdio.h> defines PIPE_BUF, then the
+   conforming
+
+   #include <assert.h>
+   #include <stdio.h>      <- or where the bogus macro is defined
+   #include <string.h>
+   #define STR(x) #x
+   #define XSTR(x) STR(x)
+   int main (void)
+   {
+     int PIPE_BUF = 0;
+     assert (strcmp ("PIPE_BUF", XSTR (PIPE_BUF)) == 0);
+     return 0;
+   }
+
+   is expected to compile and meet the assertion. If it does not, your
+   compiler compiles some other language than Standard C.
+
+   REQUIREMENTS:
+     This program calls gcc to get the list of defined macros. If you
+     don't have gcc you're probably out of luck unless your compiler or
+     preprocessor has something similar to gcc's -dM option. Tune
+     PRINT_MACROS in this case. This program assumes headers are found
+     under /usr/include and that there is a writable /tmp directory.
+     Tune SYSTEM_INCLUDE and TMPFILE if your system differs.
+     #define BROKEN_SYSTEM if system(NULL) bombs -- one more violation
+     of ISO C, by the way.
+
+   OUTPUT:
+     Each header file name is printed, followed by illegal macro names
+     and their definition. For the above example, you would see
+     ...
+     /usr/include/stdio.h
+     #define PIPE_BUF 5120
+     ...
+     If your implementation does not yet incorporate Amendment 1 you
+     will see messages about iso646.h, wctype.h and wchar.h not being
+     found.  */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define TMPFILE             "/tmp/macros"
+#define HEADER_MAX          256
+
+/* ISO C header names including Amendment 1 (without ".h" suffix).  */
+static char *header[] =
+{
+  "assert", "ctype", "errno", "float", "iso646", "limits", "locale",
+  "math", "setjmp", "signal", "stdarg", "stddef", "stdio", "stdlib",
+  "string", "time", "wchar", "wctype"
+};
+
+/* Macros with these prefixes are considered okay.  */
+static char *prefix[] =
+{
+  "_", "E", "is", "str", "mem", "SIG", "FLT_", "DBL_", "LDBL_",
+  "LC_", "wmem", "wcs"
+};
+
+/* Macros with these suffixes are considered okay.  Will not work for
+   parametrized macros with arguments.  */
+static char *suffix[] =
+{
+  "_MAX", "_MIN"
+};
+
+/* These macros are considered okay. In fact, these are just more prefixes.  */
+static char *macros[] =
+{
+  "BUFSIZ", "CHAR_BIT", "CHAR_MAX", "CHAR_MIN", "CLOCKS_PER_SEC",
+  "DBL_DIG", "DBL_EPSILON", "DBL_MANT_DIG", "DBL_MAX",
+  "DBL_MAX_10_EXP", "DBL_MAX_EXP", "DBL_MIN", "DBL_MIN_10_EXP",
+  "DBL_MIN_EXP", "EDOM", "EILSEQ", "EOF", "ERANGE", "EXIT_FAILURE",
+  "EXIT_SUCCESS", "FILENAME_MAX", "FLT_DIG", "FLT_EPSILON",
+  "FLT_MANT_DIG", "FLT_MAX", "FLT_MAX_10_EXP", "FLT_MAX_EXP",
+  "FLT_MIN", "FLT_MIN_10_EXP", "FLT_MIN_EXP", "FLT_RADIX",
+  "FLT_ROUNDS", "FOPEN_MAX", "HUGE_VAL", "INT_MAX", "INT_MIN",
+  "LC_ALL", "LC_COLLATE", "LC_CTYPE", "LC_MONETARY", "LC_NUMERIC",
+  "LC_TIME", "LDBL_DIG", "LDBL_EPSILON", "LDBL_MANT_DIG", "LDBL_MAX",
+  "LDBL_MAX_10_EXP", "LDBL_MAX_EXP", "LDBL_MIN", "LDBL_MIN_10_EXP",
+  "LDBL_MIN_EXP", "LONG_MAX", "LONG_MIN", "L_tmpnam", "MB_CUR_MAX",
+  "MB_LEN_MAX", "NDEBUG", "NULL", "RAND_MAX", "SCHAR_MAX",
+  "SCHAR_MIN", "SEEK_CUR", "SEEK_END", "SEEK_SET", "SHRT_MAX",
+  "SHRT_MIN", "SIGABRT", "SIGFPE", "SIGILL", "SIGINT", "SIGSEGV",
+  "SIGTERM", "SIG_DFL", "SIG_ERR", "SIG_IGN", "TMP_MAX", "UCHAR_MAX",
+  "UINT_MAX", "ULONG_MAX", "USHRT_MAX", "WCHAR_MAX", "WCHAR_MIN",
+  "WEOF", "_IOFBF", "_IOLBF", "_IONBF", "abort", "abs", "acos",
+  "acosf", "acosl", "and", "and_eq", "asctime", "asin", "asinf",
+  "asinl", "assert", "atan", "atan2", "atan2f", "atan2l", "atanf",
+  "atanl", "atexit", "atof", "atoi", "atol", "bitand", "bitor",
+  "bsearch", "btowc", "calloc", "ceil", "ceilf", "ceill", "clearerr",
+  "clock", "clock_t", "compl", "cos", "cosf", "cosh", "coshf",
+  "coshl", "cosl", "ctime", "difftime", "div", "div_t", "errno",
+  "exit", "exp", "expf", "expl", "fabs", "fabsf", "fabsl", "fclose",
+  "feof", "ferror", "fflush", "fgetc", "fgetpos", "fgets", "fgetwc",
+  "fgetws", "floor", "floorf", "floorl", "fmod", "fmodf", "fmodl",
+  "fopen", "fprintf", "fputc", "fputs", "fputwc", "fputws", "fread",
+  "free", "freopen", "frexp", "frexpf", "frexpl", "fscanf", "fseek",
+  "fsetpos", "ftell", "fwide", "fwprintf", "fwrite", "fwscanf",
+  "getc", "getchar", "getenv", "gets", "getwc", "getwchar", "gmtime",
+  "isalnum", "isalpha", "iscntrl", "isdigit", "isgraph", "islower",
+  "isprint", "ispunct", "isspace", "isupper", "iswalnum", "iswalpha",
+  "iswcntrl", "iswctype", "iswdigit", "iswgraph", "iswlower",
+  "iswprint", "iswpunct", "iswspace", "iswupper", "iswxdigit",
+  "isxdigit", "labs", "ldexp", "ldexpf", "ldexpl", "ldiv", "ldiv_t",
+  "localeconv", "localtime", "log", "log10", "log10f", "log10l",
+  "logf", "logl", "longjmp", "malloc", "mblen", "mbrlen", "mbrtowc",
+  "mbsinit", "mbsrtowcs", "mbstate_t", "mbstowcs", "mbtowc", "memchr",
+  "memcmp", "memcpy", "memmove", "memset", "mktime", "modf", "modff",
+  "modfl", "not", "not_eq", "offsetof", "or", "or_eq", "perror",
+  "pow", "powf", "powl", "printf", "ptrdiff_t", "putc", "putchar",
+  "puts", "putwc", "putwchar", "qsort", "raise", "rand", "realloc",
+  "remove", "rename", "rewind", "scanf", "setbuf", "setjmp",
+  "setlocale", "setvbuf", "sig_atomic_t", "signal", "sin", "sinf",
+  "sinh", "sinhf", "sinhl", "sinl", "size_t", "sprintf", "sqrt",
+  "sqrtf", "sqrtl", "srand", "sscanf", "stderr", "stdin", "stdout",
+  "strcat", "strchr", "strcmp", "strcoll", "strcpy", "strcspn",
+  "strerror", "strftime", "strlen", "strncat", "strncmp", "strncpy",
+  "strpbrk", "strrchr", "strspn", "strstr", "strtod", "strtok",
+  "strtol", "strtoul", "strxfrm", "swprintf", "swscanf", "system",
+  "tan", "tanf", "tanh", "tanhf", "tanhl", "tanl", "time", "time_t",
+  "tmpfile", "tmpnam", "tolower", "toupper", "towctrans", "towlower",
+  "towupper", "ungetc", "ungetwc", "va_arg", "va_end", "va_start",
+  "vfprintf", "vfwprintf", "vprintf", "vsprintf", "vswprintf",
+  "vwprintf", "wchar_t", "wcrtomb", "wcscat", "wcschr", "wcscmp",
+  "wcscoll", "wcscpy", "wcscspn", "wcsftime", "wcslen", "wcsncat",
+  "wcsncmp", "wcsncpy", "wcspbrk", "wcsrchr", "wcsrtombs", "wcsspn",
+  "wcsstr", "wcstod", "wcstok", "wcstol", "wcstombs", "wcstoul",
+  "wcsxfrm", "wctob", "wctomb", "wctrans", "wctrans_t", "wctype",
+  "wctype_t", "wint_t", "wmemchr", "wmemcmp", "wmemcpy", "wmemmove",
+  "wmemset", "wprintf", "wscanf", "xor", "xor_eq"
+};
+
+#define NUMBER_OF_HEADERS              (sizeof header / sizeof *header)
+#define NUMBER_OF_PREFIXES             (sizeof prefix / sizeof *prefix)
+#define NUMBER_OF_SUFFIXES             (sizeof suffix / sizeof *suffix)
+#define NUMBER_OF_MACROS               (sizeof macros / sizeof *macros)
+
+/* The compiler we use (given on the command line).  */
+char *CC;
+/* The -I parameters for CC to find all headers.  */
+char *INC;
+
+static int check_header (const char *);
+
+int
+main (int argc, char *argv[])
+{
+  int h;
+  int result = 0;
+
+  CC = argc > 1 ? argv[1] : "gcc";
+  INC = argc > 2 ? argv[2] : "";
+
+  if (system (NULL) == 0)
+    {
+      puts ("Sorry, no command processor.");
+      return EXIT_FAILURE;
+    }
+
+  for (h = 0; h < NUMBER_OF_HEADERS; ++h)
+    {
+      char file_name[HEADER_MAX];
+      sprintf (file_name, "%s.h", header[h]);
+      result |= check_header (file_name);
+    }
+
+
+#if 0
+  /* The test suite should return errors but for now this is not
+     practical.  Give a warning and ask the user to correct the bugs.  */
+  return result;
+#else
+  if (result)
+    fputs ("\
+##########################################################################\n\
+# The test suite found some problems with your system (see the generated #\n\
+# isomac.out file).  These are all violations of the ISO C rules and     #\n\
+# should be corrected.  If the problem is in the libc, report it using   #\n\
+# the glibcbug script to <bugs@gnu.ai.mit.edu>.  If it is a problem with #\n\
+# your compiler, contact the compiler manufacturer.                      #\n\
+##########################################################################\n",
+          stderr);
+
+  return 0;
+#endif
+}
+
+static int
+check_header (const char *file_name)
+{
+  char line[BUFSIZ], *command;
+  FILE *input;
+  int result = 0;
+  static const char fmt[] = "\
+echo \"#include <%s>\" |\
+%s -E -dM -ansi -pedantic %s -D_LIBC -I. -I `%s --print-prog-name=include` -\
+> %s";
+
+  command = malloc (sizeof fmt + strlen (file_name) + 2 * strlen (CC)
+                   + strlen (INC) + strlen (TMPFILE));
+
+  if (command == NULL)
+    {
+      puts ("No more memory.");
+      exit (1);
+    }
+
+  puts (file_name);
+  sprintf (command, fmt, file_name, CC, INC, CC, TMPFILE);
+
+  if (system (command))
+    {
+      puts ("system() returned nonzero");
+      result = 1;
+    }
+  free (command);
+  input = fopen (TMPFILE, "r");
+
+  if (input == NULL)
+    {
+      printf ("Could not read %s: ", TMPFILE);
+      perror (NULL);
+      return 1;
+    }
+
+  while (fgets (line, sizeof line, input) != NULL)
+    {
+      int i, okay = 0;
+      size_t endmac;
+      if (strlen (line) < 9 || line[7] != ' ')
+       { /* "#define A" */
+         printf ("Malformed input, expected '#define MACRO'\ngot '%s'\n",
+                 line);
+         result = 1;
+         continue;
+       }
+      for (i = 0; i < NUMBER_OF_PREFIXES; ++i)
+       {
+         if (!strncmp (line+8, prefix[i], strlen (prefix[i]))) {
+           ++okay;
+           break;
+         }
+       }
+      if (okay)
+       continue;
+      for (i = 0; i < NUMBER_OF_MACROS; ++i)
+       {
+         if (!strncmp (line+8, macros[i], strlen (macros[i])))
+           {
+             ++okay;
+             break;
+           }
+       }
+      if (okay)
+       continue;
+      /* Find next char after the macro identifier; this can be either
+        a space or an open parenthesis.  */
+      endmac = strcspn (line + 8, " (");
+      if (line[8+endmac] == '\0')
+       {
+         printf ("malformed input, expected '#define MACRO VALUE'\n"
+                 "got '%s'\n", line);
+         result = 1;
+         continue;
+       }
+      for (i = 0; i < NUMBER_OF_SUFFIXES; ++i)
+       {
+         size_t len = strlen (suffix[i]);
+         if (!strncmp (line + 8 + endmac - len, suffix[i], len))
+           {
+             ++okay;
+             break;
+           }
+       }
+      if (!okay)
+       {
+         fputs (line, stdout);
+         result = 2;
+       }
+    }
+  fclose (input);
+  remove (TMPFILE);
+
+  return result;
+}
+
+/* EOF */
index 7c7fb93dc02dc65103882315ddba44bc52ee0233..4776250ff8d943b2ce7311f81a9214638ae1fde3 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+/* Copyright (C) 1995, 1996, 1997 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
@@ -28,7 +28,3 @@ clearerr (fp)
   _IO_clearerr (fp);
   _IO_funlockfile (fp);
 }
-
-#ifdef _IO_MTSAFE_IO
-weak_alias (clearerr, clearerr_locked)
-#endif
index 34ca1da1616cd79828f2679f80ace23c2812ae0f..23674704d610f24c156cd4e220accb163aaf1984 100644 (file)
@@ -36,11 +36,3 @@ _IO_feof (fp)
   return result;
 }
 weak_alias (_IO_feof, feof)
-
-#ifdef _IO_MTSAFE_IO
-/* The feof implementation for libio does not require locking because
-   it only accesses once a single variable and this is already atomic
-   (at least at thread level).  */
-
-weak_alias (_IO_feof, feof_locked)
-#endif
index 4f75092149107130478d2b2c0dd6c8626ba68b44..b9ed64587c3e42319636f0d0db6194a6e165de27 100644 (file)
@@ -36,8 +36,3 @@ _IO_ferror (fp)
   return result;
 }
 weak_alias (_IO_ferror, ferror)
-
-#ifdef _IO_MTSAFE_IO
-
-weak_alias (ferror, ferror_locked)
-#endif
index 08e657b9709766fd04fb455991652130329a5977..269ecb875acbb1bc246946eb2f27e7adcf33e12c 100644 (file)
@@ -43,5 +43,4 @@ fileno (fp)
    (at least at thread level).  */
 
 weak_alias (fileno, fileno_unlocked)
-weak_alias (fileno, fileno_locked)
 #endif
index 89359dc46d2469d938174f124942f9f1d00d1d2b..e1f10f1b2067181cddb11d1a20634956d7bbb597 100644 (file)
@@ -38,5 +38,3 @@ fputc (c, fp)
   _IO_cleanup_region_end (1);
   return result;
 }
-
-weak_alias (fputc, fputc_locked)
index eede63984fb1387f933cbc45b18f1ed013cc031d..d3e89fcc273618a843a3498dfb2d155f3479c8fe 100644 (file)
@@ -41,9 +41,3 @@ _IO_getc (fp)
 }
 #undef getc
 weak_alias (_IO_getc, getc)
-
-#ifdef _IO_MTSAFE_IO
-# undef getc_locked
-
-weak_alias (getc, getc_locked)
-#endif
index aa675591ad7d5f9e501c7a5dc7c4b2fd3029c81f..25eb2b10aef7822f3d9e8a204152e261e66d1aea 100644 (file)
@@ -37,9 +37,3 @@ getchar ()
   _IO_cleanup_region_end (1);
   return result;
 }
-
-#ifdef _IO_MTSAFE_IO
-# undef getchar_locked
-
-weak_alias (getchar, getchar_locked)
-#endif
index af69486164309db10b2494da999923ef9cc61ef9..96cb49b2dc8e25ed16fce0dcd0a06205030dd92c 100644 (file)
@@ -44,7 +44,3 @@ _IO_fflush (fp)
 }
 
 weak_alias (_IO_fflush, fflush)
-
-#ifdef _IO_MTSAFE_IO
-weak_alias (_IO_fflush, fflush_locked)
-#endif
index 5aa3b681376d204948bc315f571e4eefa659ad66..6d84f249956b02e8aecb3f83f2ec0b60e7cb16e0 100644 (file)
@@ -1,20 +1,20 @@
-/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1991, 1995, 1996, 1997 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
-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.  */
 
 #include "libioP.h"
 #include "stdio.h"
@@ -36,9 +36,3 @@ _IO_putc (c, fp)
 }
 #undef putc
 weak_alias (_IO_putc, putc)
-
-#ifdef _IO_MTSAFE_IO
-# undef putc_locked
-
-weak_alias (putc, putc_locked)
-#endif
index 7822a31a1a24ddf40a4775eae9dce9097a44caa7..b8a41ebf762dd811fa1ad9c9067ecd86f1e0cdaf 100644 (file)
@@ -1,20 +1,20 @@
-/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
-This file is part of the GNU C Library.
+/* Copyright (C) 1991, 1995, 1996, 1997 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
-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.  */
 
 #include "libioP.h"
 #include "stdio.h"
@@ -33,9 +33,3 @@ putchar (c)
   __libc_cleanup_region_end (1);
   return result;
 }
-
-#ifdef _IO_MTSAFE_IO
-# undef putchar_locked
-
-weak_alias (putchar, putchar_locked)
-#endif
index 88e9c6a98596dd08961d26d66f8447ed79821729..0ed711a8cb27aeafaec54f16ef82ec50ad3049b6 100644 (file)
-/* This is part of the iostream/stdio library, providing -*- C -*- I/O.
-   Define ANSI C stdio on top of C++ iostreams.
+/* Define ISO C stdio on top of C++ iostreams.
    Copyright (C) 1991, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
 
-This 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.
 
-This 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 this library; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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.  */
 
 /*
  *     ISO C Standard: 4.9 INPUT/OUTPUT        <stdio.h>
  */
 
 #ifndef _STDIO_H
-#define _STDIO_H
+
+#if !defined __need_FILE
+#define _STDIO_H       1
+#include <features.h>
+
+__BEGIN_DECLS
+
+#define __need_size_t
+#define        __need_NULL
+#include <stddef.h>
+
+#include <gnu/types.h>
+#endif /* Don't need FILE.  */
+#undef __need_FILE
+
+
+#ifndef        __FILE_defined
+
+/* The opaque type of streams.  */
+typedef struct _IO_FILE FILE;
+
+#define        __FILE_defined  1
+#endif /* FILE not defined.  */
+
+
+#ifdef _STDIO_H
 #define _STDIO_USES_IOSTREAM
 
 #include <libio.h>
 
-#ifndef NULL
-#ifdef __cplusplus
-#define NULL 0
-#else
-#define NULL (void*)0
-#endif
-#endif
+/* The type of the second argument to `fgetpos' and `fsetpos'.  */
+typedef _G_fpos_t fpos_t;
 
-#ifndef EOF
-#define EOF (-1)
-#endif
+
+/* Generate a unique file name (and possibly open it with mode "w+b").  */
+extern char *__stdio_gen_tempname __P ((char *__buf, size_t __bufsize,
+                                       __const char *__dir,
+                                       __const char *__pfx,
+                                       int __dir_search,
+                                       size_t *__lenptr,
+                                       FILE **__streamptr));
+
+
+/* Print out MESSAGE on the error output and abort.  */
+extern void __libc_fatal __P ((__const char *__message))
+     __attribute__ ((__noreturn__));
+
+
+/* The possibilities for the third argument to `setvbuf'.  */
+#define _IOFBF 0               /* Fully buffered.  */
+#define _IOLBF 1               /* Line buffered.  */
+#define _IONBF 2               /* No buffering.  */
+
+
+/* Default buffer size.  */
 #ifndef BUFSIZ
 #define BUFSIZ _IO_BUFSIZ
 #endif
 
-#define _IOFBF 0 /* Fully buffered. */
-#define _IOLBF 1 /* Line buffered. */
-#define _IONBF 2 /* No buffering. */
-
-#define SEEK_SET 0
-#define SEEK_CUR 1
-#define SEEK_END 2
-
- /* define size_t.  Crud in case <sys/types.h> has defined it. */
-#if !defined(_SIZE_T) && !defined(_T_SIZE_) && !defined(_T_SIZE)
-#if !defined(__SIZE_T) && !defined(_SIZE_T_) && !defined(___int_size_t_h)
-#if !defined(_GCC_SIZE_T) && !defined(_SIZET_)
-#define _SIZE_T
-#define _T_SIZE_
-#define _T_SIZE
-#define __SIZE_T
-#define _SIZE_T_
-#define ___int_size_t_h
-#define _GCC_SIZE_T
-#define _SIZET_
-typedef _IO_size_t size_t;
-#endif
-#endif
+
+/* End of file character.
+   Some things throughout the library rely on this being -1.  */
+#ifndef EOF
+#define EOF (-1)
 #endif
 
-typedef struct _IO_FILE FILE;
-typedef _IO_fpos_t fpos_t;
 
-#include <stdio_lim.h>
+/* The possibilities for the third argument to `fseek'.
+   These values should not be changed.  */
+#define SEEK_SET       0       /* Seek from beginning of file.  */
+#define SEEK_CUR       1       /* Seek from current position.  */
+#define SEEK_END       2       /* Seek from end of file.  */
+
 
 #ifdef __USE_SVID
 /* Default path prefix for `tempnam' and `tmpnam'.  */
 #define P_tmpdir      "/tmp"
 #endif
 
-/* For use by debuggers. These are linked in if printf or fprintf are used. */
-extern FILE *stdin, *stdout, *stderr; /* TODO */
 
+/* Get the values:
+   L_tmpnam    How long an array of chars must be to be passed to `tmpnam'.
+   TMP_MAX     The minimum number of unique filenames generated by tmpnam
+               (and tempnam when it uses tmpnam's name space),
+               or tempnam (the two are separate).
+   L_ctermid   How long an array to pass to `ctermid'.
+   L_cuserid   How long an array to pass to `cuserid'.
+   FOPEN_MAX   Minimum number of files that can be open at once.
+   FILENAME_MAX        Maximum length of a filename.  */
+#include <stdio_lim.h>
+
+
+/* Standard streams.  */
+extern FILE *stdin, *stdout, *stderr;
+/* Refer to the real names by default.  */
 #define stdin _IO_stdin
 #define stdout _IO_stdout
 #define stderr _IO_stderr
 
-#ifdef __cplusplus
-extern "C" {
-#endif
 
-#ifndef __P
-#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
-#define __P(args) args
-#else
-#define __P(args) ()
-#endif
-#endif /*!__P*/
-
-extern void clearerr __P ((FILE*));
-extern int fclose __P ((FILE*));
-extern int feof __P ((FILE*));
-extern int ferror __P ((FILE*));
-extern int fflush __P ((FILE*));
-extern int fgetc __P ((FILE *));
-extern int fgetpos __P ((FILE* fp, fpos_t *pos));
-extern char* fgets __P ((char*, int, FILE*));
-extern FILE* fopen __P ((__const char*, __const char*));
-extern FILE* fopencookie __P ((void *cookie, __const char *mode,
-                              _IO_cookie_io_functions_t io_functions));
-extern int fprintf __P ((FILE*, __const char* format, ...));
-extern int fputc __P ((int, FILE*));
-extern int fputs __P ((__const char *str, FILE *fp));
-extern size_t fread __P ((void*, size_t, size_t, FILE*));
-extern FILE* freopen __P ((__const char*, __const char*, FILE*));
-extern int fscanf __P ((FILE *fp, __const char* format, ...));
-extern int fseek __P ((FILE* fp, long int offset, int whence));
-extern int fsetpos __P ((FILE* fp, __const fpos_t *pos));
-extern long int ftell __P ((FILE* fp));
-extern size_t fwrite __P ((__const void*, size_t, size_t, FILE*));
-extern int getc __P ((FILE *));
-extern int getchar __P ((void));
-extern char* gets __P ((char*));
-extern void perror __P ((__const char *));
-extern int printf __P ((__const char* format, ...));
-extern int putc __P ((int, FILE *));
-extern int putchar __P ((int));
-extern int puts __P ((__const char *str));
-extern int remove __P ((__const char*));
-extern int rename __P ((__const char* _old, __const char* _new));
-extern void rewind __P ((FILE*));
-extern int scanf __P ((__const char* format, ...));
-extern void setbuf __P ((FILE*, char*));
-extern void setlinebuf __P ((FILE*));
-extern void setbuffer __P ((FILE*, char*, int));
-extern int setvbuf __P ((FILE*, char*, int mode, size_t size));
-extern int sprintf __P ((char*, __const char* format, ...));
-extern int sscanf __P ((__const char* string, __const char* format, ...));
-extern FILE* tmpfile __P ((void));
-extern char* tmpnam __P ((char*));
-#ifdef __USE_MISC
-extern char* tmpnam_r __P ((char*));
+/* Remove file FILENAME.  */
+extern int remove __P ((__const char *__filename));
+/* Rename file OLD to NEW.  */
+extern int rename __P ((__const char *__old, __const char *__new));
+
+
+/* Create a temporary file and open it read/write.  */
+extern FILE *tmpfile __P ((void));
+/* Generate a temporary filename.  */
+extern char *tmpnam __P ((char *__s));
+
+#ifdef __USE_MISC
+/* This is the reentrant variant of `tmpnam'.  The only difference is
+   that it does not allow S to be NULL.  */
+extern char *tmpnam_r __P ((char *__s));
 #endif
-#if defined(__USE_SVID) || defined(__USE_XOPEN)
+
+
+#if defined __USE_SVID || defined __USE_XOPEN
+/* Generate a unique temporary filename using up to five characters of PFX
+   if it is not NULL.  The directory to put this file in is searched for
+   as follows: First the environment variable "TMPDIR" is checked.
+   If it contains the name of a writable directory, that directory is used.
+   If not and if DIR is not NULL, that value is checked.  If that fails,
+   P_tmpdir is tried and finally "/tmp".  The storage for the filename
+   is allocated by `malloc'.  */
 extern char *tempnam __P ((__const char *__dir, __const char *__pfx));
 #endif
-extern char *__stdio_gen_tempname __P ((char *__buf, size_t bufsize,
-                                       __const char *dir, __const char *pfx,
-                                       int dir_search, size_t *lenptr,
-                                       FILE **streamptr));
-extern int ungetc __P ((int c, FILE* fp));
-extern int vfprintf __P ((FILE *fp, char __const *fmt0, _G_va_list));
-extern int vprintf __P ((char __const *fmt, _G_va_list));
-extern int vsprintf __P ((char* string, __const char* format, _G_va_list));
-extern void __libc_fatal __P ((__const char *__message))
-     __attribute__ ((__noreturn__));
 
-#ifndef __STRICT_ANSI__
-extern int dprintf __P ((int, __const char *, ...));
-extern int vdprintf __P ((int, __const char *, _G_va_list));
-extern int vfscanf __P ((FILE*, __const char *, _G_va_list));
-extern int __vfscanf __P ((FILE*, __const char *, _G_va_list));
-extern int vscanf __P ((__const char *, _G_va_list));
-extern int vsscanf __P ((__const char *, __const char *, _G_va_list));
-extern int __vsscanf __P ((__const char *, __const char *, _G_va_list));
+
+/* Close STREAM.  */
+extern int fclose __P ((FILE *__stream));
+/* Flush STREAM, or all streams if STREAM is NULL.  */
+extern int fflush __P ((FILE *__stream));
+
+#ifdef __USE_MISC
+/* Faster versions when locking is not required.  */
+extern int fclose_unlocked __P ((FILE *__stream));
+extern int fflush_unlocked __P ((FILE *__stream));
 #endif
 
 #ifdef __USE_GNU
+/* Close all streams.  */
 extern int __fcloseall __P ((void));
 extern int fcloseall __P ((void));
-
-struct obstack;
-extern int obstack_vprintf __P ((struct obstack *__obstack,
-                                __const char *__fmt, _G_va_list));
-extern int obstack_printf __P ((struct obstack *__obstack, __const char *__fmt,
-                               ...));
 #endif
 
-#if !defined(__STRICT_ANSI__) || defined(_POSIX_SOURCE)
-extern FILE *fdopen __P ((int, __const char *));
-extern int fileno __P ((FILE*));
-extern FILE* popen __P ((__const char*, __const char*));
-extern int pclose __P ((FILE*));
-
-#define L_ctermid     9
-#define L_cuserid     9
 
-/* Return the name of the controlling terminal.  */
-extern char *ctermid __P ((char *__buf));
+/* Open a file and create a new stream for it.  */
+extern FILE *fopen __P ((__const char *__filename, __const char *__modes));
+/* Open a file, replacing an existing stream with it. */
+extern FILE *freopen __P ((__const char *__restrict __filename,
+                          __const char *__restrict __modes,
+                          FILE *__restrict __stream));
 
-/* Get character login name of the user.  */
-extern char *cuserid __P ((char * __buf));
+#ifdef __USE_POSIX
+/* Create a new stream that refers to an existing system file descriptor.  */
+extern FILE *fdopen __P ((int __fd, __const char *__modes));
 #endif
 
-#ifdef __USE_GNU
-extern _IO_ssize_t getdelim __P ((char **, size_t *, int, FILE*));
-extern _IO_ssize_t getline __P ((char **, size_t *, FILE *));
-extern _IO_ssize_t __getline __P ((char **, size_t *, FILE *));
-
-extern int snprintf __P ((char *, size_t, __const char *, ...));
-extern int __snprintf __P ((char *, size_t, __const char *, ...));
-extern int vsnprintf __P ((char *, size_t, __const char *, _G_va_list));
-extern int __vsnprintf __P ((char *, size_t, __const char *, _G_va_list));
-
-extern int asprintf __P ((char **, const char *, ...));
-extern int vasprintf __P ((char **, const char *, _G_va_list));
+#ifdef __USE_GNU
+/* Create a new stream that refers to the given magic cookie,
+   and uses the given functions for input and output.  */
+extern FILE *fopencookie __P ((void *__magic_cookie, __const char *__modes,
+                              _IO_cookie_io_functions_t __io_funcs));
 
 /* Open a stream that writes into a malloc'd buffer that is expanded as
    necessary.  *BUFLOC and *SIZELOC are updated with the buffer's location
@@ -211,77 +193,409 @@ extern int vasprintf __P ((char **, const char *, _G_va_list));
 extern FILE *open_memstream __P ((char **__bufloc, size_t *__sizeloc));
 #endif
 
-extern int __underflow __P ((struct _IO_FILE*));
-extern int __overflow __P ((struct _IO_FILE*, int));
 
-#ifdef  __USE_BSD
-extern int sys_nerr;
-extern const char *const sys_errlist[];
-#endif
-#ifdef  __USE_GNU
-extern int _sys_nerr;
-extern const char *const _sys_errlist[];
+/* If BUF is NULL, make STREAM unbuffered.
+   Else make it use buffer BUF, of size BUFSIZ.  */
+extern void setbuf __P ((FILE *__restrict __stream, char *__restrict __buf));
+/* Make STREAM use buffering mode MODE.
+   If BUF is not NULL, use N bytes of it for buffering;
+   else allocate an internal buffer N bytes long.  */
+extern int setvbuf __P ((FILE *__restrict __stream, char *__restrict __buf,
+                        int __modes, size_t __n));
+
+#ifdef __USE_BSD
+/* If BUF is NULL, make STREAM unbuffered.
+   Else make it use SIZE bytes of BUF for buffering.  */
+extern void setbuffer __P ((FILE *__stream, char *__buf, size_t __size));
+
+/* Make STREAM line-buffered.  */
+extern void setlinebuf __P ((FILE *__stream));
 #endif
 
-/* Handle locking of streams.  */
-#ifdef __USE_MISC
-extern void clearerr_locked __P ((FILE *));
-extern void clearerr_unlocked __P ((FILE *));
-extern int feof_locked __P ((FILE *));
-extern int feof_unlocked __P ((FILE *));
-extern int ferror_locked __P ((FILE*));
-extern int ferror_unlocked __P ((FILE*));
-extern int fileno_locked __P ((FILE *));
-extern int fileno_unlocked __P ((FILE *));
-extern int fclose_unlocked __P ((FILE *));
-extern int fflush_locked __P ((FILE *));
-extern int fflush_unlocked __P ((FILE *));
-extern size_t fread_unlocked __P ((void *, size_t, size_t, FILE *));
-extern size_t fwrite_unlocked __P ((const void *, size_t, size_t, FILE *));
-
-extern int fputc_locked __P ((int, FILE*));
-extern int fputc_unlocked __P ((int, FILE*));
-extern int getc_locked __P ((FILE *));
-extern int getchar_locked __P ((void));
-extern int putc_locked __P ((int, FILE *));
-extern int putchar_locked __P ((int));
-
-# ifndef _LIBC
-#  define getc_locked(fp) _IO_getc (fp)
-#  define getchar_locked() _IO_getc (stdin)
-#  define putchar_locked(c) _IO_putc (c, stdout)
-# endif
+
+/* Write formatted output to STREAM.  */
+extern int fprintf __P ((FILE *__restrict __stream,
+                        __const char *__restrict __format, ...));
+/* Write formatted output to stdout.  */
+extern int printf __P ((__const char *__restrict __format, ...));
+/* Write formatted output to S.  */
+extern int sprintf __P ((char *__restrict __s,
+                        __const char *__restrict __format, ...));
+
+/* Write formatted output to S from argument list ARG.  */
+extern int vfprintf __P ((FILE *__restrict __s,
+                         __const char *__restrict __format,
+                         _G_va_list __arg));
+/* Write formatted output to stdout from argument list ARG.  */
+extern int vprintf __P ((__const char *__restrict __format,
+                        _G_va_list __arg));
+/* Write formatted output to S from argument list ARG.  */
+extern int vsprintf __P ((char *__restrict __s,
+                         __const char *__restrict __format,
+                         _G_va_list __arg));
+
+#ifdef __OPTIMIZE__
+extern __inline int
+vprintf (const char *__restrict __fmt, _G_va_list __arg)
+{
+  return vfprintf (stdout, __fmt, __arg);
+}
+#endif /* Optimizing.  */
+
+#ifdef __USE_GNU
+/* Maximum chars of output to write in MAXLEN.  */
+extern int __snprintf __P ((char *__s, size_t __maxlen,
+                           __const char *__format, ...));
+extern int snprintf __P ((char *__s, size_t __maxlen,
+                         __const char *__format, ...));
+
+extern int __vsnprintf __P ((char *__s, size_t __maxlen,
+                            __const char *__format, _G_va_list __arg));
+extern int vsnprintf __P ((char *__s, size_t __maxlen,
+                          __const char *__format, _G_va_list __arg));
+
+/* Write formatted output to a string dynamically allocated with `malloc'.
+   Store the address of the string in *PTR.  */
+extern int vasprintf __P ((char **__ptr, __const char *__f,
+                          _G_va_list __arg));
+extern int asprintf __P ((char **__ptr, __const char *__fmt, ...));
+
+/* Write formatted output to a file descriptor.  */
+extern int vdprintf __P ((int __fd, __const char *__fmt, _G_va_list __arg));
+extern int dprintf __P ((int __fd, __const char *__fmt, ...));
 #endif
 
+
+/* Read formatted input from STREAM.  */
+extern int fscanf __P ((FILE *__restrict __stream,
+                       __const char *__restrict __format, ...));
+/* Read formatted input from stdin.  */
+extern int scanf __P ((__const char *__restrict __format, ...));
+/* Read formatted input from S.  */
+extern int sscanf __P ((__const char *__restrict __s,
+                       __const char *__restrict __format, ...));
+
+#ifdef __USE_GNU
+/* Read formatted input from S into argument list ARG.  */
+extern int __vfscanf __P ((FILE *__s, __const char *__format,
+                          _G_va_list __arg));
+extern int vfscanf __P ((FILE *__s, __const char *__format,
+                        _G_va_list __arg));
+
+/* Read formatted input from stdin into argument list ARG.  */
+extern int __vscanf __P ((__const char *__format, _G_va_list __arg));
+extern int vscanf __P ((__const char *__format, _G_va_list __arg));
+
+/* Read formatted input from S into argument list ARG.  */
+extern int __vsscanf __P ((__const char *__s, __const char *__format,
+                          _G_va_list __arg));
+extern int vsscanf __P ((__const char *__s, __const char *__format,
+                        _G_va_list __arg));
+
+
+#ifdef __OPTIMIZE__
+extern __inline int
+vfscanf (FILE *__s, const char *__fmt, _G_va_list __arg)
+{
+  return __vfscanf (__s, __fmt, __arg);
+}
+extern __inline int
+vscanf (const char *__fmt, _G_va_list __arg)
+{
+  return __vfscanf (stdin, __fmt, __arg);
+}
+extern __inline int
+vsscanf (const char *__s, const char *__fmt, _G_va_list __arg)
+{
+  return __vsscanf (__s, __fmt, __arg);
+}
+#endif /* Optimizing.  */
+#endif /* Use GNU.  */
+
+
+/* Read a character from STREAM.  */
+extern int fgetc __P ((FILE *__stream));
+extern int getc __P ((FILE *__stream));
+
+/* Read a character from stdin.  */
+extern int getchar __P ((void));
+
+/* The C standard explicitly says this is a macro, so we always do the
+   optimization for it.  */
+#define getc(_fp) _IO_getc (_fp)
+
+#ifdef __OPTIMIZE__
+extern __inline int
+getchar (void)
+{
+  return _IO_getc (stdin);
+}
+#endif /* Optimizing.  */
+
 #if defined __USE_POSIX || defined __USE_MISC
 /* These are defined in POSIX.1:1996.  */
-extern void flockfile __P ((FILE *));
-extern void funlockfile __P ((FILE *));
-extern int ftrylockfile __P ((FILE *));
-
-extern int getc_unlocked __P ((FILE *));
+extern int getc_unlocked __P ((FILE *__stream));
 extern int getchar_unlocked __P ((void));
-extern int putc_unlocked __P ((int, FILE *));
-extern int putchar_unlocked __P ((int));
-
-# ifndef _LIBC
-#  define getc_unlocked(fp) _IO_getc_unlocked (fp)
-#  define getchar_unlocked() _IO_getc_unlocked (stdin)
-#  define putc_unlocked(c, fp) _IO_putc_unlocked ((c), (fp))
-#  define putchar_unlocked(c) _IO_putc_unlocked ((c), stdout)
-# endif
-#endif /* POSIX || misc */
 
-#define getc(_fp) _IO_getc (_fp)
+#ifdef __OPTIMIZE__
+extern __inline int
+getc_unlocked (FILE *__fp)
+{
+  return _IO_getc_unlocked (__fp);
+}
+
+extern __inline int
+getchar_unlocked (void)
+{
+  return _IO_getc_unlocked (stdin);
+}
+#endif /* Optimizing.  */
+#endif /* Use POSIX or MISC.  */
+
+
+/* Write a character to STREAM.  */
+extern int fputc __P ((int __c, FILE *__stream));
+extern int putc __P ((int __c, FILE *__stream));
+
+/* Write a character to stdout.  */
+extern int putchar __P ((int __c));
+
+/* The C standard explicitly says this can be a macro,
+   so we always do the optimization for it.  */
 #define putc(_ch, _fp) _IO_putc (_ch, _fp)
-#define putchar(_ch) _IO_putc (_ch, stdout)
-#define getchar() _IO_getc (stdin)
 
+#ifdef __OPTIMIZE__
+extern __inline int
+putchar (int __c)
+{
+  return _IO_putc (__c, stdout);
+}
+#endif
 
-#ifdef __cplusplus
+#ifdef __USE_MISC
+/* Faster version when locking is not necessary.  */
+extern int fputc_unlocked __P ((int __c, FILE *__stream));
+
+#ifdef __OPTIMIZE__
+extern __inline int
+fputc_unlocked (int __c, FILE *__stream)
+{
+  return _IO_putc_unlocked (__c, __stream);
 }
+#endif /* Optimizing.  */
+#endif /* Use MISC.  */
+
+#if defined __USE_POSIX || defined __USE_MISC
+/* These are defined in POSIX.1:1996.  */
+extern int putc_unlocked __P ((int __c, FILE *__stream));
+extern int putchar_unlocked __P ((int __c));
+
+#ifdef __OPTIMIZE__
+extern __inline int
+putc_unlocked (int __c, FILE *__stream)
+{
+  return _IO_putc_unlocked (__c, __stream);
+}
+
+extern __inline int
+putchar_unlocked (int __c)
+{
+  return _IO_putc_unlocked (__c, stdout);
+}
+#endif /* Optimizing.  */
+#endif /* Use POSIX or MISc.  */
+
+
+#if defined __USE_SVID || defined __USE_MISC
+/* Get a word (int) from STREAM.  */
+extern int getw __P ((FILE *__stream));
+
+/* Write a word (int) to STREAM.  */
+extern int putw __P ((int __w, FILE *__stream));
 #endif
 
 
+/* Get a newline-terminated string of finite length from STREAM.  */
+extern char *fgets __P ((char *__restrict __s, int __n,
+                        FILE *__restrict __stream));
+
+/* Get a newline-terminated string from stdin, removing the newline.
+   DO NOT USE THIS FUNCTION!!  There is no limit on how much it will read.  */
+extern char *gets __P ((char *__s));
+
+
+#ifdef __USE_GNU
+/* Read up to (and including) a DELIMITER from STREAM into *LINEPTR
+   (and null-terminate it). *LINEPTR is a pointer returned from malloc (or
+   NULL), pointing to *N characters of space.  It is realloc'd as
+   necessary.  Returns the number of characters read (not including the
+   null terminator), or -1 on error or EOF.  */
+_IO_ssize_t __getdelim __P ((char **__lineptr, size_t *__n,
+                            int __delimiter, FILE *__stream));
+_IO_ssize_t getdelim __P ((char **__lineptr, size_t *__n,
+                          int __delimiter, FILE *__stream));
+
+/* Like `getdelim', but reads up to a newline.  */
+_IO_ssize_t __getline __P ((char **__lineptr, size_t *__n, FILE *__stream));
+_IO_ssize_t getline __P ((char **__lineptr, size_t *__n, FILE *__stream));
+
+#ifdef __OPTIMIZE__
+extern __inline _IO_ssize_t
+getline (char **__lineptr, size_t *__n, FILE *__stream)
+{
+  return __getdelim (__lineptr, __n, '\n', __stream);
+}
+#endif /* Optimizing.  */
+#endif
+
+
+/* Write a string to STREAM.  */
+extern int fputs __P ((__const char *__restrict __s,
+                      FILE *__restrict __stream));
+/* Write a string, followed by a newline, to stdout.  */
+extern int puts __P ((__const char *__s));
+
+
+/* Push a character back onto the input buffer of STREAM.  */
+extern int ungetc __P ((int __c, FILE *__stream));
+
+
+/* Read chunks of generic data from STREAM.  */
+extern size_t fread __P ((void *__restrict __ptr, size_t __size,
+                         size_t __n, FILE *__restrict __stream));
+/* Write chunks of generic data to STREAM.  */
+extern size_t fwrite __P ((__const void *__restrict __ptr, size_t __size,
+                          size_t __n, FILE *__restrict __s));
+
+#ifdef __USE_MISC
+/* Faster versions when locking is not necessary.  */
+extern size_t fread_unlocked __P ((void *__restrict __ptr, size_t __size,
+                                  size_t __n, FILE *__restrict __stream));
+extern size_t fwrite_unlocked __P ((__const void *__restrict __ptr,
+                                   size_t __size, size_t __n,
+                                   FILE *__restrict __stream));
+#endif
+
+
+/* Seek to a certain position on STREAM.  */
+extern int fseek __P ((FILE *__stream, long int __off, int __whence));
+/* Return the current position of STREAM.  */
+extern long int ftell __P ((FILE *__stream));
+/* Rewind to the beginning of STREAM.  */
+extern void rewind __P ((FILE *__stream));
+
+/* Get STREAM's position.  */
+extern int fgetpos __P ((FILE *__restrict __stream,
+                        fpos_t *__restrict __pos));
+/* Set STREAM's position.  */
+extern int fsetpos __P ((FILE *__stream, __const fpos_t *__pos));
+
+
+/* Clear the error and EOF indicators for STREAM.  */
+extern void clearerr __P ((FILE *__stream));
+/* Return the EOF indicator for STREAM.  */
+extern int feof __P ((FILE *__stream));
+/* Return the error indicator for STREAM.  */
+extern int ferror __P ((FILE *__stream));
+
+#ifdef __USE_MISC
+/* Faster versions when locking is not required.  */
+extern void clearerr_unlocked __P ((FILE *__stream));
+extern int feof_unlocked __P ((FILE *__stream));
+extern int ferror_unlocked __P ((FILE *__stream));
+
+#ifdef __OPTIMIZE__
+extern __inline int
+feof_unlocked (FILE *__stream)
+{
+  return _IO_feof_unlocked (__stream);
+}
+
+extern __inline int
+ferror_unlocked (FILE *__stream)
+{
+  return _IO_ferror_unlocked (__stream);
+}
+#endif /* Optimizing.  */
+#endif
+
+
+/* Print a message describing the meaning of the value of errno.  */
+extern void perror __P ((__const char *__s));
+
+/* These variables normally should not be used directly.  The `strftime'
+   function provides all the needed functionality.  */
+#ifdef __USE_BSD
+extern int sys_nerr;
+extern __const char *__const sys_errlist[];
+#endif
+#ifdef __USE_GNU
+extern int _sys_nerr;
+extern __const char *__const _sys_errlist[];
+#endif
+
+
+#ifdef __USE_POSIX
+/* Return the system file descriptor for STREAM.  */
+extern int fileno __P ((FILE *__stream));
+#endif /* Use POSIX.  */
+
+#ifdef __USE_MISC
+/* Faster version when locking is not required.  */
+extern int fileno_unlocked __P ((FILE *__stream));
+#endif
+
+
+#if (defined __USE_POSIX2 || defined __USE_SVID  || defined __USE_BSD || \
+     defined __USE_MISC)
+/* Create a new stream connected to a pipe running the given command.  */
+extern FILE *popen __P ((__const char *__command, __const char *__modes));
+
+/* Close a stream opened by popen and return the status of its child.  */
+extern int pclose __P ((FILE *__stream));
+#endif
+
+
+#ifdef __USE_POSIX
+/* Return the name of the controlling terminal.  */
+extern char *ctermid __P ((char *__s));
+#endif /* Use POSIX.  */
+
+
+#ifdef __USE_XOPEN
+/* Return the name of the current user.  */
+extern char *cuserid __P ((char *__s));
+#endif /* Use X/Open.  */
+
+
+#ifdef __USE_GNU
+struct obstack;                        /* See <obstack.h>.  */
+
+/* Write formatted output to an obstack.  */
+extern int obstack_printf __P ((struct obstack *__obstack,
+                               __const char *__format, ...));
+extern int obstack_vprintf __P ((struct obstack *__obstack,
+                                __const char *__format,
+                                _G_va_list __args));
+#endif /* Use GNU.  */
+
+
+#if defined __USE_POSIX || defined __USE_MISC
+/* These are defined in POSIX.1:1996.  */
+
+/* Acquire ownership of STREAM.  */
+extern void flockfile __P ((FILE *__stream));
+
+/* Try to acquire ownership of STREAM but do not block if it is not
+   possible.  */
+extern int ftrylockfile __P ((FILE *__stream));
+
+/* Relinquish the ownership granted for STREAM.  */
+extern void funlockfile __P ((FILE *__stream));
+#endif /* POSIX || misc */
+
+__END_DECLS
+
+#endif /* <stdio.h> included.  */
 
 #endif /* !_STDIO_H */
index 70ee89a1920cf82102f6d0841f637dcaced7aab8..095d097e2baa064b5954cb7c2b36dbdc050134ce 100644 (file)
@@ -27,7 +27,7 @@ const struct locale_data _nl_C_LC_TIME =
   _nl_C_name,
   NULL, 0, 0, /* no file mapped */
   MAX_USAGE_COUNT,
-  53,
+  54,
   {
     { string: "Sun" },
     { string: "Mon" },
@@ -80,6 +80,7 @@ const struct locale_data _nl_C_LC_TIME =
     { string: "" },
     { string: "" },
     { word: 0 },
+    { word: 0 },
     { string: "" },
     { string: "" },
   }
index e2157311c1a4ed597cd706ecef84ad6c56a5d10f..7b0aaaa60f7356a958d6ee1c9dd29f3cef5d4557 100644 (file)
@@ -166,6 +166,8 @@ static void show_info (const char *name);
 int
 main (int argc, char *argv[])
 {
+  int remaining;
+
   /* Set initial values for global variables.  */
   show_category_name = 0;
   show_keyword_name = 0;
@@ -179,7 +181,7 @@ main (int argc, char *argv[])
   textdomain (PACKAGE);
 
   /* Parse and process arguments.  */
-  argp_parse (&argp, argc, argv, 0, 0, NULL);
+  argp_parse (&argp, argc, argv, 0, &remaining, NULL);
 
   /* `-a' requests the names of all available locales.  */
   if (do_all != 0)
@@ -203,15 +205,15 @@ main (int argc, char *argv[])
 
   /* If no real argument is given we have to print the contents of the
      current locale definition variables.  These are LANG and the LC_*.  */
-  if (optind == argc && show_keyword_name == 0 && show_category_name == 0)
+  if (remaining == argc && show_keyword_name == 0 && show_category_name == 0)
     {
       show_locale_vars ();
       exit (EXIT_SUCCESS);
     }
 
   /* Process all given names.  */
-  while (optind <  argc)
-    show_info (argv[optind++]);
+  while (remaining <  argc)
+    show_info (argv[remaining++]);
 
   exit (EXIT_SUCCESS);
 }
index 656377f9df446d10d841fc8fc8b4309b21356960..e8f0d3bc54d3cb09924cfa5b142218822d7eb764 100644 (file)
@@ -148,6 +148,7 @@ main (int argc, char *argv[])
   struct charset_t *charset;
   struct localedef_t *localedef;
   struct copy_def_list_t *act_add_locdef;
+  int remaining;
 
   /* Set initial values for global variables.  */
   copy_list = NULL;
@@ -163,7 +164,7 @@ main (int argc, char *argv[])
   textdomain (_libc_intl_domainname);
 
   /* Parse and process arguments.  */
-  argp_parse (&argp, argc, argv, 0, 0, NULL);
+  argp_parse (&argp, argc, argv, 0, &remaining, NULL);
 
   /* XXX POSIX is violated since for unknown option a exit value > 3
      must be used.  */
@@ -172,7 +173,7 @@ main (int argc, char *argv[])
      character map.  */
   verbose |= posix_conformance;
 
-  if (argc - optind != 1)
+  if (argc - remaining != 1)
     {
       /* We need exactly one non-option parameter.  */
       argp_help (&argp, stdout, ARGP_HELP_SEE,
@@ -185,7 +186,7 @@ main (int argc, char *argv[])
 
   /* The parameter describes the output path of the constructed files.
      If the described files cannot be written return a NULL pointer.  */
-  output_path  = construct_output_path (argv[optind]);
+  output_path  = construct_output_path (argv[remaining]);
   cannot_write_why = errno;
 
   /* Now that the parameters are processed we have to reset the local
index 0380527f64fd45666d8961f2bd9fa9db5fc037dd..6b4fc72b200a6432b7b4ceb145b2f8bc9011fa1c 100644 (file)
@@ -19,7 +19,7 @@
    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
-/* V2.6.4-pt2 Sat Dec 14 1996
+/* V2.6.4-pt3 Thu Feb 20 1997
 
   This work is mainly derived from malloc-2.6.4 by Doug Lea
   <dl@cs.oswego.edu>, which is available from:
@@ -874,6 +874,8 @@ extern Void_t*     sbrk();
 #define mALLOC_STATs    __malloc_stats
 #define mALLOC_USABLE_SIZe __malloc_usable_size
 #define mALLOC_TRIm     __malloc_trim
+#define mALLOC_GET_STATe __malloc_get_state
+#define mALLOC_SET_STATe __malloc_set_state
 
 #else
 
@@ -889,6 +891,8 @@ extern Void_t*     sbrk();
 #define mALLOC_STATs    malloc_stats
 #define mALLOC_USABLE_SIZe malloc_usable_size
 #define mALLOC_TRIm     malloc_trim
+#define mALLOC_GET_STATe malloc_get_state
+#define mALLOC_SET_STATe malloc_set_state
 
 #endif
 
@@ -912,7 +916,11 @@ size_t  mALLOC_USABLE_SIZe(Void_t*);
 void    mALLOC_STATs(void);
 int     mALLOPt(int, int);
 struct mallinfo mALLINFo(void);
-#else
+Void_t* mALLOC_GET_STATe(void);
+int     mALLOC_SET_STATe(Void_t*);
+
+#else /* !__STD_C */
+
 #ifndef _LIBC
 void    ptmalloc_init();
 #endif
@@ -929,7 +937,10 @@ size_t  mALLOC_USABLE_SIZe();
 void    mALLOC_STATs();
 int     mALLOPt();
 struct mallinfo mALLINFo();
-#endif
+Void_t* mALLOC_GET_STATe();
+int     mALLOC_SET_STATe();
+
+#endif /* __STD_C */
 
 
 #ifdef __cplusplus
@@ -3775,6 +3786,144 @@ int mALLOPt(param_number, value) int param_number; int value;
 
 \f
 
+/* Get/set state: malloc_get_state() records the current state of all
+   malloc variables (_except_ for the actual heap contents and `hook'
+   function pointers) in a system dependent, opaque data structure.
+   This data structure is dynamically allocated and can be free()d
+   after use.  malloc_set_state() restores the state of all malloc
+   variables to the previously obtained state.  This is especially
+   useful when using this malloc as part of a shared library, and when
+   the heap contents are saved/restored via some other method.  The
+   primary example for this is GNU Emacs with its `dumping' procedure.
+   `Hook' function pointers are never saved or restored by these
+   functions. */
+
+#define MALLOC_STATE_MAGIC   0x444c4541l
+#define MALLOC_STATE_VERSION (0*0x100l + 0l) /* major*0x100 + minor */
+
+struct malloc_state {
+  long          magic;
+  long          version;
+  mbinptr       av[NAV * 2 + 2];
+  char*         sbrk_base;
+  int           sbrked_mem_bytes;
+  unsigned long trim_threshold;
+  unsigned long top_pad;
+  unsigned int  n_mmaps_max;
+  unsigned long mmap_threshold;
+  int           check_action;
+  unsigned long max_sbrked_mem;
+  unsigned long max_total_mem;
+  unsigned int  n_mmaps;
+  unsigned int  max_n_mmaps;
+  unsigned long mmapped_mem;
+  unsigned long max_mmapped_mem;
+};
+
+Void_t*
+mALLOC_GET_STATe()
+{
+  mchunkptr victim;
+  struct malloc_state* ms;
+  int i;
+  mbinptr b;
+
+  ptmalloc_init();
+  (void)mutex_lock(&main_arena.mutex);
+  victim = chunk_alloc(&main_arena, request2size(sizeof(*ms)));
+  if(!victim) {
+    (void)mutex_unlock(&main_arena.mutex);
+    return 0;
+  }
+  ms = (struct malloc_state*)chunk2mem(victim);
+  ms->magic = MALLOC_STATE_MAGIC;
+  ms->version = MALLOC_STATE_VERSION;
+  ms->av[0] = main_arena.av[0];
+  ms->av[1] = main_arena.av[1];
+  for(i=0; i<NAV; i++) {
+    b = bin_at(&main_arena, i);
+    if(first(b) == b)
+      ms->av[2*i+2] = ms->av[2*i+3] = 0; /* empty bin (or initial top) */
+    else {
+      ms->av[2*i+2] = first(b);
+      ms->av[2*i+3] = last(b);
+    }
+  }
+  ms->sbrk_base = sbrk_base;
+  ms->sbrked_mem_bytes = sbrked_mem;
+  ms->trim_threshold = trim_threshold;
+  ms->top_pad = top_pad;
+  ms->n_mmaps_max = n_mmaps_max;
+  ms->mmap_threshold = mmap_threshold;
+  ms->check_action = check_action;
+  ms->max_sbrked_mem = max_sbrked_mem;
+#ifdef NO_THREADS
+  ms->max_total_mem = max_total_mem;
+#else
+  ms->max_total_mem = 0;
+#endif
+  ms->n_mmaps = n_mmaps;
+  ms->max_n_mmaps = max_n_mmaps;
+  ms->mmapped_mem = mmapped_mem;
+  ms->max_mmapped_mem = max_mmapped_mem;
+  (void)mutex_unlock(&main_arena.mutex);
+  return (Void_t*)ms;
+}
+
+int
+#if __STD_C
+mALLOC_SET_STATe(Void_t* msptr)
+#else
+mALLOC_SET_STATe(msptr) Void_t* msptr;
+#endif
+{
+  struct malloc_state* ms = (struct malloc_state*)msptr;
+  int i;
+  mbinptr b;
+
+  ptmalloc_init();
+  if(ms->magic != MALLOC_STATE_MAGIC) return -1;
+  /* Must fail if the major version is too high. */
+  if((ms->version & ~0xffl) > (MALLOC_STATE_VERSION & ~0xffl)) return -2;
+  (void)mutex_lock(&main_arena.mutex);
+  main_arena.av[0] = ms->av[0];
+  main_arena.av[1] = ms->av[1];
+  for(i=0; i<NAV; i++) {
+    b = bin_at(&main_arena, i);
+    if(ms->av[2*i+2] == 0)
+      first(b) = last(b) = b;
+    else {
+      first(b) = ms->av[2*i+2];
+      last(b) = ms->av[2*i+3];
+      if(i > 0) {
+        /* Make sure the links to the `av'-bins in the heap are correct. */
+        first(b)->bk = b;
+        last(b)->fd = b;
+      }
+    }
+  }
+  sbrk_base = ms->sbrk_base;
+  sbrked_mem = ms->sbrked_mem_bytes;
+  trim_threshold = ms->trim_threshold;
+  top_pad = ms->top_pad;
+  n_mmaps_max = ms->n_mmaps_max;
+  mmap_threshold = ms->mmap_threshold;
+  check_action = ms->check_action;
+  max_sbrked_mem = ms->max_sbrked_mem;
+#ifdef NO_THREADS
+  max_total_mem = ms->max_total_mem;
+#endif
+  n_mmaps = ms->n_mmaps;
+  max_n_mmaps = ms->max_n_mmaps;
+  mmapped_mem = ms->mmapped_mem;
+  max_mmapped_mem = ms->max_mmapped_mem;
+  /* add version-dependent code here */
+  (void)mutex_unlock(&main_arena.mutex);
+  return 0;
+}
+
+\f
+
 #if defined(_LIBC) || defined(MALLOC_HOOKS)
 
 /* A simple, standard set of debugging hooks.  Overhead is `only' one
@@ -4048,12 +4197,19 @@ weak_alias (__libc_mallopt, __mallopt) weak_alias (__libc_mallopt, mallopt)
 weak_alias (__malloc_stats, malloc_stats)
 weak_alias (__malloc_usable_size, malloc_usable_size)
 weak_alias (__malloc_trim, malloc_trim)
+weak_alias (__malloc_get_state, malloc_get_state)
+weak_alias (__malloc_set_state, malloc_set_state)
 #endif
 
 /*
 
 History:
 
+    V2.6.4-pt3 Thu Feb 20 1997 Wolfram Gloger (wmglo@dent.med.uni-muenchen.de)
+      * Added malloc_get/set_state() (mainly for use in GNU emacs),
+        using interface from Marcus Daniels
+      * All parameters are now adjustable via environment variables
+
     V2.6.4-pt2 Sat Dec 14 1996 Wolfram Gloger (wmglo@dent.med.uni-muenchen.de)
       * Added debugging hooks
       * Fixed possible deadlock in realloc() when out of memory
index b27d06252c25de3f4175c3042095c5f252645e0d..53b9d1b2066a3c749286054e64b72a039abccf8b 100644 (file)
@@ -171,6 +171,13 @@ extern size_t malloc_usable_size __MALLOC_P ((__malloc_ptr_t __ptr));
 /* Prints brief summary statistics on stderr. */
 extern void malloc_stats __MALLOC_P ((void));
 
+/* Record the state of all malloc variables in an opaque data structure. */
+extern __malloc_ptr_t malloc_get_state __MALLOC_P ((void));
+
+/* Restore the state of all malloc variables from data obtained with
+   malloc_get_state(). */
+extern int malloc_set_state __MALLOC_P ((__malloc_ptr_t __ptr));
+
 #if defined(__GLIBC__) || defined(MALLOC_HOOKS)
 
 /* Hooks for debugging versions. */
index 10da26ba32cca7e0ce8f39fcb926bdb1d2b65ba0..8307f256ff907799b3dfc1b1f67c6d2532b0a8af 100644 (file)
@@ -1,6 +1,6 @@
 /* Basic platform-independent macro definitions for mutexes and
    thread-specific data.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Wolfram Gloger <wmglo@dent.med.uni-muenchen.de>, 1996.
 
@@ -66,19 +66,37 @@ static Void_t *malloc_key_data;
    (__pthread_mutex_unlock != NULL ? __pthread_mutex_unlock (m) : 0)
 
 #elif defined(MUTEX_INITIALIZER)
+/* Assume hurd, with cthreads */
 
-typedef thread_t thread_id;
+/* Cthreads `mutex_t' is a pointer to a mutex, and malloc wants just the
+   mutex itself.  */
+#undef mutex_t
+#define mutex_t struct mutex
 
-/* mutex */
-typedef mutex_t        mutex_t;
+#undef mutex_lock
+#define mutex_lock(m) (__mutex_lock(m), 0)
+
+#undef mutex_unlock
+#define mutex_unlock(m) (__mutex_unlock(m), 0)
+
+#define mutex_trylock(m) (!__mutex_trylock(m))
+
+#include <hurd/threadvar.h>
 
 /* thread specific data */
-typedef pthread_key_t tsd_key_t;
+typedef int tsd_key_t;
+
+static int tsd_keys_alloced = 0;
+
+#define tsd_key_create(key, destr) \
+  (assert (tsd_keys_alloced == 0), tsd_keys_alloced++)
+#define tsd_setspecific(key, data) \
+  (*__hurd_threadvar_location (_HURD_THREADVAR_MALLOC) = (unsigned long)(data))
+#define tsd_getspecific(key, vptr) \
+  ((vptr) = (void *)*__hurd_threadvar_location (_HURD_THREADVAR_MALLOC))
 
-#define mutex_init(m)          __mutex_init (m)
-#define mutex_lock(m)          __mutex_lock (m)
-#define mutex_trylock(m)       __mutex_trylock (m)
-#define mutex_unlock(m)                __mutex_unlock (m)
+/* No we're *not* using pthreads.  */
+#define __pthread_initialize ((void (*)(void))0)
 
 #else
 
diff --git a/manual/stdio-fp.c b/manual/stdio-fp.c
new file mode 100644 (file)
index 0000000..db94807
--- /dev/null
@@ -0,0 +1,28 @@
+/* This program is to generate one of the examples in stdio.texi.  */
+
+#include <stdio.h>
+
+
+static void
+print (double v)
+{
+  printf ("|%13.4a|%13.4f|%13.4e|%13.4g|\n", v, v, v, v);
+}
+
+
+int
+main (void)
+{
+  print (0.0);
+  print (0.5);
+  print (1.0);
+  print (-1.0);
+  print (100.0);
+  print (1000.0);
+  print (10000.0);
+  print (12345.0);
+  print (100000.0);
+  print (123456.0);
+
+  return 0;
+}
index e922fd17d87feae263066be096980ebc2866027c..04c635b054f3db57bcf7299dcf22ad2f74edf517 100644 (file)
@@ -1007,6 +1007,12 @@ whichever is more appropriate for its magnitude.  @samp{%g} uses
 lower-case letters and @samp{%G} uses upper-case.  @xref{Floating-Point
 Conversions}, for details.
 
+@item @samp{%a}, @samp{%A}
+Print a floating-point number in a hexadecimal fractional notation which
+the exponent to base 2 represented in decimal digits.  @samp{%a} uses
+lower-case letters and @samp{%A} uses upper-case.  @xref{Floating-Point
+Conversions}, for details.
+
 @item @samp{%c}
 Print a single character.  @xref{Other Output Conversions}.
 
@@ -1194,6 +1200,34 @@ than -4 or greater than or equal to the precision; otherwise they use the
 of the result and a decimal-point character appears only if it is
 followed by a digit.
 
+The @samp{%a} and @samp{%A} conversions are meant for representing
+floating-point number exactly in textual form so that they can be
+exchanged as texts between different programs and/or machines.  The
+numbers are represented is the form
+@w{[@code{-}]@code{0x}@var{h}@code{.}@var{hhh}@code{p}[@code{+}|@code{-}]@var{dd}}.
+At the left of the decimal-point character exactly one digit is print.
+This character is only @code{0} is the number is denormalized.
+Otherwise the value is unspecifed; it is implemention dependent how many
+bits are used.  The number of hexadecimal digits on the right side of
+the decimal-point character is equal to the precision.  If the precision
+is zero it is determined to be large enough to provide an exact
+representation of the number (or it is large enough to distinguish two
+adjacent values if the @code{FLT_RADIX} is not a power of 2,
+@pxref{Floating Point Parameters})  For the @samp{%a} conversion
+lower-case characters are used to represent the hexadecimal number and
+the prefix and exponent sign are printed as @code{0x} and @code{p}
+respectively.  Otherwise upper-case characters are used and @code{0X}
+and @code{P} are used for the representation of prefix and exponent
+string.  The exponent to the base of two is printed as a decimal number
+using at least one digit but at most as many digits as necessary to
+represent the value exactly.
+
+If the value to be printed represents infinity or a NaN, the output is
+@w{[@code{-}]@code{inf}} or @code{nan} respectively if the conversion
+specifier is @samp{%a}, @samp{%e}, @samp{%f}, or @samp{%g} and it is
+@w{[@code{-}]@code{INF}} or @code{NAN} respectively if the conversion is
+@samp{%A}, @samp{%E}, or @samp{%G}.
+
 The following flags can be used to modify the behavior:
 
 @comment We use @asis instead of @samp so we can have ` ' as an item.
@@ -1255,21 +1289,22 @@ floating-point conversions.  All of the numbers were printed using
 this template string:
 
 @smallexample
-"|%12.4f|%12.4e|%12.4g|\n"
+"|%13.4a|%13.4f|%13.4e|%13.4g|\n"
 @end smallexample
 
 Here is the output:
 
 @smallexample
-|      0.0000|  0.0000e+00|           0|
-|      1.0000|  1.0000e+00|           1|
-|     -1.0000| -1.0000e+00|          -1|
-|    100.0000|  1.0000e+02|         100|
-|   1000.0000|  1.0000e+03|        1000|
-|  10000.0000|  1.0000e+04|       1e+04|
-|  12345.0000|  1.2345e+04|   1.234e+04|
-| 100000.0000|  1.0000e+05|       1e+05|
-| 123456.0000|  1.2346e+05|   1.234e+05|
+|  0x0.0000p+0|       0.0000|   0.0000e+00|            0|
+|  0x1.0000p-1|       0.5000|   5.0000e-01|          0.5|
+|  0x1.0000p+0|       1.0000|   1.0000e+00|            1|
+| -0x1.0000p+0|      -1.0000|  -1.0000e+00|           -1|
+|  0x1.9000p+6|     100.0000|   1.0000e+02|          100|
+|  0x1.f400p+9|    1000.0000|   1.0000e+03|         1000|
+| 0x1.3880p+13|   10000.0000|   1.0000e+04|        1e+04|
+| 0x1.81c8p+13|   12345.0000|   1.2345e+04|    1.234e+04|
+| 0x1.86a0p+16|  100000.0000|   1.0000e+05|        1e+05|
+| 0x1.e240p+16|  123456.0000|   1.2346e+05|    1.235e+05|
 @end smallexample
 
 Notice how the @samp{%g} conversion drops trailing zeros.
index b713163f7695099e58d032312fd9d6b20d3d92ab..eb8a4f202d9fae463ee9da4c2bbf3ee3ec9f7e8a 100644 (file)
@@ -1,5 +1,5 @@
 /* Declarations for math functions.
-   Copyright (C) 1991, 92, 93, 95, 96 Free Software Foundation, Inc.
+   Copyright (C) 1991, 92, 93, 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
@@ -99,9 +99,12 @@ extern _LIB_VERSION_TYPE _LIB_VERSION;
 #endif
 
 
-#ifdef __USE_SVID
+#if defined __USE_SVID && !defined __cplusplus
 /* In SVID error handling, `matherr' is called with this description
-   of the exceptional condition.  */
+   of the exceptional condition.
+
+   We have a problem when using C++ since `exception' is reserved in
+   C++.  */
 struct exception
   {
     int type;
@@ -128,7 +131,7 @@ extern int matherr __P ((struct exception *));
 #define HUGE           FLT_MAX
 #include <float.h>             /* Defines FLT_MAX.  */
 
-#endif
+#endif /* SVID && !C++ */
 
 
 #ifdef __USE_BSD
index 2a7df0210d7340b6d52b7cd1073932da5f26a29e..f49e4a7983fdddc888d43f5116fb2cb2dc6d9499 100644 (file)
@@ -71,6 +71,11 @@ unsigned int error_message_count;
 #define program_name program_invocation_name
 #include <errno.h>
 
+/* In GNU libc we want do not want to use the common name `error' directly.
+   Instead make it a weak alias.  */
+#define error __error
+#define error_at_line __error_at_line
+
 #else
 
 /* The calling program should define program_name and set it to the
@@ -230,3 +235,11 @@ error_at_line (status, errnum, file_name, line_number, message, va_alist)
   if (status)
     exit (status);
 }
+
+#ifdef _LIBC
+/* Make the weak alias.  */
+#undef error
+#undef error_at_line
+weak_alias (__error, error)
+weak_alias (__error_at_line, error_at_line)
+#endif
index e90dd0f220e986758f8690d00cf452486d5c004b..f9dcce4c8d194f2f736715ec99f2b4bce42a9789 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 93, 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
 #define __attribute__(xyz)     /* Ignore.  */
 #endif
 
+
+/* For now no version of gcc knows the `restrict' keyword.  Define it
+   for now unconditionally to the empty string.  */
+#define __restrict
+
 #endif  /* sys/cdefs.h */
index 61f18c4146e150fa846226a54793073fc7dc6945..abe758a9976e922aadf59c088a335ebe4b2ccbfc 100755 (executable)
--- a/rellns-sh
+++ b/rellns-sh
@@ -1,6 +1,6 @@
 #! /bin/sh
 # rellns-sh - Simplified ln program to generate relative symbolic link.
-# Copyright (C) 1996 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997 Free Software Foundation, Inc.
 # Written by Ulrich Drepper <drepper@cygnus.com>, October 1996
 #
 # This program is free software; you can redistribute it and/or modify
@@ -22,12 +22,6 @@ if test $# -ne 2; then
   exit 1
 fi
 
-# We only handle the case where SOURCE is the name of an existing file
-if test ! -f $1; then
-  echo "rellns: $1 must name an existing file" >&2
-  exit 1
-fi
-
 case $1 in
 /*)
   # Make both paths absolute.
index 814374b8aebe1453941c8fdc56ac444c4289a334..d1d922ed36491e9ca65dc741e80a56cd3d4b5544 100644 (file)
@@ -25,7 +25,7 @@ headers       := stdio_lim.h printf.h
 
 routines       :=                                                            \
        ctermid cuserid                                                       \
-       vfprintf vprintf printf_fp reg-printf printf-prs _itoa                \
+       vfprintf vprintf printf_fp reg-printf printf-prs _itoa printf_fphex   \
        fprintf printf snprintf sprintf asprintf dprintf                      \
        vfscanf                                                               \
        fscanf scanf sscanf                                                   \
index dede144b8d7d45c7ef8a40ffd3854e1205ec21bb..8cff7a4d665a989bce91507dd81277df6108039e 100644 (file)
@@ -1,5 +1,5 @@
 /* Floating point output for `printf'.
-   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
 
@@ -291,12 +291,12 @@ __printf_fp (FILE *fp,
       /* Check for special values: not a number or infinity.  */
       if (__isnanl (fpnum.ldbl))
        {
-         special = "NaN";
+         special = isupper (info->spec) ? "NAN" : "nan";
          is_neg = 0;
        }
       else if (__isinfl (fpnum.ldbl))
        {
-         special = "Inf";
+         special = isupper (info->spec) ? "INF" : "inf";
          is_neg = fpnum.ldbl < 0;
        }
       else
@@ -316,12 +316,12 @@ __printf_fp (FILE *fp,
       /* Check for special values: not a number or infinity.  */
       if (__isnan (fpnum.dbl))
        {
-         special = "NaN";
+         special = isupper (info->spec) ? "NAN" : "nan";
          is_neg = 0;
        }
       else if (__isinf (fpnum.dbl))
        {
-         special = "Inf";
+         special = isupper (info->spec) ? "INF" : "inf";
          is_neg = fpnum.dbl < 0;
        }
       else
diff --git a/stdio-common/printf_fphex.c b/stdio-common/printf_fphex.c
new file mode 100644 (file)
index 0000000..d442b56
--- /dev/null
@@ -0,0 +1,440 @@
+/* Print floating point number in hexadecimal notation according to
+   ISO C 9X.
+   Copyright (C) 1997 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Ulrich Drepper <drepper@cygnus.com>, 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.  */
+
+#include <ctype.h>
+#include <ieee754.h>
+#include <math.h>
+#include <printf.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include "_itoa.h"
+#include "../locale/localeinfo.h"
+
+/* #define NDEBUG 1*/          /* Undefine this for debugging assertions.  */
+#include <assert.h>
+
+/* This defines make it possible to use the same code for GNU C library and
+   the GNU I/O library.         */
+#ifdef USE_IN_LIBIO
+# include <libioP.h>
+# define PUT(f, s, n) _IO_sputn (f, s, n)
+# define PAD(f, c, n) _IO_padn (f, c, n)
+/* We use this file GNU C library and GNU I/O library. So make
+   names equal.         */
+# undef putc
+# define putc(c, f) _IO_putc_unlocked (c, f)
+# define size_t     _IO_size_t
+# define FILE       _IO_FILE
+#else  /* ! USE_IN_LIBIO */
+# define PUT(f, s, n) fwrite (s, 1, n, f)
+# define PAD(f, c, n) __printf_pad (f, c, n)
+ssize_t __printf_pad __P ((FILE *, char pad, int n)); /* In vfprintf.c.  */
+#endif /* USE_IN_LIBIO */
+\f
+/* Macros for doing the actual output.  */
+
+#define outchar(ch)                                                          \
+  do                                                                         \
+    {                                                                        \
+      register const int outc = (ch);                                        \
+      if (putc (outc, fp) == EOF)                                            \
+       return -1;                                                            \
+      ++done;                                                                \
+    } while (0)
+
+#define PRINT(ptr, len)                                                              \
+  do                                                                         \
+    {                                                                        \
+       int outlen = (len);                                                   \
+       const char *cp = (ptr);                                               \
+       while (outlen-- > 0)                                                  \
+        outchar (*cp++);                                                     \
+    } while (0)
+
+#define PADN(ch, len)                                                        \
+  do                                                                         \
+    {                                                                        \
+      if (PAD (fp, ch, len) != len)                                          \
+       return -1;                                                            \
+      done += len;                                                           \
+    }                                                                        \
+  while (0)
+\f
+
+int
+__printf_fphex (FILE *fp,
+               const struct printf_info *info,
+               const void *const *args)
+{
+  /* The floating-point value to output.  */
+  union
+    {
+      union ieee754_double dbl;
+      union ieee854_long_double ldbl;
+    }
+  fpnum;
+
+  /* Locale-dependent representation of decimal point. */
+  wchar_t decimal;
+
+  /* "NaN" or "Inf" for the special cases.  */
+  const char *special = NULL;
+
+  /* Buffer for the generated number string for the mantissa.  The
+     maximal size for the mantissa is 64 bits.  */
+  char numbuf[16];
+  char *numstr;
+  char *numend;
+  int negative;
+
+  /* The maximal exponent of two in decimal notation has 5 digits.  */
+  char expbuf[5];
+  char *expstr;
+  int expnegative;
+  int exponent;
+
+  /* Non-zero is mantissa is zero.  */
+  int zero_mantissa;
+
+  /* The leading digit before the decimal point.  */
+  char leading;
+
+  /* Precision.  */
+  int precision = info->prec;
+
+  /* Width.  */
+  int width = info->width;
+
+  /* Number of characters written.  */
+  int done = 0;
+
+
+  /* Figure out the decimal point character.  */
+  if (info->extra == 0)
+    {
+      if (mbtowc (&decimal, _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT),
+                 strlen (_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT))) <= 0)
+       decimal = (wchar_t) *_NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
+    }
+  else
+    {
+      if (mbtowc (&decimal, _NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT),
+                 strlen (_NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT))) <= 0)
+       decimal = (wchar_t) *_NL_CURRENT (LC_MONETARY, MON_DECIMAL_POINT);
+    }
+  /* Give default value.  */
+  if (decimal == L'\0')
+    decimal = L'.';
+
+
+  /* Fetch the argument value. */
+  if (info->is_long_double && sizeof (long double) > sizeof (double))
+    {
+      fpnum.ldbl.d = *(const long double *) args[0];
+
+      /* Check for special values: not a number or infinity.  */
+      if (__isnanl (fpnum.ldbl.d))
+       {
+         special = isupper (info->spec) ? "NAN" : "nan";
+         negative = 0;
+       }
+      else
+       {
+         if (__isinfl (fpnum.ldbl.d))
+           special = isupper (info->spec) ? "INF" : "inf";
+
+         negative = fpnum.ldbl.d < 0;
+       }
+    }
+  else
+    {
+      fpnum.dbl.d = *(const double *) args[0];
+
+      /* Check for special values: not a number or infinity.  */
+      if (__isnan (fpnum.dbl.d))
+       {
+         special = isupper (info->spec) ? "NAN" : "nan";
+         negative = 0;
+       }
+      else
+       {
+         if (__isinf (fpnum.dbl.d))
+           special = isupper (info->spec) ? "INF" : "inf";
+
+         negative = fpnum.dbl.d < 0;
+       }
+    }
+
+  if (special)
+    {
+      int width = info->prec > info->width ? info->prec : info->width;
+
+      if (negative || info->showsign || info->space)
+       --width;
+      width -= 3;
+
+      if (!info->left && width > 0)
+       PADN (' ', width);
+
+      if (negative)
+       outchar ('-');
+      else if (info->showsign)
+       outchar ('+');
+      else if (info->space)
+       outchar (' ');
+
+      PRINT (special, 3);
+
+      if (info->left && width > 0)
+       PADN (' ', width);
+
+      return done;
+    }
+
+  /* We are handling here only 64 and 80 bit IEEE foating point
+     numbers.  */
+  if (info->is_long_double == 0 || sizeof (double) == sizeof (long double))
+    {
+      /* We have 52 bits of mantissa plus one implicit digit.  Since
+        52 bits are representable without rest using hexadecimal
+        digits we use only the implicit digits for the number before
+        the decimal point.  */
+      if (sizeof (unsigned long int) > 6)
+       {
+         unsigned long int num;
+
+         num = (((unsigned long int) fpnum.dbl.ieee.mantissa0) << 32
+                | fpnum.dbl.ieee.mantissa1);
+
+         zero_mantissa = num == 0;
+
+         numstr = _itoa_word (num, numbuf + sizeof numbuf, 16,
+                              info->spec == 'A');
+       }
+      else
+       {
+         unsigned long long int num;
+
+         num = (((unsigned long long int) fpnum.dbl.ieee.mantissa0) << 32
+                | fpnum.dbl.ieee.mantissa1);
+
+         zero_mantissa = num == 0;
+
+         numstr = _itoa (num, numbuf + sizeof numbuf, 16, info->spec == 'A');
+       }
+
+      /* Fill with zeroes.  */
+      while (numstr > numbuf + (sizeof numbuf - 13))   /* 52 Ã· 4 = 13 */
+       *--numstr = '0';
+
+      leading = fpnum.dbl.ieee.exponent == 0 ? '0' : '1';
+
+      exponent = fpnum.dbl.ieee.exponent;
+
+      if (exponent != 0 && exponent < IEEE754_DOUBLE_BIAS)
+       {
+         expnegative = 1;
+         exponent = abs (exponent - IEEE754_DOUBLE_BIAS);
+       }
+      else
+       {
+         expnegative = 0;
+         if (exponent != 0)
+           exponent -= IEEE754_DOUBLE_BIAS;
+       }
+    }
+  else
+    {
+      /* The "strange" 80 bit format on ix86 and m68k has an explicit
+        leading digit in the 64 bit mantissa.  */
+      assert (sizeof (long double) == 12);
+
+      if (sizeof (unsigned long int) > 6)
+       {
+         unsigned long int num;
+
+         num = (((unsigned long int) fpnum.dbl.ieee.mantissa0) << 32
+                | fpnum.dbl.ieee.mantissa1);
+
+         zero_mantissa = num == 0;
+
+         numstr = _itoa_word (num, numbuf + sizeof numbuf, 16,
+                              info->spec == 'A');
+       }
+      else
+       {
+         unsigned long long int num;
+
+         num = (((unsigned long long int) fpnum.ldbl.ieee.mantissa0) << 32
+                | fpnum.ldbl.ieee.mantissa1);
+
+         zero_mantissa = num == 0;
+
+         numstr = _itoa (num, numbuf + sizeof numbuf, 16, info->spec == 'A');
+       }
+
+      /* We use a full nibble for the leading digit.  */
+      leading = *numstr++;
+
+      /* Fill with zeroes.  */
+      while (numstr > numbuf + (sizeof numbuf - 15))   /* 60 Ã· 4 = 15 */
+       *--numstr = '0';
+
+      /* We have 3 bits from the mantissa in the leading nibble.  */
+      exponent = fpnum.ldbl.ieee.exponent - 3;
+
+      if (exponent != 0 && exponent < IEEE854_LONG_DOUBLE_BIAS)
+       {
+         expnegative = 1;
+         exponent = abs (exponent - IEEE854_LONG_DOUBLE_BIAS);
+       }
+      else
+       {
+         expnegative = 0;
+         if (exponent != 0)
+           exponent -= IEEE854_LONG_DOUBLE_BIAS;
+       }
+    }
+
+  /* Look for trailing zeroes.  */
+  if (! zero_mantissa)
+    {
+      numend = numbuf + sizeof numbuf;
+      while (numend[-1] == '0')
+       --numend;
+
+      if (precision == -1)
+       precision = numend - numstr;
+      else if (precision < numend - numstr
+              && (numstr[precision] > 5
+                  || (numstr[precision] == 5
+                      && (precision + 1 < numend - numstr
+                          /* Round to even.  */
+                          || (precision > 0
+                              && ((numstr[precision - 1] & 1)
+                                  ^ (isdigit (numstr[precision - 1]) == 0)))
+                          || (precision == 0
+                              && ((leading & 1)
+                                  ^ (isdigit (leading) == 0)))))))
+       {
+         /* Round up.  */
+         int cnt = precision;
+         while (--cnt >= 0)
+           {
+             char ch = numstr[cnt];
+             /* We assume that the digits and the letters are ordered
+                like in ASCII.  This is true for the rest of GNU, too.  */
+             if (ch == '9')
+               {
+                 numstr[cnt] = info->spec;     /* This is tricky,
+                                                  think about it!  */
+                 break;
+               }
+             else if (tolower (ch) < 'f')
+               {
+                 ++numstr[cnt];
+                 break;
+               }
+             else
+               numstr[cnt] = '0';
+           }
+         if (cnt < 0)
+           {
+             /* The mantissa so far was fff...f  Now increment the
+                leading digit.  Here it is again possible that we
+                get an overflow.  */
+             if (leading == '9')
+               leading = info->spec;
+             else if (tolower (leading) < 'f')
+               ++leading;
+             else
+               {
+                 leading = 1;
+                 if (expnegative)
+                   {
+                     exponent += 4;
+                     if (exponent >= 0)
+                       expnegative = 0;
+                   }
+                 else
+                   exponent += 4;
+               }
+           }
+       }
+    }
+  else
+    numend = numstr;
+
+  /* Now we can compute the exponent string.  */
+  expstr = _itoa_word (exponent, expbuf + sizeof expbuf, 10, 0);
+
+  /* Now we have all information to compute the size.  */
+  width -= ((negative || info->showsign || info->space)
+           /* Sign.  */
+           + 2    + 1 + 1 + precision + 1 + 1
+           /* 0x    h   .   hhh         P   ExpoSign.  */
+           + ((expbuf + sizeof expbuf) - expstr));
+           /* Exponent.  */
+
+  /* A special case if when the mantissa is zero and the `#' is not
+     given.  In this case we must not print the decimal point.  */
+  if (zero_mantissa && precision == 0 && !info->alt)
+    ++width;           /* This nihilates the +1 for the decimal-point
+                          character in the following equation.  */
+
+  if (!info->left && width > 0)
+    PADN (' ', width);
+
+  if (negative)
+    outchar ('-');
+  else if (info->showsign)
+    outchar ('+');
+  else if (info->space)
+    outchar (' ');
+
+  outchar ('0');
+  outchar (info->spec == 'A' ? 'X' : 'x');
+  outchar (leading);
+
+  if (!zero_mantissa || precision != 0 || info->alt)
+    outchar (decimal);
+
+  if (!zero_mantissa || precision != 0)
+    {
+      PRINT (numstr, MIN (numend - numstr, precision));
+      if (precision > numend - numstr)
+       PADN ('0', precision - (numend - numstr));
+    }
+
+  if (info->left && info->pad == '0' && width > 0)
+    PADN ('0', width);
+
+  outchar (info->spec == 'A' ? 'P' : 'p');
+
+  outchar (expnegative ? '-' : '+');
+
+  PRINT (expstr, (expbuf + sizeof expbuf) - expstr);
+
+  if (info->left && info->pad != '0' && width > 0)
+    PADN (info->pad, width);
+
+  return done;
+}
index d76d95b1b77f1483d15f7fe99e3f6f7fd9f43868..85be441b5ba6bf9195da2bccaece097e8923e8f1 100644 (file)
@@ -140,5 +140,15 @@ main (int argc, char **argv)
   if (out != stdout)
     pclose (out);
 
+  fputs ("Test 3:\n", out);
+  {
+    int res, val, n;
+
+    res = sscanf ("-242", "%3o%n", &val, &n);
+    printf ("res = %d, val = %d, n = %d\n", res, val, n);
+    if (res != 1 || val != -20 || n != 3)
+      return 1;
+  }
+
   exit(EXIT_SUCCESS);
 }
index eda0d7bd8e2af262cf312e1028546d21f774a2c8..c206c2f0acff103f4f301a81b337bcd2f3ef139f 100644 (file)
@@ -238,7 +238,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
     /* '4' */  8, /* '5' */  8, /* '6' */  8, /* '7' */  8,
     /* '8' */  8, /* '9' */  8,            0,            0,
               0,            0,            0,            0,
-              0,            0,            0, /* 'C' */ 25,
+              0, /* 'A' */ 26,            0, /* 'C' */ 25,
               0, /* 'E' */ 19,            0, /* 'G' */ 19,
               0,            0,            0,            0,
     /* 'L' */ 12,            0,            0,            0,
@@ -246,7 +246,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
               0,            0,            0,            0,
     /* 'X' */ 18,            0, /* 'Z' */ 13,            0,
               0,            0,            0,            0,
-              0,            0,            0, /* 'c' */ 20,
+              0, /* 'a' */ 26,            0, /* 'c' */ 20,
     /* 'd' */ 15, /* 'e' */ 19, /* 'f' */ 19, /* 'g' */ 19,
     /* 'h' */ 10, /* 'i' */ 15,            0,            0,
     /* 'l' */ 11, /* 'm' */ 24, /* 'n' */ 23, /* 'o' */ 17,
@@ -270,7 +270,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
 
 #define STEP0_3_TABLE                                                        \
     /* Step 0: at the beginning.  */                                         \
-    static const void *step0_jumps[26] =                                     \
+    static const void *step0_jumps[27] =                                     \
     {                                                                        \
       REF (form_unknown),                                                    \
       REF (flag_space),                /* for ' ' */                                 \
@@ -297,10 +297,11 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
       REF (form_pointer),      /* for 'p' */                                 \
       REF (form_number),       /* for 'n' */                                 \
       REF (form_strerror),     /* for 'm' */                                 \
-      REF (form_wcharacter)    /* for 'C' */                                 \
+      REF (form_wcharacter),   /* for 'C' */                                 \
+      REF (form_floathex)      /* for 'A', 'a' */                            \
     };                                                                       \
     /* Step 1: after processing width.  */                                   \
-    static const void *step1_jumps[26] =                                     \
+    static const void *step1_jumps[27] =                                     \
     {                                                                        \
       REF (form_unknown),                                                    \
       REF (form_unknown),      /* for ' ' */                                 \
@@ -327,10 +328,11 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
       REF (form_pointer),      /* for 'p' */                                 \
       REF (form_number),       /* for 'n' */                                 \
       REF (form_strerror),     /* for 'm' */                                 \
-      REF (form_wcharacter)    /* for 'C' */                                 \
+      REF (form_wcharacter),   /* for 'C' */                                 \
+      REF (form_floathex)      /* for 'A', 'a' */                            \
     };                                                                       \
     /* Step 2: after processing precision.  */                               \
-    static const void *step2_jumps[26] =                                     \
+    static const void *step2_jumps[27] =                                     \
     {                                                                        \
       REF (form_unknown),                                                    \
       REF (form_unknown),      /* for ' ' */                                 \
@@ -357,10 +359,11 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
       REF (form_pointer),      /* for 'p' */                                 \
       REF (form_number),       /* for 'n' */                                 \
       REF (form_strerror),     /* for 'm' */                                 \
-      REF (form_wcharacter)    /* for 'C' */                                 \
+      REF (form_wcharacter),   /* for 'C' */                                 \
+      REF (form_floathex)      /* for 'A', 'a' */                            \
     };                                                                       \
     /* Step 3: after processing first 'l' modifier.  */                              \
-    static const void *step3_jumps[26] =                                     \
+    static const void *step3_jumps[27] =                                     \
     {                                                                        \
       REF (form_unknown),                                                    \
       REF (form_unknown),      /* for ' ' */                                 \
@@ -387,12 +390,13 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
       REF (form_pointer),      /* for 'p' */                                 \
       REF (form_number),       /* for 'n' */                                 \
       REF (form_strerror),     /* for 'm' */                                 \
-      REF (form_wcharacter)    /* for 'C' */                                 \
+      REF (form_wcharacter),   /* for 'C' */                                 \
+      REF (form_floathex)      /* for 'A', 'a' */                            \
     }
 
 #define STEP4_TABLE                                                          \
     /* Step 4: processing format specifier.  */                                      \
-    static const void *step4_jumps[26] =                                     \
+    static const void *step4_jumps[27] =                                     \
     {                                                                        \
       REF (form_unknown),                                                    \
       REF (form_unknown),      /* for ' ' */                                 \
@@ -419,7 +423,8 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
       REF (form_pointer),      /* for 'p' */                                 \
       REF (form_number),       /* for 'n' */                                 \
       REF (form_strerror),     /* for 'm' */                                 \
-      REF (form_wcharacter)    /* for 'C' */                                 \
+      REF (form_wcharacter),   /* for 'C' */                                 \
+      REF (form_floathex)      /* for 'A', 'a' */                            \
     }
 
 
@@ -702,6 +707,53 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
       }                                                                              \
       break;                                                                 \
                                                                              \
+    LABEL (form_floathex):                                                   \
+      {                                                                              \
+        /* FLoating point number printed as hexadecimal number.  */          \
+       extern int __printf_fphex __P ((FILE *, const struct printf_info *,   \
+                                       const void **const));                 \
+       const void *ptr;                                                      \
+       int function_done;                                                    \
+                                                                             \
+       if (fspec == NULL)                                                    \
+         {                                                                   \
+           struct printf_info info = { prec: prec,                           \
+                                       width: width,                         \
+                                       spec: spec,                           \
+                                       is_long_double: is_long_double,       \
+                                       is_short: is_short,                   \
+                                       is_long: is_long,                     \
+                                       alt: alt,                             \
+                                       space: space,                         \
+                                       left: left,                           \
+                                       showsign: showsign,                   \
+                                       group: group,                         \
+                                       pad: pad,                             \
+                                       extra: 0 };                           \
+                                                                             \
+           if (is_long_double)                                               \
+             the_arg.pa_long_double = va_arg (ap, long double);              \
+           else                                                              \
+             the_arg.pa_double = va_arg (ap, double);                        \
+           ptr = (const void *) &the_arg;                                    \
+                                                                             \
+           function_done = __printf_fphex (s, &info, &ptr);                  \
+         }                                                                   \
+       else                                                                  \
+         {                                                                   \
+           ptr = (const void *) &args_value[fspec->data_arg];                \
+                                                                             \
+           function_done = __printf_fphex (s, &fspec->info, &ptr);           \
+         }                                                                   \
+                                                                             \
+       if (function_done < 0)                                                \
+         /* Error in print handler.  */                                      \
+         return -1;                                                          \
+                                                                             \
+       done += function_done;                                                \
+      }                                                                              \
+      break;                                                                 \
+                                                                             \
     LABEL (form_character):                                                  \
       /* Character.  */                                                              \
       if (is_long)                                                           \
@@ -881,7 +933,7 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
   done = 0;
   grouping = (const char *) -1;
 #ifdef __va_copy
-  /* This macro will be available soon in gcc's <stdarg.h>.  Me need it
+  /* This macro will be available soon in gcc's <stdarg.h>.  We need it
      since on some systems `va_list' is not an integral type.  */
   __va_copy (ap_save, ap);
 #else
@@ -1405,16 +1457,16 @@ printf_unknown (FILE *s, const struct printf_info *info,
   if (info->width != 0)
     {
       w = _itoa_word (info->width, workend + 1, 10, 0);
-      while (++w <= workend)
-       outchar (*w);
+      while (w <= workend)
+       outchar (*w++);
     }
 
   if (info->prec != -1)
     {
       outchar ('.');
       w = _itoa_word (info->prec, workend + 1, 10, 0);
-      while (++w <= workend)
-       outchar (*w);
+      while (w <= workend)
+       outchar (*w++);
     }
 
   if (info->spec != '\0')
index f201c467753ed04ae1e92f786dfe8d8c7e1f2f0e..86530887515713e503f9a7d124fb2e1381d9440e 100644 (file)
@@ -841,9 +841,9 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
          if (flags & LONGDBL)
            {
              if (number_signed)
-               num.q = __strtoq_internal (wp, &tw, base, flags & GROUP);
+               num.q = __strtoll_internal (wp, &tw, base, flags & GROUP);
              else
-               num.uq = __strtouq_internal (wp, &tw, base, flags & GROUP);
+               num.uq = __strtoull_internal (wp, &tw, base, flags & GROUP);
            }
          else
            {
index bd2ffa8eb5366691bbc6319dacd834e371cae22e..b2d064483bcb80e25f09a777f91d210e79b93431 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 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
@@ -307,7 +307,7 @@ extern char *tmpnam_r __P ((char *__s));
 #endif
 
 
-#if defined(__USE_SVID) || defined(__USE_XOPEN)
+#if defined __USE_SVID || defined __USE_XOPEN
 /* Generate a unique temporary filename using up to five characters of PFX
    if it is not NULL.  The directory to put this file in is searched for
    as follows: First the environment variable "TMPDIR" is checked.
@@ -339,8 +339,9 @@ extern int fcloseall __P ((void));
 /* Open a file and create a new stream for it.  */
 extern FILE *fopen __P ((__const char *__filename, __const char *__modes));
 /* Open a file, replacing an existing stream with it. */
-extern FILE *freopen __P ((__const char *__filename,
-                          __const char *__modes, FILE *__stream));
+extern FILE *freopen __P ((__const char *__restrict __filename,
+                          __const char *__rstrict __modes,
+                          FILE *__restrict __stream));
 
 /* Return a new, zeroed, stream.
    You must set its cookie and io_mode.
@@ -376,11 +377,11 @@ extern FILE *open_memstream __P ((char **__bufloc, size_t *__sizeloc));
 
 /* If BUF is NULL, make STREAM unbuffered.
    Else make it use buffer BUF, of size BUFSIZ.  */
-extern void setbuf __P ((FILE *__stream, char *__buf));
+extern void setbuf __P ((FILE *__restrict __stream, char *__restrict __buf));
 /* Make STREAM use buffering mode MODE.
    If BUF is not NULL, use N bytes of it for buffering;
    else allocate an internal buffer N bytes long.  */
-extern int setvbuf __P ((FILE *__stream, char *__buf,
+extern int setvbuf __P ((FILE *__restrict __stream, char *__restrict __buf,
                         int __modes, size_t __n));
 
 #ifdef __USE_BSD
@@ -394,24 +395,29 @@ extern void setlinebuf __P ((FILE *__stream));
 
 
 /* Write formatted output to STREAM.  */
-extern int fprintf __P ((FILE *__stream, __const char *__format, ...));
+extern int fprintf __P ((FILE *__restrict __stream,
+                        __const char *__restrict __format, ...));
 /* Write formatted output to stdout.  */
-extern int printf __P ((__const char *__format, ...));
+extern int printf __P ((__const char *__restrict __format, ...));
 /* Write formatted output to S.  */
-extern int sprintf __P ((char *__s, __const char *__format, ...));
+extern int sprintf __P ((char *__restrict __s,
+                        __const char *__restrict __format, ...));
 
 /* Write formatted output to S from argument list ARG.  */
-extern int vfprintf __P ((FILE *__s, __const char *__format,
+extern int vfprintf __P ((FILE *__restrict __s,
+                         __const char *__restrict __format,
                          __gnuc_va_list __arg));
 /* Write formatted output to stdout from argument list ARG.  */
-extern int vprintf __P ((__const char *__format, __gnuc_va_list __arg));
+extern int vprintf __P ((__const char *__restrict __format,
+                        __gnuc_va_list __arg));
 /* Write formatted output to S from argument list ARG.  */
-extern int vsprintf __P ((char *__s, __const char *__format,
+extern int vsprintf __P ((char *__restrict __s,
+                         __const char *__restrict __format,
                          __gnuc_va_list __arg));
 
 #ifdef __OPTIMIZE__
 extern __inline int
-vprintf (const char *__fmt, __gnuc_va_list __arg)
+vprintf (const char *__restrict __fmt, __gnuc_va_list __arg)
 {
   return vfprintf (stdout, __fmt, __arg);
 }
@@ -443,11 +449,13 @@ extern int dprintf __P ((int __fd, __const char *__fmt, ...));
 
 
 /* Read formatted input from STREAM.  */
-extern int fscanf __P ((FILE *__stream, __const char *__format, ...));
+extern int fscanf __P ((FILE *__restrict __stream,
+                       __const char *__restrict __format, ...));
 /* Read formatted input from stdin.  */
-extern int scanf __P ((__const char *__format, ...));
+extern int scanf __P ((__const char *__restrict __format, ...));
 /* Read formatted input from S.  */
-extern int sscanf __P ((__const char *__s, __const char *__format, ...));
+extern int sscanf __P ((__const char *__restrict __s,
+                       __const char *__restrict __format, ...));
 
 #ifdef __USE_GNU
 /* Read formatted input from S into argument list ARG.  */
@@ -556,7 +564,8 @@ extern int putw __P ((int __w, FILE *__stream));
 
 
 /* Get a newline-terminated string of finite length from STREAM.  */
-extern char *fgets __P ((char *__s, int __n, FILE *__stream));
+extern char *fgets __P ((char *__restrict __s, int __n,
+                        FILE *__restrict __stream));
 
 /* Get a newline-terminated string from stdin, removing the newline.
    DO NOT USE THIS FUNCTION!!  There is no limit on how much it will read.  */
@@ -582,27 +591,17 @@ ssize_t getline __P ((char **__lineptr, size_t *__n, FILE *__stream));
 
 #ifdef __OPTIMIZE__
 extern __inline ssize_t
-__getline (char **__lineptr, size_t *__n, FILE *__stream)
-{
-  return __getdelim (__lineptr, __n, '\n', __stream);
-}
-
-extern __inline ssize_t
-getdelim (char **__lineptr, size_t *__n, int __delimiter, FILE *__stream)
-{
-  return __getdelim (__lineptr, __n, __delimiter, __stream);
-}
-extern __inline ssize_t
 getline (char **__lineptr, size_t *__n, FILE *__stream)
 {
-  return __getline (__lineptr, __n, __stream);
+  return __getdelim (__lineptr, __n, '\n', __stream);
 }
 #endif /* Optimizing.  */
 #endif
 
 
 /* Write a string to STREAM.  */
-extern int fputs __P ((__const char *__s, FILE *__stream));
+extern int fputs __P ((__const char *__restrict __s,
+                      FILE *__restrict __stream));
 /* Write a string, followed by a newline, to stdout.  */
 extern int puts __P ((__const char *__s));
 
@@ -612,11 +611,11 @@ extern int ungetc __P ((int __c, FILE *__stream));
 
 
 /* Read chunks of generic data from STREAM.  */
-extern size_t fread __P ((__ptr_t __ptr, size_t __size,
-                         size_t __n, FILE *__stream));
+extern size_t fread __P ((__ptr_t __restrict __ptr, size_t __size,
+                         size_t __n, FILE *__restrict __stream));
 /* Write chunks of generic data to STREAM.  */
-extern size_t fwrite __P ((__const __ptr_t __ptr, size_t __size,
-                          size_t __n, FILE *__s));
+extern size_t fwrite __P ((__const __ptr_t __restrict __ptr, size_t __size,
+                          size_t __n, FILE *__restrict __s));
 
 
 /* Seek to a certain position on STREAM.  */
@@ -627,7 +626,7 @@ extern long int ftell __P ((FILE *__stream));
 extern void rewind __P ((FILE *__stream));
 
 /* Get STREAM's position.  */
-extern int fgetpos __P ((FILE *__stream, fpos_t *__pos));
+extern int fgetpos __P ((FILE *__restrict __stream, fpos_t *__restrict __pos));
 /* Set STREAM's position.  */
 extern int fsetpos __P ((FILE *__stream, __const fpos_t *__pos));
 
index b2641e4ba8092b8b0b61b39120493f0494518a7f..af80c0b3d8d434882de2e4f752692fd591d67b9a 100644 (file)
@@ -38,7 +38,7 @@ routines      :=                                                            \
        drand48_r erand48_r lrand48_r nrand48_r mrand48_r jrand48_r           \
        srand48_r seed48_r lcong48_r                                          \
        drand48-iter                                                          \
-       strtol strtoul strtoq strtouq                                         \
+       strtol strtoul strtoll strtoull                                       \
        strtof strtod strtold                                                 \
        system canonicalize                                                   \
        a64l l64a                                                             \
index 758241ee438add719ab0c22a4670e5a4efeb1445..aaabbc8edc3ad01623d2ede86bdeb1e2c1fdbd2f 100644 (file)
@@ -79,108 +79,129 @@ extern int atoi __P ((__const char *__nptr));
 /* Convert a string to a long integer.  */
 extern long int atol __P ((__const char *__nptr));
 
-#if defined (__GNUC__) && defined (__USE_MISC)
+#if defined __USE_ISOC9X || (defined __GNUC__ && defined __USE_MISC)
 /* These functions will part of the standard C library in ISO C 9X.  */
 extern long long int atoll __P ((__const char *__nptr));
 #endif
 
 /* Convert a string to a floating-point number.  */
-extern double strtod __P ((__const char *__nptr, char **__endptr));
+extern double strtod __P ((__const char *__restrict __nptr,
+                          char **__restrict __endptr));
 
 #ifdef __USE_GNU
 /* Likewise for `float' and `long double' sizes of floating-point numbers.  */
-extern float strtof __P ((__const char *__nptr, char **__endptr));
-extern __long_double_t strtold __P ((__const char *__nptr, char **__endptr));
+extern float strtof __P ((__const char *__restrict __nptr,
+                         char **__restrict __endptr));
+
+extern __long_double_t strtold __P ((__const char *__restrict __nptr,
+                                    char **__restrict __endptr));
 #endif
 
 /* Convert a string to a long integer.  */
-extern long int strtol __P ((__const char *__nptr, char **__endptr,
-                            int __base));
+extern long int strtol __P ((__const char *__restrict __nptr,
+                            char **__restrict __endptr, int __base));
 /* Convert a string to an unsigned long integer.  */
-extern unsigned long int strtoul __P ((__const char *__nptr,
-                                      char **__endptr, int __base));
+extern unsigned long int strtoul __P ((__const char *__restrict __nptr,
+                                      char **__restrict __endptr,
+                                      int __base));
 
-#if defined (__GNUC__) && defined (__USE_BSD)
+#if defined __GNUC__ && defined __USE_BSD
 /* Convert a string to a quadword integer.  */
-extern long long int strtoq __P ((__const char *__nptr, char **__endptr,
-                                 int __base));
+extern long long int strtoq __P ((__const char *__restrict __nptr,
+                                 char **__restrict __endptr, int __base));
 /* Convert a string to an unsigned quadword integer.  */
-extern unsigned long long int strtouq __P ((__const char *__nptr,
-                                           char **__endptr, int __base));
+extern unsigned long long int strtouq __P ((__const char *__restrict __nptr,
+                                           char **__restrict __endptr,
+                                           int __base));
 #endif /* GCC and use BSD.  */
 
-#if defined (__GNUC__) && defined (__USE_MISC)
+#if defined __USE_ISOC9X || (defined __GNUC__ && defined __USE_MISC)
 /* These functions will part of the standard C library in ISO C 9X.  */
 
 /* Convert a string to a quadword integer.  */
-extern long long int strtoll __P ((__const char *__nptr, char **__endptr,
-                                  int __base));
+extern long long int strtoll __P ((__const char *__restrict __nptr,
+                                  char **__restrict __endptr, int __base));
 /* Convert a string to an unsigned quadword integer.  */
-extern unsigned long long int strtoull __P ((__const char *__nptr,
-                                            char **__endptr, int __base));
-#endif /* GCC and use MISC.  */
+extern unsigned long long int strtoull __P ((__const char *__restrict __nptr,
+                                            char **__restrict __endptr,
+                                            int __base));
+#endif /* ISO C 9X or GCC and use MISC.  */
 
 
 
 /* The internal entry points for `strtoX' take an extra flag argument
    saying whether or not to parse locale-dependent number grouping.  */
 
-extern double __strtod_internal __P ((__const char *__nptr,
-                                     char **__endptr, int __group));
-extern float __strtof_internal __P ((__const char *__nptr, char **__endptr,
-                                    int __group));
-extern __long_double_t __strtold_internal __P ((__const char *__nptr,
-                                               char **__endptr, int __group));
-extern long int __strtol_internal __P ((__const char *__nptr, char **__endptr,
+extern double __strtod_internal __P ((__const char *__restrict __nptr,
+                                     char **__restrict __endptr,
+                                     int __group));
+extern float __strtof_internal __P ((__const char *__restrict __nptr,
+                                    char **__restrict __endptr, int __group));
+extern __long_double_t __strtold_internal __P ((__const char *
+                                               __restrict __nptr,
+                                               char **__restrict __endptr,
+                                               int __group));
+extern long int __strtol_internal __P ((__const char *__restrict __nptr,
+                                       char **__restrict __endptr,
                                        int __base, int __group));
-extern unsigned long int __strtoul_internal __P ((__const char *__nptr,
-                                                 char **__endptr, int __base,
-                                                 int __group));
+extern unsigned long int __strtoul_internal __P ((__const char *
+                                                 __restrict __nptr,
+                                                 char **__restrict __endptr,
+                                                 int __base, int __group));
 #ifdef __GNUC__
-extern long long int __strtoq_internal __P ((__const char *__nptr,
-                                            char **__endptr, int __base,
-                                            int __group));
-extern unsigned long long int __strtouq_internal __P ((__const char *__nptr,
-                                                      char **__endptr,
-                                                      int __base,
-                                                      int __group));
+extern long long int __strtoll_internal __P ((__const char *__restrict __nptr,
+                                             char **__restrict __endptr,
+                                             int __base, int __group));
+extern unsigned long long int __strtoull_internal __P ((__const char *
+                                                       __restrict __nptr,
+                                                       char **
+                                                       __restrict __endptr,
+                                                       int __base,
+                                                       int __group));
 #endif /* GCC */
 
 #if defined (__OPTIMIZE__) && __GNUC__ >= 2
 /* Define inline functions which call the internal entry points.  */
 
-extern __inline double strtod (__const char *__nptr, char **__endptr)
+extern __inline double strtod (__const char *__restrict __nptr,
+                              char **__restrict __endptr)
 { return __strtod_internal (__nptr, __endptr, 0); }
-extern __inline long int strtol (__const char *__nptr,
-                                char **__endptr, int __base)
+extern __inline long int strtol (__const char *__restrict __nptr,
+                                char **__restrict __endptr, int __base)
 { return __strtol_internal (__nptr, __endptr, __base, 0); }
-extern __inline unsigned long int strtoul (__const char *__nptr,
-                                          char **__endptr, int __base)
+extern __inline unsigned long int strtoul (__const char *__restrict __nptr,
+                                          char **__restrict __endptr,
+                                          int __base)
 { return __strtoul_internal (__nptr, __endptr, __base, 0); }
 
 #ifdef __USE_GNU
-extern __inline float strtof (__const char *__nptr, char **__endptr)
+extern __inline float strtof (__const char *__restrict __nptr,
+                             char **__restrict __endptr)
 { return __strtof_internal (__nptr, __endptr, 0); }
-extern __inline __long_double_t strtold (__const char *__nptr, char **__endptr)
+extern __inline __long_double_t strtold (__const char *__restrict __nptr,
+                                        char **__restrict __endptr)
 { return __strtold_internal (__nptr, __endptr, 0); }
 #endif
 
 #ifdef __USE_BSD
-extern __inline long long int strtoq (__const char *__nptr, char **__endptr,
-                                     int __base)
-{ return __strtoq_internal (__nptr, __endptr, __base, 0); }
-extern __inline unsigned long long int strtouq (__const char *__nptr,
-                                               char **__endptr, int __base)
-{ return __strtouq_internal (__nptr, __endptr, __base, 0); }
+extern __inline long long int strtoq (__const char *__restrict __nptr,
+                                     char **__restrict __endptr, int __base)
+{ return __strtoll_internal (__nptr, __endptr, __base, 0); }
+extern __inline unsigned long long int strtouq (__const char *__restrict __nptr,
+                                               char **__restrict __endptr,
+                                               int __base)
+{ return __strtoull_internal (__nptr, __endptr, __base, 0); }
 #endif
 
-#ifdef __USE_MISC
-extern __inline long long int strtoll (__const char *__nptr, char **__endptr,
-                                      int __base)
-{ return __strtoq_internal (__nptr, __endptr, __base, 0); }
-extern __inline unsigned long long int strtoull (__const char *__nptr,
-                                                char **__endptr, int __base)
-{ return __strtouq_internal (__nptr, __endptr, __base, 0); }
+#if defined __USE_MISC || defined __USE_ISOC9X
+extern __inline long long int strtoll (__const char *__restrict __nptr,
+                                      char **__restrict __endptr, int __base)
+{ return __strtoll_internal (__nptr, __endptr, __base, 0); }
+extern __inline unsigned long long int strtoull (__const char *
+                                                __restrict __nptr,
+                                                char **__restrict __endptr,
+                                                int __base)
+{ return __strtoull_internal (__nptr, __endptr, __base, 0); }
 #endif
 
 extern __inline double atof (__const char *__nptr)
@@ -483,8 +504,9 @@ extern void qsort __P ((__ptr_t __base, size_t __nmemb, size_t __size,
 /* Return the absolute value of X.  */
 extern int abs __P ((int __x)) __attribute__ ((__const__));
 extern long int labs __P ((long int __x)) __attribute__ ((__const__));
-#ifdef __USE_GNU
-extern long long int llabs __P ((long long int __x)) __attribute__ ((__const__));
+#if defined __USE_ISOC9X
+extern long long int llabs __P ((long long int __x))
+     __attribute__ ((__const__));
 #endif
 
 
@@ -492,9 +514,11 @@ extern long long int llabs __P ((long long int __x)) __attribute__ ((__const__))
    of the value of NUMER over DENOM. */
 /* GCC may have built-ins for these someday.  */
 extern div_t div __P ((int __numer, int __denom)) __attribute__ ((__const__));
-extern ldiv_t ldiv __P ((long int __numer, long int __denom)) __attribute__ ((__const__));
-#ifdef __USE_GNU
-extern lldiv_t lldiv __P ((long long int __numer, long long int __denom)) __attribute__ ((__const__));
+extern ldiv_t ldiv __P ((long int __numer, long int __denom))
+     __attribute__ ((__const__));
+#ifdef __USE_ISOC9X
+extern lldiv_t lldiv __P ((long long int __numer, long long int __denom))
+     __attribute__ ((__const__));
 #endif
 
 
@@ -548,7 +572,8 @@ extern int qfcvt_r __P ((__long_double_t __value, int __ndigit, int *__decpt,
 extern int mblen __P ((__const char *__s, size_t __n));
 /* Return the length of the given multibyte character,
    putting its `wchar_t' representation in *PWC.  */
-extern int mbtowc __P ((wchar_t *__pwc, __const char *__s, size_t __n));
+extern int mbtowc __P ((wchar_t *__restrict __pwc,
+                       __const char *__restrict __s, size_t __n));
 /* Put the multibyte character represented
    by WCHAR in S, returning its length.  */
 extern int wctomb __P ((char *__s, wchar_t __wchar));
@@ -560,9 +585,11 @@ extern __inline int mblen (__const char *__s, size_t __n)
 
 
 /* Convert a multibyte string to a wide char string.  */
-extern size_t mbstowcs __P ((wchar_t *__pwcs, __const char *__s, size_t __n));
+extern size_t mbstowcs __P ((wchar_t *__restrict  __pwcs,
+                            __const char *__restrict __s, size_t __n));
 /* Convert a wide char string to multibyte string.  */
-extern size_t wcstombs __P ((char *__s, __const wchar_t *__pwcs, size_t __n));
+extern size_t wcstombs __P ((char *__restrict __s,
+                            __const wchar_t *__restrict __pwcs, size_t __n));
 
 
 #ifdef __USE_SVID
index e5951f01a4645946f8d65ac9bd2d82a34c60500a..ed24c08f2b2437b740a81c971d463625e96335e5 100644 (file)
 # define L_(Ch) L##Ch
 # define ISSPACE(Ch) iswspace (Ch)
 # define TOLOWER(Ch) towlower (Ch)
+# define STRNCASECMP(S1, S2, N) __wcsncasecmp ((S1), (S2), (N))
 #else
 # define STRING_TYPE char
 # define CHAR_TYPE char
 # define L_(Ch) Ch
 # define ISSPACE(Ch) isspace (Ch)
 # define TOLOWER(Ch) tolower (Ch)
+# define STRNCASECMP(S1, S2, N) __strncasecmp ((S1), (S2), (N))
 #endif
 /* End of configuration part.  */
 \f
 #include <ctype.h>
 #include <errno.h>
 #include <float.h>
+#include <ieee754.h>
 #include "../locale/localeinfo.h"
 #include <math.h>
 #include <stdlib.h>
@@ -433,7 +436,54 @@ INTERNAL (STRTOF) (nptr, endptr, group)
      No character is used even if a sign was found.  */
   if ((c < L_('0') || c > L_('9'))
       && ((wint_t) c != decimal || cp[1] < L_('0') || cp[1] > L_('9')))
-    RETURN (0.0, nptr);
+    {
+      int matched = 0;
+      /* Check for `INF' or `INFINITY'.  */
+      if (TOLOWER (c) == L_('i') && ((STRNCASECMP (cp, L_("nf"), 2) == 0
+                                     && (matched = 2))
+                                    || (STRNCASECMP (cp, L_("nfinity"), 7)
+                                        == 0
+                                        && (matched = 7))))
+       {
+         /* Return +/- inifity.  */
+         if (endptr != NULL)
+           *endptr = (STRING_TYPE *) (cp + matched);
+
+         return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
+       }
+
+      if (TOLOWER (c) == L_('n') && STRNCASECMP (cp, L_("an"), 2) == 0)
+       {
+         /* Return NaN.  */
+         if (endptr != NULL)
+           {
+             cp += 2;
+
+             /* Match `(n-char-sequence-digit)'.  */
+             if (*cp == L_('('))
+               {
+                 const STRING_TYPE *startp = cp;
+                 do
+                   ++cp;
+                 while ((*cp >= '0' && *cp <= '9')
+                        || (TOLOWER (*cp) >= 'a' && TOLOWER (*cp) <= 'z')
+                    || *cp == L_('_'));
+
+                 if (*cp != L_(')'))
+                   /* The closing brace is missing.  Only match the NAN
+                      part.  */
+                   cp = startp;
+               }
+
+             *endptr = (STRING_TYPE *) cp;
+           }
+
+         return NAN;
+       }
+
+      /* It is really a text we do not recognize.  */
+      RETURN (0.0, nptr);
+    }
 
   /* Record the start of the digits, in case we will check their grouping.  */
   start_of_digits = startp = cp;
index 1d1c41f46a29aac5a007ecf4658bb1e5a245ff35..8692a3ac8fc4dec6cdb2562e9da58c4d7ed9437b 100644 (file)
@@ -5,6 +5,6 @@
 #define        FLT             FLT
 #define        STRTOF          strtof
 #define        MPN2FLOAT       __mpn_construct_float
-#define        FLOAT_HUGE_VAL  HUGE_VALf
+#define        FLOAT_HUGE_VAL  HUGE_VALF
 
 #include "strtod.c"
index 396e2ecd7452a92b9ecae9a29065e8fdbd3ed709..6ec096daf6baab176bb762f0788adaa7be4c94e2 100644 (file)
@@ -1,4 +1,4 @@
-/* strtol - Convert string representation of a number into an integer value.
+/* Convert string representation of a number into an integer value.
    Copyright (C) 1991, 92, 94, 95, 96, 97 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
@@ -54,7 +54,7 @@ extern int errno;
 # include "../locale/localeinfo.h"
 #endif
 
-/* Nonzero if we are defining `strtoul' or `strtouq', operating on
+/* Nonzero if we are defining `strtoul' or `strtoull', operating on
    unsigned integers.  */
 #ifndef UNSIGNED
 # define UNSIGNED 0
@@ -67,13 +67,13 @@ extern int errno;
 #if UNSIGNED
 # ifdef USE_WIDE_CHAR
 #  ifdef QUAD
-#   define strtol wcstouq
+#   define strtol wcstoull
 #  else
 #   define strtol wcstoul
 #  endif
 # else
 #  ifdef QUAD
-#   define strtol strtouq
+#   define strtol strtoull
 #  else
 #   define strtol strtoul
 #  endif
@@ -81,18 +81,18 @@ extern int errno;
 #else
 # ifdef USE_WIDE_CHAR
 #  ifdef QUAD
-#   define strtol wcstoq
+#   define strtol wcstoll
 #  else
 #   define strtol wcstol
 #  endif
 # else
 #  ifdef QUAD
-#   define strtol strtoq
+#   define strtol strtoll
 #  endif
 # endif
 #endif
 
-/* If QUAD is defined, we are defining `strtoq' or `strtouq',
+/* If QUAD is defined, we are defining `strtoll' or `strtoull',
    operating on `long long int's.  */
 #ifdef QUAD
 # define LONG long long
@@ -312,8 +312,6 @@ INTERNAL (strtol) (nptr, endptr, base, group)
              ? -((unsigned LONG int) (LONG_MIN + 1)) + 1
              : (unsigned LONG int) LONG_MAX))
     overflow = 1;
-#else
-  overflow |= negative;
 #endif
 
   if (overflow)
index ec2b49b2794326dbcdeb3f70df372c7dd3d2e244..9d8054337721243ded64c06e75abd69feb0ae9bc 100644 (file)
@@ -5,6 +5,6 @@
 #define        FLT             LDBL
 #define        STRTOF          strtold
 #define        MPN2FLOAT       __mpn_construct_long_double
-#define        FLOAT_HUGE_VAL  HUGE_VALl
+#define        FLOAT_HUGE_VAL  HUGE_VALL
 
 #include "strtod.c"
similarity index 97%
rename from stdlib/strtoq.c
rename to stdlib/strtoll.c
index 259611c3a22c1b237d844a6a2fe55135773b42a9..e9487addc7f98a0fff0c3a2d9aa220ea75d174c4 100644 (file)
@@ -21,4 +21,4 @@
 
 #include <strtol.c>
 
-weak_alias (strtoq, strtoll)
+weak_alias (strtoll, strtoq)
similarity index 96%
rename from stdlib/strtouq.c
rename to stdlib/strtoull.c
index 68f293610ad0abb78f09046c7165212917a5b98e..419d28964fa758438cc31222992676fcd7696f85 100644 (file)
@@ -21,4 +21,4 @@
 
 #include <strtoul.c>
 
-weak_alias (strtouq, strtoull)
+weak_alias (strtoull, strtouq)
index 1d398b4558af44830192ec8cd1b500f75277cf28..e351e97ceb9a1ad81d92525b3b0a4cb56337535a 100644 (file)
@@ -38,7 +38,7 @@ static const struct ltest tests[] =
     { "0xffffffffg",   0xffffffff,     0,      'g',    0 },
     { "0xf1f2f3f4f5",  0xffffffff,     0,      0,      ERANGE },
     { "-0x123456789",  0xffffffff,     0,      0,      ERANGE },
-    { "-0xfedcba98",   0xffffffff,     0,      0,      ERANGE },
+    { "-0xfedcba98",   0x01234568,     0,      0,      0 },
     { NULL,            0,              0,      0,      0 },
 #else
     /* assume 64 bit long... */
@@ -66,7 +66,7 @@ static const struct ltest tests[] =
     { "0xffffffffffffffffg",   0xffffffffffffffff,     0,      'g',    0 },
     { "0xf1f2f3f4f5f6f7f8f9",  0xffffffffffffffff,     0,      0,      ERANGE },
     { "-0x123456789abcdef01",  0xffffffffffffffff,     0,      0,      ERANGE },
-    { "-0xfedcba987654321",    0xffffffffffffffff,     0,      0,      ERANGE },
+    { "-0xfedcba987654321",    0x0123456789abcdf,      0,      0,      0 },
     { NULL,            0,              0,      0,      0 },
 #endif
   };
index 865007ff99682e5c74d471d358bfa70f7faa8e80..462992dbf3806bd4ce289dcaa78a7956b57cb5c4 100644 (file)
@@ -34,8 +34,8 @@ __BEGIN_DECLS
 
 
 /* Copy N bytes of SRC to DEST.  */
-extern __ptr_t memcpy __P ((__ptr_t __dest, __const __ptr_t __src,
-                           size_t __n));
+extern __ptr_t memcpy __P ((__ptr_t __restrict __dest,
+                           __const __ptr_t __restrict __src, size_t __n));
 /* Copy N bytes of SRC to DEST, guaranteeing
    correct behavior for overlapping strings.  */
 extern __ptr_t memmove __P ((__ptr_t __dest, __const __ptr_t __src,
@@ -64,14 +64,18 @@ extern __ptr_t memchr __P ((__const __ptr_t __s, int __c, size_t __n));
 
 
 /* Copy SRC to DEST.  */
-extern char *strcpy __P ((char *__dest, __const char *__src));
+extern char *strcpy __P ((char *__restrict __dest,
+                         __const char *__restrict __src));
 /* Copy no more than N characters of SRC to DEST.  */
-extern char *strncpy __P ((char *__dest, __const char *__src, size_t __n));
+extern char *strncpy __P ((char *__restrict __dest,
+                          __const char *__restrict __src, size_t __n));
 
 /* Append SRC onto DEST.  */
-extern char *strcat __P ((char *__dest, __const char *__src));
+extern char *strcat __P ((char *__restrict __dest,
+                         __const char *__restrict __src));
 /* Append no more than N characters from SRC onto DEST.  */
-extern char *strncat __P ((char *__dest, __const char *__src, size_t __n));
+extern char *strncat __P ((char *__restrict __dest,
+                          __const char *__restrict __src, size_t __n));
 
 /* Compare S1 and S2.  */
 extern int strcmp __P ((__const char *__s1, __const char *__s2));
@@ -81,7 +85,8 @@ extern int strncmp __P ((__const char *__s1, __const char *__s2, size_t __n));
 /* Compare the collated forms of S1 and S2.  */
 extern int strcoll __P ((__const char *__s1, __const char *__s2));
 /* Put a transformation of SRC into no more than N bytes of DEST.  */
-extern size_t strxfrm __P ((char *__dest, __const char *__src, size_t __n));
+extern size_t strxfrm __P ((char *__restrict __dest,
+                           __const char *__restrict __src, size_t __n));
 
 #ifdef __USE_GNU
 /* The following functions are equivalent to the both above but they
@@ -150,7 +155,8 @@ extern char *strpbrk __P ((__const char *__s, __const char *__accept));
 /* Find the first occurrence of NEEDLE in HAYSTACK.  */
 extern char *strstr __P ((__const char *__haystack, __const char *__needle));
 /* Divide S into tokens separated by characters in DELIM.  */
-extern char *strtok __P ((char *__s, __const char *__delim));
+extern char *strtok __P ((char *__restrict __s,
+                         __const char *__restrict __delim));
 
 #if defined __USE_POSIX || defined __USE_MISC
 /* Divide S into tokens separated by characters in DELIM.  Information
index 63a8aad9f5f8d00986d4a2850f845054be41d9f4..4f8b0a9574536ef14ae1687fc7efd25c8c5a4f8a 100644 (file)
@@ -1,6 +1,6 @@
-/* `HUGE_VAL' constant for IEEE 754 machines (where it is infinity).
+/* `HUGE_VAL' constants for IEEE 754 machines (where it is infinity).
    Used by <stdlib.h> and <math.h> functions for overflow.
-   Copyright (C) 1992, 1995, 1996 Free Software Foundation, Inc.
+   Copyright (C) 1992, 1995, 1996, 1997 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
@@ -44,43 +44,49 @@ static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
 #endif /* GCC.  */
 
 
-/* GNU extensions: (float) HUGE_VALf and (long double) HUGE_VALl.  */
+/* ISO C 9X extensions: (float) HUGE_VALF and (long double) HUGE_VALL.  */
 
-#ifdef __USE_GNU
+#ifdef __USE_ISOC9X
 
 #if __BYTE_ORDER == __BIG_ENDIAN
-#define        __HUGE_VALf_bytes       { 0x7f, 0x80, 0, 0 }
+#define        __HUGE_VALF_bytes       { 0x7f, 0x80, 0, 0 }
 #endif
 #if __BYTE_ORDER == __LITTLE_ENDIAN
-#define        __HUGE_VALf_bytes       { 0, 0, 0x80, 0x7f }
+#define        __HUGE_VALF_bytes       { 0, 0, 0x80, 0x7f }
 #endif
 
 #define __huge_valf_t  union { unsigned char __c[4]; float __f; }
 #ifdef __GNUC__
-#define        HUGE_VALf       (__extension__ \
-                        ((__huge_valf_t) { __c: __HUGE_VALf_bytes }).__f)
+#define        HUGE_VALF       (__extension__ \
+                        ((__huge_valf_t) { __c: __HUGE_VALF_bytes }).__f)
 #else  /* Not GCC.  */
-static __huge_valf_t __huge_valf = { __HUGE_VALf_bytes };
-#define        HUGE_VALf       (__huge_valf.__f)
+static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes };
+#define        HUGE_VALF       (__huge_valf.__f)
 #endif /* GCC.  */
 
+
 #if __BYTE_ORDER == __BIG_ENDIAN
-#define        __HUGE_VALl_bytes       { 0x7f, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+#define        __HUGE_VALL_bytes       { 0x7f, 0xff, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
 #endif
 #if __BYTE_ORDER == __LITTLE_ENDIAN
-#define        __HUGE_VALl_bytes       { 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0x7f, 0, 0 }
+#define        __HUGE_VALL_bytes       { 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0x7f, 0, 0 }
 #endif
 
 #define __huge_vall_t  union { unsigned char __c[12]; long double __ld; }
 #ifdef __GNUC__
-#define        HUGE_VALl       (__extension__ \
-                        ((__huge_vall_t) { __c: __HUGE_VALl_bytes }).__ld)
+#define        HUGE_VALL       (__extension__ \
+                        ((__huge_vall_t) { __c: __HUGE_VALL_bytes }).__ld)
 #else  /* Not GCC.  */
-static __huge_vall_t __huge_vall = { __HUGE_VALl_bytes };
-#define        HUGE_VALl       (__huge_vall.__ld)
+static __huge_vall_t __huge_vall = { __HUGE_VALL_bytes };
+#define        HUGE_VALL       (__huge_vall.__ld)
 #endif /* GCC.  */
 
-#endif /* __USE_GNU.  */
+
+/* Expression representing positive infinity.  Here it is the same as
+   HUGE_VALF.  */
+#define INFINITY       HUGE_VALF
+
+#endif /* __USE_ISOC9X.  */
 
 
 #endif    /* huge_val.h */
index 9f45faa00cb436a5a96c84b30548f565e3c36ad4..21e7727728f32ce8879dca93157fb4a79488c6c1 100644 (file)
@@ -90,7 +90,7 @@ G =  3.57142857142857150787e-01L; /* 5/14 */
          {
            u_int64_t xxl = ((u_int64_t) se) << 32 | x0;
            xxl /= 3;
-           xxl += B1_EXP << 16 | B1_MANT;
+           xxl += ((u_int64_t) B1_EXP) << 32 | B1_MANT;
            SET_LDOUBLE_MSW(t,xxl&0xffffffffu);
            xxl >>= 32;
            SET_LDOUBLE_EXP(t,xxl);
index b89a1f6889743edef53a3a48fd0188b3f9db9d77..f5b33cb8dbdc266b3f4b8d82e521c97d48b8c857 100644 (file)
@@ -43,7 +43,7 @@ values[] =
 char *
 gai_strerror (int code)
 {
-  int i;
+  size_t i;
   for (i = 0; i < sizeof (values) / sizeof (values[0]); ++i)
     if (values[i].code == code)
       return (char *) values[i].msg;
index fba12457302fb3a2effc87fc20c547ae262ba0ee..9a2325c35c7533e75b0f90deeabfa01176f77267 100644 (file)
@@ -7,7 +7,7 @@ chmod           -       chmod           2       __chmod         chmod
 chown          -       chown           3       __chown         chown
 chroot         -       chroot          1       chroot
 close          -       close           1       __libc_close    __close close
-dup            -       dup             2       __dup           dup
+dup            -       dup             1       __dup           dup
 dup2           -       dup2            2       __dup2          dup2
 fchdir         -       fchdir          1       fchdir
 fcntl          -       fcntl           3       __libc_fcntl    __fcntl fcntl
index 5936a0185b8213485fc2892c6a3b637fbbf9e6d9..014684c70883a4cd93f3e089cc0cf99b0f2bde93 100644 (file)
@@ -1,2 +1,3 @@
 #define        socket  accept
+#define        NARGS   3
 #include <socket.S>
index fc82b65a2f0fcaa77399df8b2dca7e3dafb6d1d6..61fb5ebff889e64f404f488f38b5304a478c3b90 100644 (file)
@@ -1,2 +1,3 @@
 #define        socket  bind
+#define        NARGS   3
 #include <socket.S>
index 3433043d8cbd15d589ffce78be175a82169ef97d..93aad35d851bd1390156e5bda8ab75c4b54bbde4 100644 (file)
@@ -1,2 +1,3 @@
 #define        socket  connect
+#define        NARGS   3
 #include <socket.S>
index 8429fcdf76b63a64e413a2c78a9bd1f20380052a..a6d8e86d4ebbf59872caa161c1eed258e28e0bd3 100644 (file)
@@ -1,2 +1,3 @@
 #define        socket  getpeername
+#define        NARGS   3
 #include <socket.S>
index 6782707f88060ab47bad2e22d97c966746972dae..c138be9da555086f64fcc981906fd870a6f36c5d 100644 (file)
@@ -1,2 +1,3 @@
 #define        socket  getsockname
+#define        NARGS   3
 #include <socket.S>
index 6ce92a6330f114a82bc353eada7bc152bbba5953..6f982082aec0a4d1504b181d849ef0ee597409ef 100644 (file)
@@ -1,2 +1,3 @@
 #define        socket  getsockopt
+#define        NARGS   5
 #include <socket.S>
index 78e8b03ccee8ad9f5c7cba499482b67727f47608..441c14315656035958da8f6043ecade2ba18b75a 100644 (file)
@@ -1,20 +1,20 @@
-/* Copyright (C) 1995, 1996 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
-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., 675 Mass Ave,
-Cambridge, MA 02139, USA.  */
+/* Copyright (C) 1995, 1996, 1997 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
+   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.  */
 
 #include <sysdep.h>
 #include <sys/socketcall.h>
index d2cbec60a082e78f6f08caaadfbd5afff2b713ff..4c7e435196aa3e8e1d8f54b01032c3dfe27a0c2a 100644 (file)
@@ -1,2 +1,3 @@
 #define        socket  listen
+#define        NARGS   2
 #include <socket.S>
index f1081cc4315420ae42cd7665f15f865bda63fcf6..ae17ba3fd31dac88024e5af840cf6b2fdb6e7d3e 100644 (file)
@@ -1,2 +1,3 @@
 #define        socket  recv
+#define        NARGS   4
 #include <socket.S>
index febaa9ef559f7bfb558f168d85c26d3ea22685a6..ed03d3c44b1887a61fbd08c46a7564815d009edc 100644 (file)
@@ -1,2 +1,3 @@
 #define        socket  recvfrom
+#define        NARGS   6
 #include <socket.S>
index ffadd301953e3fd63f300227e6d0d605688b90a1..bb897d2b6377fe2de6c70571488f684d04b25e75 100644 (file)
@@ -1,2 +1,3 @@
 #define        socket  recvmsg
+#define        NARGS   3
 #include <socket.S>
index 52293c6524a921df8138b8ef31af510f1fe34745..596135e690c208856efdde122fd048561e4e05fb 100644 (file)
@@ -1,2 +1,3 @@
 #define        socket  send
+#define        NARGS   4
 #include <socket.S>
index 65f2c3eb98ce8c27777b28e8f54a774618567353..f0aabb70235768edd624d630cc2898081d84abf8 100644 (file)
@@ -1,2 +1,3 @@
 #define        socket  sendmsg
+#define        NARGS   3
 #include <socket.S>
index aa637ce9c91de0effa61f3effb287e2b644e1386..3464d46e527b0be0e294340da79f2027d0240e51 100644 (file)
@@ -1,2 +1,3 @@
 #define        socket  sendto
+#define        NARGS   6
 #include <socket.S>
index 33d57179ca0a5219dfec7c667d8602a00a60fbe3..01b2799ae8cc9ecbf4ae833c1307c8e23d76ae3b 100644 (file)
@@ -1,2 +1,3 @@
 #define        socket  setsockopt
+#define        NARGS   5
 #include <socket.S>
index 6cc95d50f9df9adc336815235b4968648e0ee44b..e2462d0eca664a37d4b1fb3b41c47a94f5c84ecd 100644 (file)
@@ -1,2 +1,3 @@
 #define        socket  shutdown
+#define        NARGS   2
 #include <socket.S>
index da71c57dea49b833209a71de0ffc52a9a661d043..c954ad1a4b91e4c117c12490ac3f3b85b0d661fa 100644 (file)
@@ -1,2 +1,3 @@
 #define        socket  socketpair
+#define        NARGS   4
 #include <socket.S>
index f2f73a48d4760efa4f0b6e33f1518b3022f408d3..de30a6f348cb84bf506751dd33399e5405f7a3a8 100644 (file)
@@ -1,5 +1,5 @@
 /* System-dependent timing definitions.  Linux version.
-   Copyright (C) 1996 Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997 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
@@ -43,8 +43,10 @@ struct timeval
    XSI-conformant systems. */
 # define CLOCKS_PER_SEC  1000000
 
+# ifndef __STRICT_ANSI__
 /* Even though CLOCKS_PER_SEC has such a strange value CLK_TCK
    presents the real value for clock ticks per second for the system.  */
-# define CLK_TCK 100
+#  define CLK_TCK 100
+# endif
 
 #endif /* timebits.h */
index 8c1aeaace67db746cf4f3b0a6104e884e5573ea6..5cd8975d4446ef8035e06fd8255e7ab381b40baf 100644 (file)
@@ -152,8 +152,9 @@ extern time_t __mktime_internal __P ((struct tm *__tp,
 /* Format TP into S according to FORMAT.
    Write no more than MAXSIZE characters and return the number
    of characters written, or 0 if it would exceed MAXSIZE.  */
-extern size_t strftime __P ((char *__s, size_t __maxsize,
-                            __const char *__format, __const struct tm *__tp));
+extern size_t strftime __P ((char *__restrict __s, size_t __maxsize,
+                            __const char *__restrict __format,
+                            __const struct tm *__restrict __tp));
 
 #ifdef __USE_XOPEN
 /* Parse S according to FORMAT and store binary time information in TP.
index 929798da42e12c8d8776b79c80c93b2ad960bbe7..76f0fd03b944067c224d56013b694843232370be 100644 (file)
@@ -30,10 +30,11 @@ routines := wcscat wcschr wcscmp wcscpy wcscspn wcsdup wcslen wcsncat \
            btowc wctob mbsinit \
            mbrlen mbrtowc wcrtomb mbsrtowcs wcsrtombs \
            mbsnrtowcs wcsnrtombs \
-           wcstol wcstoul wcstoq wcstouq wcstod wcstold wcstof \
+           wcstol wcstoul wcstoll wcstoull wcstod wcstold wcstof \
            wcscoll wcsxfrm \
            wcwidth wcswidth \
-           wcscoll_l wcsxfrm_l
+           wcscoll_l wcsxfrm_l \
+           wcscasecmp wcsncase
 
 include ../Rules
 
@@ -42,8 +43,8 @@ CFLAGS-wcswidth.c = -I../wctype
 
 CFLAGS-wcstol.c = -I../stdlib
 CFLAGS-wcstoul.c = -I../stdlib
-CFLAGS-wcstoq.c = -I../stdlib
-CFLAGS-wcstouq.c = -I../stdlib
+CFLAGS-wcstoll.c = -I../stdlib
+CFLAGS-wcstoull.c = -I../stdlib
 CFLAGS-wcstod.c = -I../stdlib
 CFLAGS-wcstold.c = -I../stdlib
 CFLAGS-wcstof.c = -I../stdlib
index 597a03d735f0bf53a33478d9e4c9cd14787d0bc0..5247a866d3d3031f06aae9610924d0f5e5a53024 100644 (file)
@@ -64,16 +64,18 @@ typedef struct
 
 
 /* Copy SRC to DEST.  */
-extern wchar_t *wcscpy __P ((wchar_t *__dest, __const wchar_t *__src));
+extern wchar_t *wcscpy __P ((wchar_t *__restrict __dest,
+                            __const wchar_t *__restrict __src));
 /* Copy no more than N wide-characters of SRC to DEST.  */
-extern wchar_t *wcsncpy __P ((wchar_t *__dest, __const wchar_t *__src,
-                             size_t __n));
+extern wchar_t *wcsncpy __P ((wchar_t *__restrict __dest,
+                             __const wchar_t *__restrict __src, size_t __n));
 
 /* Append SRC onto DEST.  */
-extern wchar_t *wcscat __P ((wchar_t *__dest, __const wchar_t *__src));
+extern wchar_t *wcscat __P ((wchar_t *__restrict __dest,
+                            __const wchar_t *__restrict __src));
 /* Append no more than N wide-characters of SRC onto DEST.  */
-extern wchar_t *wcsncat __P ((wchar_t *__dest, __const wchar_t *__src,
-                             size_t __n));
+extern wchar_t *wcsncat __P ((wchar_t *__restrict __dest,
+                             __const wchar_t *__restrict __src, size_t __n));
 
 /* Compare S1 and S2.  */
 extern int wcscmp __P ((__const wchar_t *__s1, __const wchar_t *__s2));
@@ -81,13 +83,26 @@ extern int wcscmp __P ((__const wchar_t *__s1, __const wchar_t *__s2));
 extern int wcsncmp __P ((__const wchar_t *__s1, __const wchar_t *__s2,
                         size_t __n));
 
+#ifdef __USE_GNU
+/* Compare S1 and S2, ignoring case.  */
+extern int __wcscasecmp __P ((__const wchar_t *__s1, __const wchar_t *__s2));
+extern int wcscasecmp __P ((__const wchar_t *__s1, __const wchar_t *__s2));
+
+/* Compare no more than N chars of S1 and S2, ignoring case.  */
+extern int __wcsncasecmp __P ((__const wchar_t *__s1, __const wchar_t *__s2,
+                               size_t __n));
+extern int wcsncasecmp __P ((__const wchar_t *__s1, __const wchar_t *__s2,
+                             size_t __n));
+#endif
+
 /* Compare S1 and S2, both interpreted as appropriate to the
    LC_COLLATE category of the current locale.  */
 extern int wcscoll __P ((__const wchar_t *__s1, __const wchar_t *__s2));
 /* Transform S2 into array pointed to by S1 such that if wcscmp is
    applied to two transformed strings the result is the as applying
    `wcscoll' to the original strings.  */
-extern size_t wcsxfrm __P ((wchar_t *__s1, __const wchar_t *__s2, size_t __n));
+extern size_t wcsxfrm __P ((wchar_t *__restrict __s1,
+                           __const wchar_t *__restrict __s2, size_t __n));
 
 #ifdef __USE_GNU
 /* Similar to the two functions above but take the information from
@@ -97,12 +112,12 @@ extern size_t wcsxfrm __P ((wchar_t *__s1, __const wchar_t *__s2, size_t __n));
 /* Compare S1 and S2, both interpreted as appropriate to the
    LC_COLLATE category of the given locale.  */
 extern int __wcscoll_l __P ((__const wchar_t *__s1, __const wchar_t *__s2,
-                            __locale_t loc));
+                            __locale_t __loc));
 /* Transform S2 into array pointed to by S1 such that if wcscmp is
    applied to two transformed strings the result is the as applying
    `wcscoll' to the original strings.  */
 extern size_t __wcsxfrm_l __P ((wchar_t *__s1, __const wchar_t *__s2,
-                               size_t __n, __locale_t loc));
+                               size_t __n, __locale_t __loc));
 #endif
 
 /* Duplicate S, returning an identical malloc'd string.  */
@@ -127,8 +142,9 @@ extern wchar_t *wcspbrk __P ((__const wchar_t *__wcs,
 extern wchar_t *wcsstr __P ((__const wchar_t *__haystack,
                             __const wchar_t *__needle));
 /* Divide WCS into tokens separated by characters in DELIM.  */
-extern wchar_t *wcstok __P ((wchar_t *__s, __const wchar_t *__delim,
-                            wchar_t **ptr));
+extern wchar_t *wcstok __P ((wchar_t *__restrict __s,
+                            __const wchar_t *__restrict __delim,
+                            wchar_t **__restrict __ptr));
 
 /* Return the number of wide-characters in S.  */
 extern size_t wcslen __P ((__const wchar_t *__s));
@@ -138,12 +154,12 @@ extern size_t wcslen __P ((__const wchar_t *__s));
 extern wchar_t *wmemchr __P ((__const wchar_t *__s, wchar_t __c, size_t __n));
 
 /* Compare N bytes of S1 and S2.  */
-extern int wmemcmp __P ((__const wchar_t *__s1, __const wchar_t *__s2,
-                        size_t __n));
+extern int wmemcmp __P ((__const wchar_t *__restrict __s1,
+                        __const wchar_t *__restrict __s2, size_t __n));
 
 /* Copy N bytes of SRC to DEST.  */
-extern wchar_t *wmemcpy __P ((wchar_t *__s1, __const wchar_t *__s2,
-                             size_t __n));
+extern wchar_t *wmemcpy __P ((wchar_t *__restrict __s1,
+                             __const wchar_t *__restrict __s2, size_t __n));
 
 /* Copy N bytes of SRC to DEST, guaranteeing
    correct behavior for overlapping strings.  */
@@ -168,55 +184,73 @@ extern int mbsinit __P ((__const mbstate_t *__ps));
 
 /* Write wide character representation of multibyte character pointed
    to by S to PWC.  */
-extern size_t __mbrtowc __P ((wchar_t *__pwc, __const char *__s, size_t __n,
-                             mbstate_t *__p));
-extern size_t mbrtowc __P ((wchar_t *__pwc, __const char *__s, size_t __n,
+extern size_t __mbrtowc __P ((wchar_t *__restrict __pwc,
+                             __const char *__restrict __s, size_t __n,
+                             mbstate_t *__restrict __p));
+extern size_t mbrtowc __P ((wchar_t *__restrict __pwc,
+                           __const char *__restrict __s, size_t __n,
                            mbstate_t *__p));
 
 /* Write multibyte representation of wide character WC to S.  */
-extern size_t __wcrtomb __P ((char *__s, wchar_t __wc, mbstate_t *__ps));
-extern size_t wcrtomb __P ((char *__s, wchar_t __wc, mbstate_t *__ps));
+extern size_t __wcrtomb __P ((char *__restrict __s, wchar_t __wc,
+                             mbstate_t *__restrict __ps));
+extern size_t wcrtomb __P ((char *__restrict __s, wchar_t __wc,
+                           mbstate_t *__restrict __ps));
 
 /* Return number of bytes in multibyte character pointed to by S.  */
-extern size_t __mbrlen __P ((__const char *__s, size_t __n, mbstate_t *__ps));
-extern size_t mbrlen __P ((__const char *__s, size_t __n, mbstate_t *__ps));
+extern size_t __mbrlen __P ((__const char *__restrict __s, size_t __n,
+                            mbstate_t *__restrict __ps));
+extern size_t mbrlen __P ((__const char *__restrict __s, size_t __n,
+                          mbstate_t *__restrict __ps));
 
 #if defined (__OPTIMIZE__) \
     && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
 /* Define inline function as optimization.  */
-extern __inline size_t mbrlen (__const char *s, size_t n, mbstate_t *ps)
-{ return ps != NULL ? __mbrtowc (NULL, s, n, ps) : __mbrlen (s, n, NULL); }
+extern __inline size_t mbrlen (__const char *__restrict __s, size_t __n,
+                              mbstate_t *__restrict __ps)
+{ return (__ps != NULL
+         ? __mbrtowc (NULL, __s, __n, __ps) : __mbrlen (__s, __n, NULL)); }
 #endif
 
 /* Write wide character representation of multibyte character string
    SRC to DST.  */
-extern size_t __mbsrtowcs __P ((wchar_t *__dst, __const char **__src,
-                               size_t __len, mbstate_t *__ps));
-extern size_t mbsrtowcs __P ((wchar_t *__dst, __const char **__src,
-                             size_t __len, mbstate_t *__ps));
+extern size_t __mbsrtowcs __P ((wchar_t *__restrict __dst,
+                               __const char **__restrict __src,
+                               size_t __len, mbstate_t *__restrict __ps));
+extern size_t mbsrtowcs __P ((wchar_t *__restrict __dst,
+                             __const char **__restrict __src,
+                             size_t __len, mbstate_t *__restrict __ps));
 
 /* Write multibyte character representation of wide character string
    SRC to DST.  */
-extern size_t __wcsrtombs __P ((char *__dst, __const wchar_t **__src,
-                               size_t __len, mbstate_t *__ps));
-extern size_t wcsrtombs __P ((char *__dst, __const wchar_t **__src,
-                             size_t __len, mbstate_t *__ps));
+extern size_t __wcsrtombs __P ((char *__restrict __dst,
+                               __const wchar_t **__restrict __src,
+                               size_t __len, mbstate_t *__restrict __ps));
+extern size_t wcsrtombs __P ((char *__restrict __dst,
+                             __const wchar_t **__restrict __src,
+                             size_t __len, mbstate_t *__restrict __ps));
 
 
 #ifdef __USE_GNU
 /* Write wide character representation of at most NMC bytes of the
    multibyte character string SRC to DST.  */
-extern size_t __mbsnrtowcs __P ((wchar_t *__dst, __const char **__src,
-                                size_t __nmc, size_t __len, mbstate_t *__ps));
-extern size_t mbsnrtowcs __P ((wchar_t *__dst, __const char **__src,
-                              size_t __nmc, size_t __len, mbstate_t *__ps));
+extern size_t __mbsnrtowcs __P ((wchar_t *__restrict __dst,
+                                __const char **__restrict __src, size_t __nmc,
+                                size_t __len, mbstate_t *__restrict __ps));
+extern size_t mbsnrtowcs __P ((wchar_t *__restrict __dst,
+                              __const char **__restrict __src, size_t __nmc,
+                              size_t __len, mbstate_t *__restrict __ps));
 
 /* Write multibyte character representation of at most NWC characters
    from the wide character string SRC to DST.  */
-extern size_t __wcsnrtombs __P ((char *__dst, __const wchar_t **__src,
-                                size_t __nwc, size_t __len, mbstate_t *__ps));
-extern size_t wcsnrtombs __P ((char *__dst, __const wchar_t **__src,
-                              size_t __nwc, size_t __len, mbstate_t *__ps));
+extern size_t __wcsnrtombs __P ((char *__restrict __dst,
+                                __const wchar_t **__restrict __src,
+                                size_t __nwc, size_t __len,
+                                mbstate_t *__restrict __ps));
+extern size_t wcsnrtombs __P ((char *__restrict __dst,
+                              __const wchar_t **__restrict __src,
+                              size_t __nwc, size_t __len,
+                              mbstate_t *__restrict __ps));
 
 
 /* The following functions are extensions found in X/Open CAE.  */
@@ -232,92 +266,124 @@ extern int wcswidth __P ((__const wchar_t *__s, size_t __n));
 
 /* Convert initial portion of the wide string NPTR to `double'
    representation.  */
-extern double wcstod __P ((__const wchar_t *__nptr, wchar_t **__endptr));
+extern double wcstod __P ((__const wchar_t *__restrict __nptr,
+                          wchar_t **__restrict __endptr));
 
 #ifdef __USE_GNU
 /* Likewise for `float' and `long double' sizes of floating-point numbers.  */
-extern float wcstof __P ((__const wchar_t *__nptr, wchar_t **__endptr));
-extern __long_double_t wcstold __P ((__const wchar_t *__nptr,
-                                    wchar_t **__endptr));
+extern float wcstof __P ((__const wchar_t *__restrict __nptr,
+                         wchar_t **__restrict __endptr));
+extern __long_double_t wcstold __P ((__const wchar_t *__restrict __nptr,
+                                    wchar_t **__restrict __endptr));
 #endif /* GNU */
 
 
 /* Convert initial portion of wide string NPTR to `long int'
    representation.  */
-extern long int wcstol __P ((__const wchar_t *__nptr, wchar_t **__endptr,
-                            int __base));
+extern long int wcstol __P ((__const wchar_t *__restrict __nptr,
+                            wchar_t **__restrict __endptr, int __base));
 
 /* Convert initial portion of wide string NPTR to `unsigned long int'
    representation.  */
-extern unsigned long int wcstoul __P ((__const wchar_t *__nptr,
-                                      wchar_t **__endptr, int __base));
+extern unsigned long int wcstoul __P ((__const wchar_t *__restrict __nptr,
+                                      wchar_t **__restrict __endptr,
+                                      int __base));
 
-#if defined (__GNUC__) && defined (__USE_GNU)
+#if defined __GNUC__ && defined __USE_GNU
 /* Convert initial portion of wide string NPTR to `long int'
    representation.  */
-extern long long int wcstoq __P ((__const wchar_t *__nptr, wchar_t **__endptr,
-                                 int __base));
+extern long long int wcstoq __P ((__const wchar_t *__restrict __nptr,
+                                 wchar_t **__restrict __endptr, int __base));
 
 /* Convert initial portion of wide string NPTR to `unsigned long long int'
    representation.  */
-extern unsigned long long int wcstouq __P ((__const wchar_t *__nptr,
-                                           wchar_t **__endptr, int __base));
+extern unsigned long long int wcstouq __P ((__const wchar_t *__restrict __nptr,
+                                           wchar_t **__restrict __endptr,
+                                           int __base));
 #endif /* GCC and use GNU.  */
 
+#if defined __USE_ISOC9X || (defined __GNUC__ && defined __USE_GNU)
+/* Convert initial portion of wide string NPTR to `long int'
+   representation.  */
+extern long long int wcstoll __P ((__const wchar_t *__restrict __nptr,
+                                  wchar_t **__restrict __endptr, int __base));
+
+/* Convert initial portion of wide string NPTR to `unsigned long long int'
+   representation.  */
+extern unsigned long long int wcstoull __P ((__const wchar_t *
+                                            __restrict __nptr,
+                                            wchar_t **__restrict __endptr,
+                                            int __base));
+#endif /* ISO C 9X or GCC and GNU.  */
+
 
 /* The internal entry points for `wcstoX' take an extra flag argument
    saying whether or not to parse locale-dependent number grouping.  */
-extern double __wcstod_internal __P ((__const wchar_t *__nptr,
-                                     wchar_t **__endptr, int __group));
-extern float __wcstof_internal __P ((__const wchar_t *__nptr,
-                                    wchar_t **__endptr, int __group));
-extern __long_double_t __wcstold_internal __P ((__const wchar_t *__nptr,
-                                               wchar_t **__endptr,
+extern double __wcstod_internal __P ((__const wchar_t *__restrict __nptr,
+                                     wchar_t **__restrict __endptr,
+                                     int __group));
+extern float __wcstof_internal __P ((__const wchar_t *__restrict __nptr,
+                                    wchar_t **__restrict __endptr,
+                                    int __group));
+extern __long_double_t __wcstold_internal __P ((__const wchar_t *
+                                               __restrict __nptr,
+                                               wchar_t **__restrict __endptr,
                                                int __group));
 
-extern long int __wcstol_internal __P ((__const wchar_t *__nptr,
-                                       wchar_t **__endptr, int __base,
-                                       int __group));
-extern unsigned long int __wcstoul_internal __P ((__const wchar_t *__nptr,
-                                                 wchar_t **__endptr,
+extern long int __wcstol_internal __P ((__const wchar_t *__restrict __nptr,
+                                       wchar_t **__restrict __endptr,
+                                       int __base, int __group));
+extern unsigned long int __wcstoul_internal __P ((__const wchar_t *
+                                                 __restrict __nptr,
+                                                 wchar_t **
+                                                 __restrict __endptr,
                                                  int __base, int __group));
 #if defined __GNUC__ && defined __USE_GNU
-extern long long int __wcstoq_internal __P ((__const wchar_t *__nptr,
-                                            wchar_t **__endptr, int __base,
-                                            int __group));
-extern unsigned long long int __wcstouq_internal __P ((__const wchar_t *__nptr,
-                                                      wchar_t **__endptr,
-                                                      int __base,
-                                                      int __group));
+extern long long int __wcstoll_internal __P ((__const wchar_t *
+                                             __restrict __nptr,
+                                             wchar_t **__restrict __endptr,
+                                             int __base, int __group));
+extern unsigned long long int __wcstoull_internal __P ((__const wchar_t *
+                                                       __restrict __nptr,
+                                                       wchar_t **
+                                                       __restrict __endptr,
+                                                       int __base,
+                                                       int __group));
 #endif /* GCC and use GNU.  */
 
 
 #if defined (__OPTIMIZE__) && __GNUC__ >= 2
 /* Define inline functions which call the internal entry points.  */
 
-extern __inline double wcstod (__const wchar_t *__nptr, wchar_t **__endptr)
+extern __inline double wcstod (__const wchar_t *__restrict __nptr,
+                              wchar_t **__restrict __endptr)
 { return __wcstod_internal (__nptr, __endptr, 0); }
-extern __inline long int wcstol (__const wchar_t *__nptr,
-                                 wchar_t **__endptr, int __base)
+extern __inline long int wcstol (__const wchar_t *__restrict __nptr,
+                                 wchar_t **__restrict __endptr, int __base)
 { return __wcstol_internal (__nptr, __endptr, __base, 0); }
-extern __inline unsigned long int wcstoul (__const wchar_t *__nptr,
-                                           wchar_t **__endptr, int __base)
+extern __inline unsigned long int wcstoul (__const wchar_t *__restrict __nptr,
+                                           wchar_t **__restrict __endptr,
+                                          int __base)
 { return __wcstoul_internal (__nptr, __endptr, __base, 0); }
 
 #ifdef __USE_GNU
-extern __inline float wcstof (__const wchar_t *__nptr, wchar_t **__endptr)
+extern __inline float wcstof (__const wchar_t *__restrict __nptr,
+                             wchar_t **__restrict __endptr)
 { return __wcstof_internal (__nptr, __endptr, 0); }
-extern __inline __long_double_t wcstold (__const wchar_t *__nptr,
-                                        wchar_t **__endptr)
+extern __inline __long_double_t wcstold (__const wchar_t *__restrict __nptr,
+                                        wchar_t **__restrict __endptr)
 { return __wcstold_internal (__nptr, __endptr, 0); }
 
 
-extern __inline long long int wcstoq (__const wchar_t *__nptr,
-                                     wchar_t **__endptr, int __base)
-{ return __wcstoq_internal (__nptr, __endptr, __base, 0); }
-extern __inline unsigned long long int wcstouq (__const wchar_t *__nptr,
-                                               wchar_t **__endptr, int __base)
-{ return __wcstouq_internal (__nptr, __endptr, __base, 0); }
+extern __inline long long int wcstoq (__const wchar_t *__restrict __nptr,
+                                     wchar_t **__restrict __endptr,
+                                     int __base)
+{ return __wcstoll_internal (__nptr, __endptr, __base, 0); }
+extern __inline unsigned long long int wcstouq (__const wchar_t *
+                                               __restrict __nptr,
+                                               wchar_t **__restrict __endptr,
+                                               int __base)
+{ return __wcstoull_internal (__nptr, __endptr, __base, 0); }
 #endif /* Use GNU.  */
 #endif /* Optimizing GCC >=2.  */
 
diff --git a/wcsmbs/wcscasecmp.c b/wcsmbs/wcscasecmp.c
new file mode 100644 (file)
index 0000000..7490822
--- /dev/null
@@ -0,0 +1,56 @@
+/* Copyright (C) 1991, 1992, 1995, 1996, 1997 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
+   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.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <wctype.h>
+#include <wchar.h>
+
+#ifndef weak_alias
+# define __wcscasecmp wcscasecmp
+#endif
+
+/* Compare S1 and S2, ignoring case, returning less than, equal to or
+   greater than zero if S1 is lexicographically less than,
+   equal to or greater than S2.  */
+int
+__wcscasecmp (s1, s2)
+     const wchar_t *s1;
+     const wchar_t *s2;
+{
+  wint_t c1, c2;
+
+  if (s1 == s2)
+    return 0;
+
+  do
+    {
+      c1 = towlower (*s1++);
+      c2 = towlower (*s2++);
+      if (c1 == '\0')
+       break;
+    }
+  while (c1 == c2);
+
+  return c1 - c2;
+}
+#ifdef weak_alias
+weak_alias (__wcscasecmp, wcscasecmp)
+#endif
diff --git a/wcsmbs/wcsncase.c b/wcsmbs/wcsncase.c
new file mode 100644 (file)
index 0000000..c5b10c5
--- /dev/null
@@ -0,0 +1,55 @@
+/* Compare at most N wide characters of two strings without taking care
+   for the case.
+   Copyright (C) 1992, 1996, 1997 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
+   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.  */
+
+#include <wchar.h>
+#include <wctype.h>
+
+#ifndef weak_alias
+# define __wcsncasecmp wcsncasecmp
+#endif
+
+/* Compare no more than N wide characters of S1 and S2,
+   ignoring case, returning less than, equal to or
+   greater than zero if S1 is lexicographically less
+   than, equal to or greater than S2.  */
+int
+__wcsncasecmp (s1, s2, n)
+     const wchar_t *s1;
+     const wchar_t *s2;
+     size_t n;
+{
+  wint_t c1, c2;
+
+  if (s1 == s2 || n == 0)
+    return 0;
+
+  do
+    {
+      c1 = (wint_t) towlower (*s1++);
+      c2 = (wint_t) towlower (*s2++);
+      if (c1 == L'\0' || c1 != c2)
+       return c1 - c2;
+    } while (--n > 0);
+
+  return c1 - c2;
+}
+#ifdef weak_alias
+weak_alias (__wcsncasecmp, wcsncasecmp)
+#endif
index 01a8950ed44fb9e324a45c4d5cf224d2dd3ccda1..7d91cf33d6ce9834c46c8f2b36934d14ac4f253a 100644 (file)
@@ -25,7 +25,7 @@
 #define        FLT             LDBL
 #define        STRTOF          wcstof
 #define        MPN2FLOAT       __mpn_construct_float
-#define        FLOAT_HUGE_VAL  HUGE_VALf
+#define        FLOAT_HUGE_VAL  HUGE_VALF
 #define        USE_WIDE_CHAR   1
 
 #include "../stdlib/strtod.c"
index 1da8062b803b156516037b9b796cf4f609d6d512..4cb68af1f8b45c59aacedec8a95cb87c1c25ff38 100644 (file)
@@ -25,7 +25,7 @@
 #define        FLT             LDBL
 #define        STRTOF          wcstold
 #define        MPN2FLOAT       __mpn_construct_long_double
-#define        FLOAT_HUGE_VAL  HUGE_VALl
+#define        FLOAT_HUGE_VAL  HUGE_VALL
 #define        USE_WIDE_CHAR   1
 
 #include "../stdlib/strtod.c"
similarity index 97%
rename from wcsmbs/wcstoq.c
rename to wcsmbs/wcstoll.c
index a765ca6985cf8b2c468ebee4cf5778213b23637f..b3e9ac0093c4e17a4b94f4511a88679b2221389b 100644 (file)
@@ -21,3 +21,5 @@
 #define        QUAD    1
 
 #include "wcstol.c"
+
+weak_alias (wcstoll, wcstoq)
similarity index 97%
rename from wcsmbs/wcstouq.c
rename to wcsmbs/wcstoull.c
index 49a5daa4dbf6d66829a2fbd353bdb31ecb5a92f3..a33d3aed6bca7f64c70675b5e45264705c99e17d 100644 (file)
@@ -21,3 +21,5 @@
 #define        QUAD    1
 
 #include "wcstoul.c"
+
+weak_alias (wcstoull, wcstouq)