@node Changes in 2.04, , Changes in 2.03, What Changed
@section Changes in 2.04

Here is a list of changes from DJGPP V2.03 to V2.04.

@findex uname@r{, CPU type detection}
Ability to report the exact CPU type in @code{uname}.

@findex _creat@r{, and FAT32}
@findex _creatnew@r{, and FAT32}
@findex _open@r{, and FAT32}
The functions @code{_creat}, @code{_creatnew} and @code{_open} now set
extended size flag in DOS calls to be able to create files with size up
to @math{2^32-1}, supported on FAT32 volumes.

@findex llseek@r{, and FAT32}
The function @code{llseek} added with type @code{offset_t} to support
file seeks up to @math{2^32-2}.

@findex statfs@r{, and FAT32}
The function @code{statfs} have been made to report correct values >
@math{2^31} on FAT32 partitions.

@findex _invent_inode@r{, and FAT32}
The function @code{_invent_inode} has been changed to start numbering
invented inodes from @code{USHRT_MAX+1} to @math{2^28+1}.

@findex _is_cdrom_drive
@findex _is_ram_drive
@findex _media_type
Functions @code{_is_cdrom_drive}, @code{_is_ram_drive} and
@code{_media_type} has been taken out of @file{mntent.c} and made
externally callable.

@findex _get_fat_size
@findex _get_fs_type
@findex _is_fat32
New functions @code{_get_fat_size}, @code{_get_fs_type} and
@code{_is_fat32} added.

@cindex @file{stdarg.h}, implemented with GCC builtins
@cindex @file{varargs.h}, implemented with GCC builtins
@findex va_list@r{, implemented with GCC builtins}
@findex va_start@r{, implemented with GCC builtins}
@findex va_arg@r{, implemented with GCC builtins}
@findex va_end@r{, implemented with GCC builtins}
@findex va_alist@r{, implemented with GCC builtins}
@findex va_dcl@r{, implemented with GCC builtins}

When used together with GCC 2.96 or later, va_list facilities
in @file{stdarg.h} and @file{varargs.h} are implemented using new
builtins from GCC 2.96.

@pindex fsdb@r{, check for EXE extension}
@code{fsdb} checks for executables and loads them even if
the extension @file{.exe} isn't given in the command line.

@findex div@r{, and negative arguments}
@findex ldiv@r{, and negative arguments}
@findex lldiv@r{, and negative arguments}
@code{div}, @code{ldiv} and @code{lldiv} return properly signed remainders
for negative arguments.

@findex remove@r{, and write-protected floppies}
The function @code{remove} works around a DOS bug, whereby DOS returns a
``File not found'' error for write-protected floppy disks.

@findex rand@r{, increased period}
The series produced by @code{rand} have a longer period.

@findex drand48@r{, increased speed}
@findex erand48@r{, increased speed}
The execution speed of @code{drand48} and @code{erand48} has been improved.

@findex __dpmi_simulate_real_mode_procedure_retf_stack@r{, stack corruption}
@code{__dpmi_simulate_real_mode_procedure_retf_stack} no longer corrupts
the caller's stack.

@findex getlogin@r{, and @code{USERNAME} variable}
@code{getlogin} now examines the environment variable @env{USERNAME} to
determine the user's name, in addition to @env{USER} and @env{LOGNAME}.

@findex stpncpy@r{, added to the library}
New function @code{stpncpy} has been added, thanks to
@email{restone@@skypoint.com, Richard E. Stone}.

@findex setitimer@r{, and zero @code{it_interval.tv_usec}}
Calling the @code{setitimer} function with both
@code{it_interval.tv_sec} and @code{it_interval.tv_usec} members of
@code{struct itimerval} set to zero no longer causes the timer to behave
as if @code{it_interval.tv_usec} were set to the system clock
granularity (55@dmn{msec} by default).

@findex __internal_readlink@r{, added to the library}
@findex __solve_dir_symlinks@r{, added to the library}
@findex __solve_symlinks@r{, added to the library}
@findex lchown@r{, added to the library}
@findex lstat@r{, added to the library}
@findex readlink@r{, added to the library}
@findex S_ISLNK@r{, added to the library}
@findex S_IFLNK@r{, added to the library}
UNIX-style symbolic links are fully emulated by library.  As a part of
this, new functions @code{__internal_readlink}, @code{__solve_symlinks},
@code{__solve_dir_symlinks}, @code{lchown}, @code{lstat} and @code{readlink};
new macros @code{S_ISLNK} and @code{S_IFLNK} have been added to library.

@findex O_NOLINK@r{, new flag accepted by @code{open}}
@findex O_NOFOLLOW@r{, new flag accepted by @code{open}}
@findex open@r{, supports symlinks}
@code{open} now follows symlinks when opening file.  Also, it honors two new
mode flags: @code{O_NOLINK} and @code{O_NOFOLLOW}.

@findex symlink@r{, supports symlinks}
As a part of symlink emulation, @code{symlink} no longer emulates symlinks
to executables by creating stubs.  It creates symlinks to all files instead.

@findex syms_init@r{, crashes for large programs}
@pindex symify@r{, crashes for large programs}
A subtle bug was corrected in function @code{process_coff} used by
@code{syms_init} from @file{libdbg.a} to read and sort the symbols from
a @sc{coff} image.  As a result, the @code{symify} utility should no
longer crash in rare cases, especially when invoked on large programs.

@cindex @file{lib/djgpp.djl}, polluting the namespace unnecessarily
@cindex linker script, polluting the namespace unnecessarily
@cindex @code{etext}, polluting the namespace unnecessarily
@cindex @code{edata}, polluting the namespace unnecessarily
@cindex @code{end}, polluting the namespace unnecessarily
@cindex profiling, polluting the namespace unnecessarily
The linker script @file{lib/djgpp.djl} corrected to not unnecessarily
pollute the name space with the symbols @code{etext}, @code{edata} and
@code{end}.  The profiling code was also changed to not pollute the name
space with @code{etext}.

