* libc/stdio/vsprintf.c (vsprintf, _vsprintf_r): Set _file fd to
-1 to be sure it cannot later match a valid file fd causing
isatty() to return 1.
* libc/stdio/asprintf.c (asprintf, _asprintf_r): Ditto.
* libc/stdio/sprintf.c (sprintf, _sprintf_r): Ditto.
* libc/stdio/vasprintf.c (vasprintf, _vasprintf_r): Ditto.
* libc/posix/opendir.c (opendir): Change code to check
for HAVE_FCNTL before calling fcntl.
* libc/search/hash.c (hash_open): Ditto.
* libc/search/hash_page.c (open_tmp): Ditto.
* libc/reent/Makefile.am: Add fcntlr.c.
* libc/reent/Makefile.in: Regenerated.
* libc/reent/fcntlr.c: New file.
* libc/stdio/fdopen.c (_fdopen_r): Change to call _fcntl_r
instead of _fcntl when HAVE_FCNTL flag is set.
* libc/syscalls/sysfcntl.c (fcntl): Check for HAVE_FCNTL flag
to see if _fcntl or _fcntl_r should be called. If flag is not
set, default to ENOSYS stub.
* libc/include/sys/_types.h (_flock_t): Added.
* libc/include/sys/lock.h (__lock_try_acquire): New interface.
(__lock_try_acquire_recursive): Ditto.
* libc/include/sys/reent.h (__sFILE, __sFILE64): Add new
_lock field.
* libc/stdio/findfp.c (std)[!__SINGLE_THREAD__]: Initialize _lock
field.
* libc/stdio/fopen.c (_fopen_r)[!__SINGLE_THREAD__]: Ditto.
* libc/stdio64/fopen64.c (_fopen64_r)[!__SINGLE_THREAD__]: Ditto.
* libc/sys/linux/include/time.h (struct timespec): Moved from
<sys/types.h> and added check for __need_timespec flag so type
can be defined by itself.
* libc/sys/linux/sys/_types.h (_flock_t): New type.
* libc/sys/linux/sys/types.h (struct timespec): Moved to
<time.h>.
* configure.host: Add check for --enable-newlib-io-pos-args
and define WANT_IO_POS_ARGS flag if enabled. Define
the flag by default for x86-linux configurations.
* configure.in: Add support for --enable-newlib-io-pos-args.
* libc/configure.in: Ditto.
* configure: Regenerated.
* libc/configure: Ditto.
* libc/stdio/Makefile.am: Specify -fshort-enums for compiling
vfprintf.c and vfiprintf.c.
* libc/stdio/Makefile.in: Regenerated.
* libc/stdio/vfprintf.c: Add positional argument support that
is enabled by compiling with -DWANT_IO_POS_ARGS.
* configure.host(stdio64_dir): New setting that is used to
enable building of new stdio64 directory.
* libc/Makefile.am[HAVE_STDIO64_DIR]: Add support for
large files.
(stmp-stdio64,stdio64.texi): New targets to optionally add in
stdio64 info to info files.
* libc/Makefile.in: Regenerated.
* libc/configure: Ditto.
* libc/configure.in: Add configuration variables that are set
when stdio64 is selected as subdir in configure.host.
* libc/libc.texinfo: Add optional menu item for Stdio64, based
on whether STDIO64 flag is set or not.
* libc/sys.tex: Add optional stdio64 syscalls based on whether
STDIO64 flag is set or not.
* libc/include/reent.h[__LARGE64_FILES]: Add new stdio64
_r sycall routines.
* libc/include/stdio.h[__LARGE64_FILES]: Add new stdio64 prototypes.
(FILE): Typedef'd to __FILE instead of struct __sFILE directly.
(__SL64): New file flag indicating file is opened via fopen64.
* libc/include/sys/_types.h(_off64_t): Added.
* libc/include/sys/config.h: For x86-linux, define __LARGE64_FILES.
* libc/include/sys/reent.h(struct __sFILE64): New file structure
for 64-bit offset large file support.
(__FILE): New intermediate type either set to struct __sFILE64 or
struct __sFILE, depending on whether __LARGE64_FILES is set or not.
* libc/reent/Makefile.am[HAVE_STDIO64_DIR]: Add new files.
* libc/reent/Makefile.in: Regenerated.
* libc/reent/fstat64r.c: New file.
* libc/reent/lseek64r.c: Ditto.
* libc/reent/open64r.c: Ditto.
* libc/reent/reent.tex: Optionally add stdio64 reentrant syscalls
based on whether STDIO64 flag is set.
* libc/stdio/stdio.tex: Add blank line.
* libc/stdio64/Makefile.am: New file.
* libc/stdio64/Makefile.in: Ditto.
* libc/stdio64/fgetpos64.c: Ditto.
* libc/stdio64/fopen64.: Ditto.
* libc/stdio64/freopen64.c: Ditto.
* libc/stdio64/fseeko64.c: Ditto.
* libc/stdio64/fsetpos64.c: Ditto.
* libc/stdio64/ftello64.c: Ditto.
* libc/stdio64/local64.h: Ditto.
* libc/stdio64/stdio64.c: Ditto.
* libc/stdio64/stdio64.tex: Ditto.
* libc/stdio64/tmpfile64.c: Ditto.
* libc/sys/linux/io64.c: Add weak aliases for lseek64, fstat64, and
open64.
* libc/include/stdio.h (__getline, __getdelim): New prototypes.
* libc/include/time.h [HAVE_GETDATE](getdate, getdate_r): Ditto.
[HAVE_GETDATE](getdate_err): New error code.
* libc/stdio/Makefile.am: Add support for getline.c and getdelim.c.
* libc/stdio/Makefile.in: Regenerated.
* libc/stdio/getdelim.c: New file.
* libc/stdio/getline.c: Ditto.
* libc/sys/linux/Makefile.am: Add support for getdate.c, getdate_err.c
and ntp_gettime.c. Also add AM_CFLAGS to point to libc/stdio.
* libc/sys/linux/Makefile.in: Regenerated.
* libc/sys/linux/getdate.c: New file.
* libc/sys/linux/getdate_err.c: Ditto.
* libc/sys/linux/ntp_gettime.c: Ditto.
* libc/sys/linux/time.c (adjtimex, ntp_adjtime): New functions.
* libc/sys/linux/sys/stdio.h (getline, getdelim): New macros.
* libc/stdio/Makefile.am: Modify to add setbuffer.c and setlinebuf.c.
* libc/stdio/Makefile.in: Regenerated.
* libc/stdio/setbuffer.c: New file.
* libc/stdio/setlinebuf.c: New file.
* libc/stdio/getchar_u.c: New file.
* libc/stdio/putc_u.c: New file.
* libc/stdio/putchar_u.c: New file.
* libc/include/stdio.h: Add declarations for getc_unlocked,
getchar_unlocked, putc_unlocked and putchar_unlocked.
* libc/stdio/Makefile.am (LIB_SOURCES): Add new files.
(CHEWOUT_FILES): Add new files' .def's.
* libc/stdio/putchar.c (_putchar_r): Replace __sputc with putc.
$(COMPILE) rather than $(CC).
* libc/stdio/Makefile.am (LIB_COMPILE): Likewise.
(vfprintf.$(oext)): Remove $(INCLUDES), made redundant by
$(LIB_COMPILE) change.
(vfiprintf.$(oext)): Likewise.
* libc/stdio/fseek.c: Reset pointer to buffer base
when forced to seek outside of current buffer contents.
This prevents the code from erroneously thinking there is
anything in the current buffer.
* libc/include/stdlib.h: add declarations for
_strtoull_r, _strtoll_r, strtoull, and strtoll.
* libc/stdio/local.h: remove declarations of
__strtoull_r and __strtoll_r.
* libc/stdio/vfscanf.c(__svfscanf_r): call
_strtoull_r instead of __strtoull_r. Ditto
_strtoll_r vs. __strtoll_r.
* libc/stdlib/Makefile.am: add new files to
.c list and .def list
* libc/stdlib/Makefile.in: regenerate
* libc/stdlib/strtoll_r.c: rename __strtoll_r
as _strtoll_r
* libc/stdlib/strtoull_r.c: rename __strtoull_r
as _strtoull_r
* libc/stdlib/strtoull.c: new file
* libc/stdlib/strtoll.c: new file
* libc/stdlib/Makefile.am: Add support to build strtoll_r.c
and strtoull_r.c.
* libc/stdlib/Makefile.in: Regenerated.
* libc/stdlib/strtoll_r.c: New file.
* libc/stdlib/strtoull_r.c: New file.
* libc/stdio/local.h: Add prototypes for long long string
conversion routines.
* libc/stdio/vfscanf.c (__svfscanf_r): Add optional long long support
tied to %L integer conversion specifier.
* libc/stdio/findfp (__sinit)[HAVE_FCNTL]: For platforms that have
real file systems, let __smakebuf() determine if line buffering
should be used for stdout.
* libc/stdio/vprintf.c (vprintf): fix signature to use _DEFUN
* libc/stdio/vprintf.c (_vprintf_r): new function
* libc/stdio/vsnprintf.c (vsnprintf): fix signature to use _DEFUN
* libc/stdio/vsnprintf.c (_vsnprintf_r): fix signature to use
_DEFUN, and call _vfprintf_r, not vfprintf.
* libc/stdio/vsprintf.c (vsprintf.c): fix signature to use _DEFUN
* libc/stdio/vsprintf.c (_vsprintf_r): fix signature to use
_DEFUN, and call _vfprintf_r, not vfprintf.
* libc/include/stdio.h[!_REENT_ONLY]: Moved various functions together
into one list.
[!__STRICT_ANSI__]: Moved non-ANSI I/O functions in this list.
(vfscanf, vscanf, vsscanf, _vfscanf_r, _vscanf_r, _vsscanf_r): New
function prototypes.
(_fscanf_r, _sscanf_r): Ditto.
* libc/include/stdlib.h: Added _strtod_r prototype.
* libc/stdio/Makefile.am: Add new v*scanf functions.
* libc/stdio/Makefile.in: Regenerate.
* libc/stdio/fscanf.c: Reorganized so HAVE_STDC only affects prototype
and code is shared. Added reentrant _fscanf_r which calls __svfscanf_r. * libc/stdio/scanf.c: Changed to call __svfscanf_r.
* libc/stdio/sscanf.c: Changed documentation to add reentrant routines.
(sscanf): Changed to call __svfscanf_r with _REENT argument.
(_sscanf_r): New routine.
* libc/stdio/local.h: Removed __svfscanf prototype and replaced it
with __svfscanf_r prototype.
* libc/stdio/vfscanf.c (vfscanf, _vfscanf_r: New
routines.
(__svfscanf_r): Reentrant version of __svfscanf which takes reetrancy
structure as argument as calls reentrant versions of helper functions
(e.g. _strtol_r, _strtoul_r). Also replaced calls to atol and atof
to _strtol_r and _strtod_r respectively.
* libc/stdio/vfscanf.c: Also changed __svfscanf to call __svfscanf_r.
* libc/stdlib/strtod.c (strtod): Changed to call _strtod_r with
_REENT argument.
* libc/stdio/vscanf.c: New file.
* libc/stdio/vsscanf.c: Ditto.
* libc/include/machine/setjmp-dj.h: With DJ Delorie's permission,
changed the copyright information to allow free modification of the
file with no reference to "copying.dj".
* libc/include/sys/stat-dj.h: Ditto.
* libc/machine/i386/setjmp.S: Ditto.
* libc/sys/h8300hms/sys/file.h: Ditto.
* libc/sys/sysmec/access.c: Ditto.
* libc/sys/sysnecv850/access.c: Ditto.
* libc/stdio/mktemp.c: Fixed typo for the word copyright.
* libc/stdlib/getenv_r.c: Ditto.
* libc/stdlib/putenv_r.c: Ditto.
* libc/stdlib/setenv_r.c: Ditto.
* libc/stdlib/getenv.c: Removed DJ reference since any possible
modifications will now be in the _r version of this file.
* libc/stdlib/putenv.c: Ditto.
* libc/stdlib/setenv.c: Ditto.
* libc/sys/go32/copying.dj: Removed DJ's address which is no longer
valid. Added a reference to DJ's web page that contains his address.
* libc/sys/go32/*.s: Removed references to DJ's old address.
* libc/sys/go32/*.c: Ditto.
* libc/sys/go32/*.h: Ditto.
* libc/sys/go32/*.S: Ditto.
* libc/sys/go32/sys/*.h: Ditto.
* libc/stdio/fdopen.c (fdopen): Protect calls to _fcntl() with
HAVE_FCNTL flag check.
* configure.host: Define HAVE_FCNTL for Cygwin, go32, RTEMS, sparc64,
powerpcle, x86 netware, x86 sco, x86 Linux and Vxworks.
* libc/stdio/vfprintf.c (_VFPRINTF_R): Modification to fix
that suppressed . for %.0f, 0.1. Check now looks if there
are padding zeroes (expt) in addition to any digits (ndig) to
print.
* libc/stdlib/ldtoa.c (_ldcheck): New routine
that categorizes a long double as NaN, Infinity, or other.
* libc/stdio/vfprintf.c [WANT_IO_LONG_DBL](_VFPRINTF_R): Removed
isinfl and isnanl static routines which were i386-specific. Changed
calls to the two removed routines to a single _ldcheck call.
* libc/stdio/vfieeefp.h (ldieee): Fixed missing semi-colons.
* libc/stdlib/Makefile.am: Added ldtoa.c to list of sources.
* libc/stdlib/Makefile.in: Regenerated.
* libc/stdio/floatio.h: Added suitable MAXEXP for long double.
* libc/stdio/vfieeefp.h: Added long double bit structures.
* libc/stdio/vfprintf.c[WANT_IO_LONG_DBL]: Added long double support.
[WANT_IO_LONG_DBL](isinfl, isnanl): New static long double routines.
(exponent): Changed expbuf to reasonable maximum instead of MAXEXP.
* libc/stdio/vfscanf.c[WANT_IO_LONG_DBL]: Added long double support.
* libc/stdlib/ldtoa.c: New file containing _ldtoa_r and
_strtold routines used for conversions between character
and long double.
* libc/stdlib/abort.c: changed description: uses "raise" instead of
"getpid" and "kill"; added: uses "write" and "_exit".
Also included unistd.h for "_exit" prototype.
* libc/stdlib/system.c: included unistd.h for "execve" prototype,
reent.h for "_fork_r" and "_wait_r" prototypes.
(do_system): changed extern char *environ[] to POSIX-friendly
extern char **environ.
* libc/stdlib/wctomb_r.c: included string.h for "strlen" and "strcmp"
prototypes.
* libc/stdlib/remove.c: included reent.h for "_unlink_r" prototype.
* libc/reent/execr.c: included sys/wait.h for "wait" prototype.
* libc/reent/fstatr.c: included sys/stat.h for "fstat" prototype.
* libc/reent/openr.c: included fcntl.h for "open" prototype.
* libc/reent/signalr.c: included signal.h for "kill" prototype,
unistd.h for "getpid" prototype.
* libc/reent/statr.c: included sys/stat.h for "stat" prototype.
* libc/reent/timer.c: included sys/time.h for "gettimeofday" prototype.
* libc/unix/getut.c (utmpname): removed local, incorrect "strdup"
prototype. Also included stdlib.h for "abort", string.h for
"strdup" and "strncmp" prototypes.
* libc/unix/getlogin.c: included string.h for "strncmp", "memset", and
"strncpy", unistd.h for "read" and "close" prototypes.
* libc/posix/execvp.c: included string.h for "strchr", "strlen", and
"strcat" prototypes.
* libc/stdio/stdio.c (__swrite): declare "oldmode" only if it's
used later (ifdef __SCLE)
* libc/stdio/vfscanf.c (__svfscanf): declare "state" only if it's
used later (ifdef MB_CAPABLE)
* libc/string/memset.c (memset): removed unused variables "count"
and "unaligned_addr"
* libc/locale/locale.c (_setlocale_r): declare "lc_ctype" and
"last_lc_ctype" only of they're used later (ifdef MB_CAPABLE)
* libc/unix/getpwent.c (getpwnam): removed unused variables "uid"
and "gid"