@pindex dtou@r{, new command-line options}
The @code{dtou} program accepts new command-line options for verbose
operation, backup file creation, and control of file timestamp
preservation.  Its source can now be compiled on a Unix or GNU/Linux
system.

@cindex header files and GCC
The protection against multiple redefinitions of various
types like @code{size_t} has been rewriten to make DJGPP
header files compatible with GCC provided ones.

@cindex @code{bzip2} archives
@pindex djtar@r{, support for unpacking @code{bzip2} archives}
The @code{djtar} program can now unpack @file{.tar.bz2} archives
compressed with the @code{bzip2} program.

@findex system@r{, invokes Windows programs with long command lines}
@findex spawn*@r{ functions, invoke Windows programs with long command lines}
@cindex startup code, supports long command lines passed by Windows programs
@vindex CMDLINE@r{, environment variable}
@pindex 4DOS@r{, support for long command lines}
@pindex NDOS@r{, support for long command lines}
The functions @code{system} and @code{spawn*} can invoke Windows
programs and advanced shells, such as @code{4DOS} and @code{NDOS}, with
command lines longer than 126 characters.  For Windows programs, the
command line can be up to 1015 characters long; @code{4DOS} and
@code{NDOS} can be passed up to 247 characters.  This is done by
defining the @env{CMDLINE} environment variable whose value is the
command line.  The DJGPP startup code also supports @env{CMDLINE}
method of passing long command lines, so DJGPP programs can now be
invoked with long command lines from the @file{COMMAND.COM}'s prompt,
and also from other Windows programs which support @code{CMDLINE}.
The functions @code{system} and @code{spawn*} have also been enhanced
to free DPMI selectors leaked by many DPMI hosts.  This fixes the
problem with large makefiles failing before completion under Windows.
@findex spawn*@r{, no longer leak selectors on Windows and DOSEmu}
@findex system@r{, no longer leaks selectors on Windows and DOSEmu}
@pindex make@r{, no longer fails on large jobs due to selector leaks}

@findex _rename@r{, change letter-case of a file name}
@findex rename@r{, change letter-case of a file name}
The functions @code{rename} and @code{_rename} can now be used to change
the letter case of a file name, like in this snippet:

@example
 rename ("makefile", "Makefile");
@end example

@noindent
(This only works when the LFN support is available, of course.)

@cindex search for executables, some extensions omitted
@cindex @file{.sh}, @file{.ksh}, @file{.pl}, @file{.sed} extensions
@findex __dosexec_find_on_path@r{, some extensions excluded from search}
@findex system@r{, some extensions excluded from @code{PATH} search}
@findex popen@r{, some extensions excluded from @code{PATH} search}
@findex pclose@r{, some extensions excluded from @code{PATH} search}
@findex spawn@r{, some extensions excluded from @code{PATH} search}
The function @code{__dosexec_find_on_path} no longer looks for files
with the @file{.sh}, @file{.ksh}, @file{.pl}, and @file{.sed} extensions
before the files without those extensions.  This is so e.g.@: @file{foo}
is found @emph{before} @file{file.sh} if both of them are present in the
same directory.  The previous code was known to cause Bash to run the
wrong script in some cases.

This change affects all library functions which search for executables
along the @code{PATH}: @code{system}, @code{popen}, @code{pclose}, and
the functions from the @code{spawn*} family.

The DOS standard extensions @file{.com}, @file{.exe}, @file{.bat}, and
@file{.btm} are still included in the search @emph{before} looking for
the file name itself, for compatibility with stock DOS/Windows shells.

@findex valloc@r{, added to the library}
@findex memalign@r{, added to the library}
The functions @code{valloc} and @code{memalign} have been added to the
library to support allocating memory at power-of-2 addresses.

@pindex djsplit@r{, preserves file's time stamp}
@pindex djmerge@r{, preserves file's time stamp}
The @code{djsplit} and @code{djmerge} utilities now preserve the
original file's time stamp and mode bits.  The @samp{-t} switch to those
programs restores the old behavior, where each file was created with the
current time stamp and default attribute bits.

@findex _put_path@r{, and the @file{/dev/env} directory}
The low-level function @code{_put_path} was changed to avoid referencing
an @file{env} directory in the current working directory when library
functions are passed the @file{/dev/env} file name.  This avoids
creating spurious @file{env} directories in any directory where the
standard GNU @code{mkinstalldirs} script is run.

@findex rename@r{, and Windows 2000}
@findex _rename@r{, and Windows 2000}
@cindex linking programs on Windows 2000
@pindex stubify@r{, and Windows 2000}
Functions @code{rename} and @code{_rename} work on Windows 2000 when the
file under the new name already exists.  This solves the problems with
linking DJGPP programs and with running the @code{stubify} utility on
that OS.

@findex lfilelength@r{, and FAT32}
The function @code{lfilelength} added with return type @code{long long}
to support file sizes of up to @math{2^63-1}.

@pindex djasm@r{, documentation}
Texinfo documentation (WIP) for @code{djasm} has been added.

@pindex djasm@r{, ISO dates}
The dates inserted into the object file by @code{djasm} now follow ISO
format.

@pindex djasm@r{, new executable header offset}
@code{djasm} now sets the offset of new executable field in the header
of executables to zero (meaning not used).

@pindex djasm@r{, space allocation with .union}
Allow one to allocate space in @code{djasm} using @code{.union}
(instead of @code{.struct}) when using a union.  As there is no
checking, @code{.struct} and @code{.union} are interchangeable.
This feature taken from a version of @code{djasm} maintained by
@email{bill@@taniwha.org, Bill Currie}.

The @code{fcntl} function has been significantly enhanced.  In
particular:

@itemize @minus{}
@item
@cindex file locking functions
@findex fcntl@r{, added file locking}
File locking functions (which were missing in every version up to
v2.03) now work, with some exceptions relating to the absence of any
read locking in DOS/Windows 9X environments.

@item
@findex fcntl@r{ commands @code{F_GETFD} and @code{F_SETFD}}
These functions now interrogate and use the value of the DOS flag
@code{_DEV_NO_INHERIT} to implement the @code{FD_CLOEXEC} flag;

@item
@findex fcntl@r{ commands @code{F_GETFL} and @code{F_SETFL}}
The @code{F_SETFL} function is still an effective no-op, since
DOS/Windows does not allow flags to be modified on an open file.
A small exception is made for @code{F_SETFL}:  You may use @code{F_SETFL}
to remove the@code{O_NONBLOCK} flag, because it is not supported
by DJGPP anyway, and it does no harm to allow this functionality.

The @code{F_GETFL} function now computes the open mode and status flags.
On Windows NT this cannot report the open mode correctly ---
@code{O_RDONLY} is always returned.

@item
Documentation has been updated to reflect the new functionality and
test programs have been provided for most new or changed functions.
@end itemize

@findex flock
@findex lockf
@findex llockf
@code{flock} has been implemented using the new @code{fcntl} locking
functions to implement file-level locking and unlocking.  @code{lockf}
(31-bit support) and @code{llockf} (FAT32 support, 32-bit only) have
been added as compatible interfaces to the new @code{fcntl} locking
functions.

@findex dosexterr
@findex dostrerr
New function @code{dostrerr} has been coded to provide string
values for the error codes returned from function @code{dosexterr}.
Documentation and a test program have been provided.  This function is
an analogue of the @code{strerror} function for errno values, and is
intended to be used when coding functions or programs that call DOS and
want to print messages when errors occur.

@findex _dos_lk64
@findex _dos_unlk64
@findex lock64
@findex unlock64
New functions @code{_dos_lk64} and @code{_dos_unlk64} have been added to
provide a FAT32-compatible interface to the DOS locking code.
Compatible functions @code{lock64} and @code{unlock64} are direct
interfaces to these two new @code{_dos_*} functions.

@pindex djasm@r{, enumeration type}
Support for enumeration type added to @code{djasm}.
This feature taken from a version of @code{djasm} maintained by
@email{bill@@taniwha.org, Bill Currie}.

@cindex C99 compliance, new header files
Header files, which are part of the new ANSI/ISO C99 Standard, are now
available.  These include @file{stdint.h}.

@cindex namespace @code{std} support
When used in C@t{++} programs, the standard C header files now make
their contents visible in namespace @code{std} as well as in the global
namespace.

@findex setjmp@r{, also a macro}
@code{setjmp} is now a macro as well as a function.  This is required by
the C@t{++} standard, and also recommended by the C standard.

@findex _get_dos_version@r{, recognise FreeDOS}
@code{_get_dos_version} now recognises @acronym{OEM} number @code{0xfd}
as FreeDOS.

@findex strtol@r{, and 8-bit characters}
@findex strtoll@r{, and 8-bit characters}
@findex strtoul@r{, and 8-bit characters}
@findex strtoull@r{, and 8-bit characters}
@findex atoi@r{, and 8-bit characters}
@findex atol@r{, and 8-bit characters}
Functions which convert numeric strings to the corresponding integer
values no longer return non-zero values for strings which begin with
8-bit characters.

@findex O_TEMPORARY@r{, new flag accepted by @code{open}}
@findex open@r{, supports temporary files}
@code{open} now honors @code{O_TEMPORARY}.  A file opened with
@code{O_TEMPORARY} will be deleted when all file descriptors that refer
to it are closed.

@findex _rename@r{, on Windows ME}
@findex rename@r{, on Windows ME}
@findex mkdir@r{, on Windows ME}
@pindex stubify@r{, on Windows ME}
The functions @code{_rename} (and @code{rename} which calls it) and
@code{mkdir} no longer fail on Windows ME when long file names support
is disabled.  This solves the problem with failures to link programs if
the @env{LFN} variable is set to @samp{n} because @code{stubify.exe}
failed to rename the produced executable and reported @code{EINVAL}.

@findex write@r{, security fix and increased POSIX compliance}
@findex _write@r{, security fix}
When @code{write} and @code{_write} detect that a file pointer is past EOF,
that space will now be filled with zeroes to increase POSIX compliance
and plug a security hole on disks containing sensitive information.

@pindex djtar@r{, DOS batch file conversion}
If a tar archive contains DOS batch files that have been stored with
UNIX-style LF-only EOLs, @code{djtar} will now convert them
automatically to DOS-style EOLs.  This is because @file{COMMAND.COM}
refuses to run batch files that contain UNIX-style EOLs.

@findex pipe@r{, now implemented in the library}
The function @code{pipe} is now implemented in the library.

@findex spawn*@r{, invoking @file{.com} programs}
@file{.com} programs are now invoked by the @code{spawn*} family of
functions directly, thus making their exit status available to the
parent DJGPP program.  Previously, when long file names were supported,
@file{.com} programs were invoked through @file{COMMAND.COM}, which
would lose the exit status.

@findex select@r{, and termios emulation}
File handles connected to the console device are no longer reported by
the @code{select} function as not ready for input when termios functions
are used to read those handles in cooked mode.

@findex snprintf
@findex vsnprintf
New functions @code{snprintf} and @code{vsnprintf} added.

@pindex djasm@r{, double-precision shift}
The double-precision shift instructions @code{shld} and @code{shrd} are
removed from @code{djasm} because they violate the established convention
of using the @code{b}, @code{w}, or @code{d} mnemonic suffix to specify
the memory operand size.  (The result is that they use up two mnemonics
that should have been reserved for the basic shift/rotate instructions.)

@pindex djasm@r{, shift instructions}
@pindex djasm@r{, rotate instructions}
Completed the support in @code{djasm} for the byte/word/double
shift/rotate instructions.  This feature taken from a version of
@code{djasm} maintained by @email{bill@@taniwha.org, Bill Currie}.

@findex fopen@r{, append mode}
@findex freopen@r{, append mode}
@findex fputc@r{, append mode}
@findex fprintf@r{, append mode}
@findex fwrite@r{, append mode}
@findex write@r{, append mode}
@cindex @file{libc/dosio.h}, append mode
The functions @code{fopen} and @code{freopen} improved to handle the
append mode properly.
The functions @code{fputc}, @code{fprintf}, @code{fwrite} and
@code{write} always seek to end of file if the file has been opened in
append mode.
Type of @code{__file_handle_modes} extended to be able to hold the
@code{O_APPEND} flag.

@findex fdopen@r{, no longer uses _IOAPPEND flag}
@findex fflush@r{, no longer uses _IOAPPEND flag}
@findex flsbuf@r{, no longer uses _IOAPPEND flag}
@findex fopen@r{, no longer uses _IOAPPEND flag}
@findex freopen@r{, no longer uses _IOAPPEND flag}
@cindex @file{libc/file.h}, _IOAPPEND flag deleted
Due to the improved append mode implementation, the functions @code{fopen},
@code{fflush}, @code{_flsbuf}, @code{fopen}, and @code{freopen} no longer
use the @code{_IOAPPEND} flag.  And since the flag is no longer used, the
@code{_IOAPPEND} flag has been deleted from @file{libc/file.h}.

@findex getopt@r{, enhanced for POSIX compliance}
When the first character in the valid options string is a colon @samp{:},
@code{getopt} will now return a colon when a missing option argument is
detected and will not print error messages even when @code{opterr} is
non-zero.

@findex readdir@r{, reports file types}
@cindex @code{struct dirent}, @code{d_type} member
The function @code{readdir} now includes the file's type in the
@code{d_type} member of @code{struct dirent} it returns.  This member is
used by some GNU packages, such as Fileutils, to make directory
traversal more efficient.  @strong{WARNING: This makes some object files
built with DJGPP v2.03 incompatible with programs compiled with the
v2.04 library!}

@findex moncontrol@r{, added}
@findex monstartup@r{, added}
Two new functions, @code{monstartup} and @code{moncontrol}, allow to
control when profiling starts and ends, and what range of addresses is
recorded in the profiling data.

@findex mallinfo@r{, added}
@findex malloc_verify@r{, added}
@findex malloc_debug@r{, added}
@findex mallocmap@r{, added}
@findex malloc@r{, debug facilities}
There are new @code{malloc} debug facilities.  While not as powerful and
versatile as existing external packages, such as @acronym{YAMD}, these
facilities do allow to detect a wide variety of heap corruption
problems, and to report important heap usage statistics.  The new
functions are @code{mallinfo}, @code{malloc_debug},
@code{malloc_verify}, and @code{mallocmap}; these names are compatible
with many Unix and GNU/Linux systems.  In addition, special hooks, such
as @code{__libc_malloc_hook} and @code{__libc_free_hook}, are provided
for building custom @code{malloc} debugging packages.

@cindex startup code, and crashes on Windows
Nested DJGPP programs which are run by other DJGPP programs on Windows
should no longer crash (and take the DOS box with them) due to the fact
that Windows leaks selectors.  These crashes were caused by a failure to
allocate a selector for conventional memory, and subsequent use of the
invalid selector by the startup code itself.  This problem was typical
for Make, Bash, and any other program which can launch lots of child
programs without ever exiting to DOS.  To avoid this, the startup code
was fixed to print an error message and exit to DOS with an exit status
that indicates a failure, when a selector for DOS memory could not be
allocated by the DPMI host.

@findex confstr@r{, added}
@code{confstr} has been added to the library to support returning
system-dependent configuration in strings.

@cindex @file{djgpp.env}, @code{ls} color settings for symlinks added
Colors for symlinks were added to the @env{LS_COLORS} environment variable
in @file{djgpp.env}.

@pindex djasm@r{, double-precision shift reinstated}

Double-precision shift instructions reinstated in @code{djasm},
using a simplified form of the implementation suggested by
@email{bill@@taniwha.org, Bill Currie}.  The new mnemonics are
@code{dshl} and @code{dshr}, and no memory operand-size suffix
is required.  Obsolete usage of @code{shld} and @code{shrd}
for double-precision shifts is flagged.

@findex l64a@r{, added}
@findex a64l@r{, added}
Two new functions, @code{l64a} and @code{a64l} (both part of the @sc{posix}
draft standard), allow you to convert a 32-bit integer value to and from a
base-64 encoding, respectively.
Note that the encoding used is the one mandated by the @sc{posix} spec, and
not the one used by either @command{uuencode} or the @sc{mime} base64
encoding.

@findex setenv@r{, minor changes for @sc{posix} compliance}
@findex putenv@r{, minor changes for @sc{posix} compliance}
@findex unsetenv@r{, added}
The environment functions @code{setenv} and @code{putenv} are now both
part of the @sc{posix} draft standard and were updated to match the
specs set forth by that standard.  Both now set @code{errno} in case of
failure, and @code{putenv}'s argument is now a @code{char*} instead of
a @code{const char*}.
A new function, @code{unsetenv}, which is also part of that standard, was
added.

@findex struct group@r{, added @code{gr_passwd} field}
@code{struct group} has a new field, @code{gr_passwd}.  This helps out
porters, as many Unixy apps expect it to exist.  Since @sc{dos} is
basically an insecure environment, this field always contains the empty
string.
@findex struct passwd@r{, added @code{pw_gecos} field}
@findex struct passwd@r{, added @code{pw_passwd} field}
Similarly, @code{struct passwd} has two new fields, @code{pw_gecos} and
@code{pw_passwd}.  @code{pw_gecos} gets the same value as @code{pw_name}
(i.e. the value returned by @code{getlogin()}).  Like @code{gr_passwd},
@code{pw_passwd} gets the empty string as value.

@findex uname@r{, support for Pentium 4}
The function @code{uname} supports the new Pentium 4 CPU's by returning
@code{"i786"} in the @code{machine} member of @code{struct utsname} it
returns.

@findex gettext@r{, name clash, @file{conio.h} vs @acronym{GNU} Gettext}
A name conflict between @code{gettext} declared in @file{conio.h} and
@code{gettext} provided by @acronym{GNU} Gettext has been resolved.

@findex malloc@r{, and huge allocation requests}
@code{malloc} now declines ridiculously large allocation requests which
exceed 2GB - 64KB.  This is because anything larger is not supported by
@code{sbrk} and by most DPMI hosts.  Previously, @code{malloc} would
sometimes allocate a very small buffer due to wrap-around of large
unsigned numbers, and the calling program would then crash when it tried
to use that buffer.

@findex v2loadimage@r{, long command line support}
@code{v2loadimage} now supports long command lines, instead of being
restricted by the DOS 126-character limit.

@findex __djgpp_spawn@r{, added to the library}
A new function, @code{__djgpp_spawn}, has been added to allow control over
whether a search for executable extensions is performed.

@findex glob@r{, fixed buffer overrun}
The function @code{glob} and its helper functions have been changed to prevent
an internal buffer from being overrun when the pattern to be expanded has more
than 2000 characters.

@cindex nested DJGPP program on Windows 2000
There's now a work-around for the bug in NTVDM, the DOS emulator, which
ships with Windows 2000: nested DJGPP programs no longer cause NTVDM to
crash.  This allows to use GCC, Make, RHIDE, Bash, and other programs
which routinely invoke child programs.

@findex utime@r{, on Windows 2000 and XP}
@pindex touch@r{, on Windows 2000 and XP}
@pindex dtou@r{, on Windows 2000 and XP}
@pindex utod@r{, on Windows 2000 and XP}
@pindex recode@r{, on Windows 2000 and XP}
@cindex time stamp of directories, changing
The function @code{utime} now works on Windows 2000 and Windows XP.
Previously, it would fail with @code{errno} set to @code{EIO}; this
affected programs like @code{touch}, @code{dtou}, and @code{recode},
which set time stamps of files.  In addition, @code{utime} now allows to
set the time stamp of directories, but only on Windows 2000 or XP (other
versions of Windows do not allow to change time stamps of directories).

@findex sbrk@r{, fixed address wrap where illegal}
@cindex @file{crt0.h}, added new flag to control wrap
@cindex address wrap crashes on Windows NT, 2000, XP
A fix has been applied to the memory allocation routines in @code{sbrk}
to prevent use of memory which would require address wrap when the host
DPMI provider does not allow 4Gb address limits.  This feature may also
be enabled in other environments which do not require it to get better
memory protection.  @code{_CRT0_DISABLE_SBRK_ADDRESS_WRAP} flag was added
to @code{_crt0_startup_flags} in file @file{crt0.h}

@vindex __djgpp_memory_handle_size@r{, added to library}
@cindex @file{crt0.h}, declaration of memory size array
@cindex array of DPMI memory block sizes
A list of memory block sizes @code{__djgpp_memory_handle_size} was added for
use in core dumps of the address space.

@findex sbrk@r{, changed allocation size algorithm}
@cindex DPMI memory block allocation sizes dynamic
Change the round up size for memory block allocations in @code{sbrk} to increase with
the number of handles allocated.  This helps keep the number of handles
to the 256 allocated and reduce problems exhausting DPMI handle resources.

@findex dup@r{, duplicates @code{FSEXT} hooks}
@findex dup2@r{, duplicates @code{FSEXT} hooks}
The functions @code{dup} and @code{dup2} now copy to the new handle any
Filesystem Extensions which hooked the original handle.  Thus, the
duplicate handle now behaves exactly like the original one, in that it
is also hooked by the extension.

@findex fstat@r{, and Windows 2000/XP}
@findex link@r{, and Windows 2000/XP}
@pindex cp@r{, and Windows 2000/XP}
The function @code{fstat} now work arounds incompatibilities in DOS
IOCTL interface on Windows 2000 and Windows XP, and as a result returns
correct read/write permissions in @code{st_mode} and correct device code
in @code{st_dev} members of @code{struct stat}.  This was known to fail
functions like @code{link} and programs like GNU @code{cp} which tested
files for being on the same filesystem by calling @code{fstat}.

@findex open@r{, and Windows 2000/XP}
@findex _open@r{, and Windows 2000/XP}
@findex _creat@r{, and Windows 2000/XP}
@findex _creatnew@r{, and Windows 2000/XP}
The long file name support in Windows 2000 and XP have bugs which cause
handles returned with long name opens to give incorrect information in
many library routines.  Routines which open files now open using short
name calls under Windows NT, 2K and XP if long file names are enabled.

@pindex fsdb@r{, and Windows 2000/XP hardware breakpoints}
@pindex edebug32@r{, and Windows 2000/XP hardware breakpoints}
@findex _set_break_DPMI@r{, and Windows 2000/XP breakpoints}
The set break DPMI call under Windows 2000 and XP do not return the
break point handle, which prevented debuggers using break points from
working properly.  The handle is now guessed for this platforms which
allows the debuggers to work with hardware break points.

@findex getcwd@r{, and Windows 2000/XP long named directories}
@findex _fixpath@r{, and long named directories}
If the short name equivalent of the current path is greater than
64 characters, Windows 2000 and XP do not return the correct long
path name - they return the root directory instead without any
failure code.  Since this can be disastrous in deep directories
doing an rm -rf, we check for this bug and fix the path.  Long
directories can also cause @code{_fixpath} to fail on Windows 9x if LFN=n and
this is now handled by returning a relative path instead of root.
Many uses of @code{_fixpath} assume absolute directories so this
change may break code in rare cases (such as saving the value and
changing directories).

@findex getmntent@r{, and Windows 2000/XP}
Windows 2000/XP do not return the volume labels correctly using
findfirst calls so we force short name usage to fix the problem.
Drives higher than Z are suppressed.

@findex freopen@r{, and reusage of same handle}
@code{freopen} was modified to always use the same handle even if
it is not the first one available.

@vindex _os_trueversion@r{, added to the library}
This global variable declared in @file{dos.h} is a faster way to
get the result of @code{_get_dos_version(1)}.

@pindex djtar@r{, new option -e}
@pindex djtar@r{, multiple -o and -e options}
New option @samp{-e} has been added to @code{djtar} to skip specified files
and directories when extracting.  Also @code{djtar} can accept multiple
@samp{-o} and @samp{-e} options in a single command line.  Finally, the file
name change file format allows skipping files and directories.

@findex fgetpos
The function @code{fgetpos} will now fail, if it is unable to determine
the current offset for a stream.  Previously the failure would have been
silently ignored.

@findex _is_DOS83
New function @code{_is_DOS83} added to the library to support filename
case lowering.  This replaces the functionality used from @code{_lfn_gen_short_fname}
which is hopelessly buggy on Windows 2000 and XP.  New function used in
@file{srchpath.c}, @file{readdir.c}, @file{glob.c}, @file{fixpath.c},
@file{lstat.c} and @file{getcwd.c}.

@findex stat@r{, and block size}
@findex lstat@r{, and block size}
@findex fstat@r{, and block size}
The functions @code{stat}, @code{lstat} and @code{fstat} now fill
the @code{st_blksize} member of @code{struct stat} with the correct block
size for the device where the file is located.

@tindex blksize_t
@tindex blkcnt_t
@tindex struct stat@r{, and }blksize_t
The types @code{blksize_t} and @code{blkcnt_t} were added.
@code{blksize_t} is now used for the @code{st_blksize} member of
@code{struct stat}.

@cindex C libraries and profiling
@cindex libc and profiling
@cindex libm and profiling
@cindex @file{emu387.dxe} and profiling
@cindex @file{gcc.opt}, and profiling
The build system for the C libraries was modified, so that profiling
versions can be built.  Profiling options in @file{gcc.opt} are ignored
for certain files in the C libraries' sources.  The build system for
@file{emu387.dxe}, the math co-processor emulation library, was also
modified, so that it can be built against a profiled version of libc.

@findex strftime@r{, and z format}
Corrected problem with negative gmt offsets with z format in @code{strftime}.

@vindex DJGPP@r{, environment variable and memory corruption}
@cindex startup code, and memory corruption
The startup code was updated, to prevent memory corruption when
the @env{DJGPP} environment variable is not set.

@findex fstatvfs
@findex statvfs
The functions @code{fstatvfs} and @code{statvfs} have been added.
@code{statvfs} does much the same as @code{statfs}, but it is
POSIX-compliant.

@cindex @file{/dev/zero}
@findex __install_dev_zero@r{, install support for @file{/dev/zero}}
@cindex @file{/dev/full}
@findex __install_dev_full@r{, install support for @file{/dev/full}}
Optional support for the devices @file{/dev/zero} and @file{/dev/full} was
added.  This is enabled using the @code{__install_dev_zero} and
@code{__install_dev_full} functions.

@pindex mkdoc@r{, clearer style for portability information}
@pindex mkdoc@r{, support for multiple versions of standards}
The @code{mkdoc} program is used to build the C library documentation.
@code{mkdoc} now produces portability information in a clearer manner,
to avoid ambiguity.  @code{mkdoc} also now allows multiple versions of
standards to be specified in the portability information,
e.g.@: ANSI C89 and C99.

@cindex debuggers, and exceptions 18 and 19
The debug support routines in @file{libdbg.a} now support exceptions
18 and 19 (in case the application being debugged hooks them), and no
longer overwrite memory when exceptions higher than 19 are used by
the debuggee.

@findex fchown
The function @code{fchown} was added.

@cindex File System Extensions, and large numbers of file descriptors
A bug was fixed in the File System Extensions mechanism that could be
exposed in environments where it is possible to have large numbers of
file descriptors (> 256) and low memory.

@findex __doserr_to_errno@r{, wildcards on Windows 2000 and XP}
The @code{errno} value is now set correctly when a file open fails
due to wildcard (illegal) characters in the name.  If a wildcarded
name failed to match the error message was EFAULT and misleading.

@findex pow
A bug was fixed in the function @code{pow} in @file{libm.a}.
Previously @code{pow(x,y)} returned 0 when @code{x} was very close to
-1.0 and @code{y} was very large.

A bug was fixed in the function @code{pow} in @file{libc.a}.
Previously @code{pow} may have failed for negative numbers with
a large magnitude.

@findex findfirst
A bug was fixed in the function @code{findfirst}.  Previously
unexpected behaviour may have resulted, if the attribute argument
had a value outside the range describable by the @code{FA_*} constants.

@findex realpath@r{, added to library to increase @sc{posix} compliance}
The function @code{realpath} was added. @code{realpath} does much the same
as @code{_fixpath}, but is @sc{posix} compliant and resolves symlinks.

@findex isblank
The function @code{isblank} was added.

@cindex C99 compliance, @code{struct lconv}
@cindex C99 compliance, @file{locale.h}
@tindex struct lconv
The @code{int_n_cs_precedes}, @code{int_n_sep_by_space},
@code{int_n_sign_posn}, @code{int_p_cs_precedes},
@code{int_p_sep_by_space} and @code{int_p_sign_posn} members were added
to @code{struct lconv}, to comply with the C99 standard.

@findex _Exit
The function @code{_Exit} was added.

@findex atoll
The function @code{atoll} was added.

@findex strtold
The function @code{strtold} was added.

@findex scanf@r{, and the X type conversion and C99}
The behaviour of the @code{%X} type conversion for the @code{scanf}-family
of functions has changed.  Previously @code{%X} denoted
a @code{long} version of the @code{%x} type conversion.  Now @code{%X}
is equivalent to the @code{%x} type conversion, as required by C99.

@findex _doprnt@r{, and C99 conversion qualifiers}
@findex printf@r{, and C99 conversion qualifiers}
@findex _doscan@r{, and C99 conversion qualifiers}
@findex scanf@r{, and C99 conversion qualifiers}
The @code{hh}, @code{j}, @code{t} and @code{z} conversion qualifiers
are now supported by @code{_doprnt}, @code{_doscan},
the @code{printf} family of functions and the @code{scanf} family
of functions.

@findex delay@r{, and Windows 2000 and XP}
The @code{delay} function now works on Windows 2000 and XP.  However, the
accuracy in the delay is limited, by the timing method it has to use on
Windows 2000 and XP.

@findex imaxabs
@findex imaxdiv
@findex strtoimax
@findex strtoumax
@findex PRI
@findex SCN
The functions @code{imaxabs}, @code{imaxdiv}, @code{strtoimax}
and @code{strtoumax} were added.  The @code{PRI} and @code{SCN} families
of macros were added.

@findex _put_path@r{, and @file{/dev} directory on disk}
The low-level function @code{_put_path} was changed to retain the @file{/dev}
prefix if a @file{/dev} directory exists on the disk.  This allows DJGPP
images to work with directories by this name.  You should avoid using
the @file{/dev} prefix on DOS device names if possible since the behavior
will change if the directory exists (and file operations which use the
name will be slower).  You should avoid using a @file{/dev} directory
to avoid conflicts.

@findex ctime@r{, and calls to @code{getenv}}
Fix caching when environment variable @env{TZ} is not set.  Prevents many calls
to @code{getenv} which are not needed.

@findex strtof
The function @code{strtof} was added.

@findex strlcat
@findex strlcpy
The functions @code{strlcat} and @code{strlcpy} were added.

@pindex djasm@r{, wbinvd instruction}
The mnemonic @code{wbinvd} has been added to @code{djasm}.

@cindex C99 compliance, mathematics
@vindex HUGE_VALF
@vindex HUGE_VALL
The constants @code{HUGE_VALF} and @code{HUGE_VALL} were added.

@tindex ssize_t
@code{ssize_t} was changed from an @code{int} to a @code{signed long int}.
@code{ssize_t} is now really a signed version of @code{size_t}.

@vindex errno@r{, and C99 compliance}
@findex perror@r{, and C99 compliance}
@findex strerror@r{, and C99 compliance}
The error code @code{EILSEQ} was added --- @code{errno} may be assigned it.
@code{perror} and @code{strerror} were updated to display/return
an error message for @code{EILSEQ}.

@pindex stubify@r{, ability to set stub parameters}
It's possible to set stub parameters by passing
@option{-stubparams=@dots{}} to @command{stubify}.

@pindex go32-v2@r{, documentation}
@pindex stubify@r{, documentation}
@pindex stubedit@r{, documentation}
@pindex exe2coff@r{, documentation}
@pindex coff2exe@r{, documentation}
@pindex dxegen@r{, documentation}
@pindex symify@r{, documentation}
@pindex edebug32@r{, documentation}
@pindex fsdb@r{, documentation}
Info documentation was added for @command{go32-v2}, @command{stubify},
@command{stubedit}, @command{exe2coff}, @command{coff2exe},
@command{dxegen}, @command{symify}, @command{edebug32}, and @command{fsdb}.

@vindex __djgpp_ds_alias@r{, moved to crt0}
@vindex _crt0_startup_flags@r{, moved to crt0}
The internal declaration of these two variables was moved to @file{crt0.S}.
This change makes the new @file{crt0.o} incompatible with previous DJGPP
releases if you accidentally link crt0 with the wrong libc.
@code{__djgpp_ds_alias} used to be declared in the @code{.text} section
and locked by default.  It is now in @code{.data} and not locked.  If you
are referencing this value in a hardware interrupt handler, you should
lock the memory area or copy it to your handler's locked memory.

@findex _rdtsc@r{, new timer function}
Added @code{_rdtsc} as a direct call to the hardware instruction.  It 
will inline to a single instruction when compiled with optimization.

@cindex File System Extensions, and @code{chmod}
@cindex File System Extensions, and @code{chown}
@code{chmod} and @code{chown} can now be hooked by File System Extensions.

@findex isatty@r{, and invalid file descriptors}
The function @code{isatty} now checks whether the file descriptor
passed to it is a valid.  If not, it will set @code{errno}
to @code{EBADF}.

@findex perror
The function @code{perror} no longer prints a colon and blank if called
with a null pointer or a pointer to a null string.

@findex fchmod
The function @code{fchmod} was added.

@findex _tolower
@findex _toupper
The functions @code{_tolower} and @code{_toupper} were added.

@findex readv
@findex writev
The functions @code{readv} and @code{writev} were added.

@findex pwrite
The function @code{pwrite} was added.

@findex NAN
The macro @code{NAN} was added.

@findex fchdir
@findex open@r{, and directories}
@findex read@r{, and directories}
@findex write@r{, and directories}
@findex lseek@r{, and directories}
@findex ftruncate@r{, and directories}
@findex fstat@r{, and directories}
@findex select@r{, and directories}
@findex fsync@r{, and directories}
@findex fdopen@r{, and directories}
@findex fopen@r{, and directories}
@findex freopen@r{, and directories}
@findex fclose@r{, and directories}
@findex ftell@r{, and directories}
@findex fseek@r{, and directories}
@findex rewind@r{, and directories}
@cindex Opening directories with @code{open}
The function @code{fchdir} was added.  This required modifications
to the POSIX functions @code{open}, @code{read}, @code{write},
@code{lseek}, @code{ftruncate}, @code{fstat}, @code{select},
@code{fsync} and @code{fdopen} and the ANSI functions @code{fopen},
@code{freopen}, @code{fclose}, @code{ftell}, @code{fseek}
and @code{rewind}, to make them aware of file descriptors for directories.

@findex fstat@r{, and inodes}
@findex stat@r{, and inodes}
@strong{Simple temporary fix - TODO: more complete fix}: @code{fstat}
will now use the file name used to open the file, when inventing inodes.
This is done so that the same inode is generated irrespective
of the actual file path used to open the file.  This also fixes
the problem where multiple calls to fstat on the same file descriptor
would give different inodes.

@code{stat} and @code{fstat} should now return the same inode for a file
in most cases.

@findex dlopen@r{ added}
@findex dlsym@r{ added}
@findex dlclose@r{ added}
@findex dlerror@r{ added}
@pindex dxe3gen@r{ added}
@pindex dxe3res@r{ added}
New enhanced dynamic module support has been added with a Posix compliant
interface.  You can now create complex DXEs which depend on each other
and call code from the main image.  Converting libraries to standalone
DXEs which can be linked via library is as simple as a single command.

@findex uclock@r{, uses rdtsc on Windows NT, 2000, XP}
@code{uclock} now uses rdtsc under Windows NT, 2000 and XP (if it is 
available) to work around the bug with the interval timer not being 
syncronized with the timer tick.

@vindex __tb_size@r{ added}
The macro @code{__tb_size} was added, to represent the size
of the transfer buffer.  This complements the macro @code{__tb},
which gives the linear address of the transfer buffer.

@pindex djtar@r{, and single-span spanned archives}
@code{djtar} now copes with single-span spanned archives.

@findex strtod@r{, @code{Inf} and @code{NaN} in input}
@findex strtof@r{, @code{Inf} and @code{NaN} in input}
@findex strtold@r{, @code{Inf} and @code{NaN} in input}
@findex _strtold@r{, @code{Inf} and @code{NaN} in input}
The functions @code{strtod}, @code{strtof}, @code{strtold} and
@code{_strtold} now understand ``Inf'', ``Infinity'', ``NaN'',
``NaN()'', ``NaN(@var{hex-number})'' and any variations of case in the
input string.

@findex _truename_sfn
The @code{_truename_sfn} function was added.  Please use
@code{_truename_sfn} when comparing truenames, to avoid problems
when comparing the truenames of existing and non-existing files.

@findex rename@r{, and moving directories into themselves}
Fix a bug in moving directories into themselves.   Previously
@code{rename} failed to detect that a subdirectory was being moved
into itself, when the current directory was a short filename.

@findex fpclassify@r{ added}
@findex __fpclassifyf@r{ added}
@findex __fpclassifyd@r{ added}
@findex __fpclassifyld@r{ added}
The C99 macro @code{fpclassify} and the supporting functions
@code{__fpclassifyf}, @code{__fpclassifyd} and @code{__fpclassifyld}
were added.

@findex nan@r{ added}
@findex nanf@r{ added}
@findex nanl@r{ added}
The C99 functions @code{nan}, @code{nanf} and @code{nanl} were added.

@findex _doprnt@r{, and the decimal point}
@findex printf@r{, and the decimal point}
@findex _doscan@r{, and the decimal point}
@findex scanf@r{, and the decimal point}
@findex strtod@r{, and the decimal point}
@findex strtof@r{, and the decimal point}
@findex strtold@r{, and the decimal point}
@findex _strtold@r{, and the decimal point}
The @code{_doprnt} and @code{_doscan} functions, the @code{printf}
family of functions, the @code{scanf} family of functions
and the @code{strto*} family of functions now honour the decimal point
from the current locale.

@findex strftime@r{, and the x type conversion}
@findex strftime@r{, and the X type conversion}
@code{strftime} now uses the date format (for @code{%x})
and time format (for @code{%X}) from the current locale.
This means that @code{%T} and @code{%X} are no longer equivalent.

@vindex __djgpp_stack_overflow_eip@r{ added}
@findex __djgpp_stack_overflow_exit@r{ added}
A stack overflow handler was added.

@vindex math_errhandling@r{ added}
@code{math_errhandling} was added.

@findex scanf@r{, and assignment suppression}
A bug was fixed in the @code{scanf} family of functions.
If a variable assignment was suppressed and the stream terminated
prematurely, these functions could incorrectly return the number of matches
instead of @code{EOF}.

@findex assert@r{, and function name}
Now @code{assert} prints also the name of the function where an assertion
fails, if that function is compiled with C99 features enabled.
