@node Changes in 2.03, , Changes in 2.02, What Changed
@section Changes in 2.03 update

Here is a list of changes in DJGPP V2.03 update (since V2.03).

@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 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 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.

@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.)

@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.

@pindex djasm@r{, Y2K fix}
@code{djasm} writes a 2 digit year into the executable header instead of 
a 3 digit year after Y2K.

@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 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.

@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 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}
The functions @code{system} and @code{spawn*} have also been changed
to free DPMI selectors leaked by many DPMI hosts.  This fixes the 
problem with large makefiles failing before completion under Windows.

@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.  

@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 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.   

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

@section Changes in 2.03

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

Bugs in the @code{itimer} functions are fixed.  In particular:

@itemize @minus{}
@item
@cindex profiling
profiling (which was broken in v2.02) now works;

@item
@cindex interval timers, small intervals
the timers are now more accurate for small (100@dmn{ms} or less)
intervals;

@item
@findex setitimer
large values of the @code{tv_usec} member in @code{itimerval} structure
don't cause internal calculations in @code{setitimer} to overflow;

@item
@findex getitimer
@code{getitimer} now returns correct info in the @code{tv_usec} member;

@item
@findex uclock
@findex alarm
@cindex interval timers and uclock
the timers and the @code{alarm} function work correctly when the calling
program invokes the @code{uclock} library function before setting a
timer.
@end itemize

@findex mktime
@findex localtime
@findex ctime
@vindex TZ
@code{localtime}, @code{ctime} and @code{mktime} now notice changes in
the value of the @code{TZ} environment variable during the program run,
and adjust their computation accordingly.  They also don't fail for the
first date after the epoch.  @code{mktime} now avoids looping for
preposterously long time when passed very large values in the members of
@code{struct tm}.

@findex stat
When passed an empty string as the file name, @code{stat} now fails and
sets @code{errno} to @code{ENOENT}, instead of returning information
about the current directory.  Also, @code{stat} no longer reports
invalid time stamps for root directories of floppy disks that were
written on Windows 9X or Windows NT.

@cindex PC98, SIGINT and SIGQUIT
@cindex SIGINT and SIGQUIT, PC98
The startup code now correctly sets up the keys that generate
@code{SIGINT} and @code{SIGQUIT} signals on PC98 machines.

@findex putc
@findex fputc
@code{putc} and @code{fputc} no longer return -1 when they write the
value @code{(signed char)0xff} to a file.

@cindex wctype.h, pre-processor and compilation errors
The header @file{wctype.h} from v2.02 caused pre-processor errors, and
could not be included @emph{before} @file{ctype.h}.  This is now fixed.


@findex doprnt
@findex printf
@findex sprintf
@findex fprintf
@findex vprintf
@findex vfprintf
@findex vsprintf
@cindex unnormal numbers, printing
Functions of the @code{printf} family no longer cause the calling
program to crash when passed @code{long double} variables with invalid
bit patterns (the so-called @dfn{unnormal} numbers).  Such arguments are
now printed as @samp{Unnormal}.

@code{srand} now documented as returning a void.
@findex srand

@code{rand48} and friends are now in libc.
@findex rand48
@findex srand48

Many fixes to calls to @code{tolower}/@code{toupper} with signed chars.
@findex tolower
@findex toupper

The rmcb stub doesn't restore the flags so that you can return
different ones.
@findex _go32_dpmi_allocate_real_mode_callback_iret

Doc fixes for ansi/posix portability.

Handle error conditions in @file{bin2h}.
@pindex bin2h

@file{tests/libclink/check.cc} - remove duplicates.

Remove unneeded includes from @file{rand.c}.

Call @code{system} properly in termios (Ctrl-Z).
@findex system@r{, and Ctrl-Z in termios}
@pindex termios

Work around a gcc 2.8.1 bug in emu387.
@findex acos

Linking with -lemu should obviate the need for emu387.dxe.
@pindex emu387.dxe

The ``Hidden Features'' chapter of the Knowledge Base now actually
describes most of the special features provided by DJGPP.
@cindex hidden features, documentation

@code{redir} no longer fails to run programs when the program name
is a substring of the redirected I/O file(s).
@pindex redir

@findex glob@r{, and mixed-case letters in file names}
@cindex command-line arguments, globbing
@code{glob} correctly converts the letter-case of the file names when
the pattern include mixed upper- and lower-case letters.  In particular,
the letter-case of the command-line arguments expanded by the startup
code in the @code{argv[]} array is now correct in these cases.

@code{textcolor} and @code{textbackground} now support the 16 background
colors mode (e.g., after a call to @code{intensevideo}).  Previously,
@code{textbackground} would ignore the high intensity color bit in its
argument, and @code{textcolor} would clobber that bit sometimes.
@findex textcolor
@findex textbackground

A call to @code{lowvideo} doesn't clobber the background color anymore.
@findex lowvideo

The global variable @code{ScreenAttrib} now always matches the value of
the @code{attribute} member of the @code{text_info} struct returned by
@code{gettexinfo}.
@findex gettexinfo
@vindex ScreenAttrib

@cindex response file, ^Z at the end
@cindex ^Z character, at end of a response file
If the last character of a response file is @samp{^Z}, it is now
ignored.  Previous versions would pass it to the @code{main} function.
Use two @samp{^Z} characters in a row if you actually need to pass such
a character as part of the last element of the @code{argv[]} array.

@findex fputs
@code{fputs} now returns @code{EOF} when called on an unbuffered stream,
and there's some error (such as @code{ENOSPC}) in writing to that
stream.

@findex _rename
@findex rename
If both arguments of @code{_rename} and @code{rename} refer to the same
file, they no longer remove that file.

@findex scanf
@findex sscanf
@findex fscanf
@findex vscanf
@findex vsscanf
@findex vfscanf
Functions of the @code{scanf} family no longer crash or work incorrectly
when passed format specifiers with upper-case letters, such as
@samp{%lX} or @samp{%E}.  Non-@sc{ansi} extensions to the format
specifiers and qualifiers, such as @samp{%lld} and @samp{%U}, are now
documented and their portability information included in the library
docs.

@findex __crt0_load_environment_file
The function @code{__crt0_load_environment_file} called by the startup
code now strips trailing blanks and TABs from the @samp{[program]} lines
of the @file{DJGPP.ENV} file which define sections for individual
programs.  This is so editing @file{DJGPP.ENV} with some losing editors
that don't strip trailing whitespace when saving the file doesn't
prevent the startup code from recognizing section names.

@pindex dtou
@pindex utod
@code{dtou} and @code{utod} no longer overwrite the stack when invoked
on file names longer than 80 characters.

@findex system@r{, and redirection}
@code{system} works when its argument uses redirection to/from quoted
file names (e.g., when the file name includes embedded whitespace).

@findex getc
@findex putc
@findex fread
@findex fwrite
@findex _filbuf
@findex _flsbuf
@cindex termios, and buffered stdio
Buffered stdio functions, such as @code{getc}, @code{putc},
@code{fread}, @code{printf}, and all their relatives pay attention to
@code{termios} settings of the terminal device and behave accordingly.
For example, you can get single-character, no-echo input with the
following snippet:

@example
 struct termios charmode;

 tcgetattr (0, &charmode);
 charmode.c_lflag &= ~(ECHO | ICANON | ISIG);
 tcsetattr (0, &charmode);
@end example

@findex tcsetattr
If you reset the @code{ISIG} or @code{BRKINT} flags in the
@code{termios} structure, or set the @code{IGNBRK} flag,
@code{tcsetattr} now disables @code{SIGINT} generation by a
@kbd{Ctrl-@key{C}} or @kbd{Ctrl-@key{BREAK}} keypress, and generation of
@code{SIGQUIT} by pressing @kbd{Ctrl-@key{\}}.

@findex tcflush
A call like @samp{tcflush (0, TCIFLUSH);} now empties the BIOS keyboard
buffer in addition to the internal buffer maintained by the
@code{termios} input processing.  This is compatible with the Unix
specification that @code{tcflush} should ``discard all data received but
not read''.

@findex system@r{, and pipe symbols}
@pindex Make, crashes
@pindex Bash
Library function @code{system} no longer crashes when given invalid
command lines which involve pipe symbols @samp{|}.  Typically, such
command lines should have been run by a Unix-style shell, like Bash.
However, sometimes, due to some system configuration snafu, the
@code{SHELL} variable in the environment didn't point to such a shell,
and @code{system} would try to execute the command line using its
internal emulator of @file{COMMAND.COM}; it would then crash due to a
bug.  This is now solved: @code{system} prints appropriate error
message(s) and exits with an error code of -1.  We believe that some of
the rarely-reported and hard-to-reproduce crashes of the Make utility
were due to this bug.

@findex open@r{, when there are no more file handles}
Previously, when attempt was made to open a file, and all the available
file handles were exhausted, @code{open} would sometimes truncate an
existing file on Windows 9X.  This is now fixed.

@cindex SIGFPE@r{, on Windows 9X}
@cindex Crashes due to SIGFPE, on Windows 9X
All DJGPP programs now clear the FPU exceptions when they exit.  This
prevents the next DJGPP program that is run in the same DOS box on
Windows 9X from crashing during startup code.

@vindex _8087
@vindex 387@r{, and the value of} _8087
When the @code{387} environment variable overrides the FPU auto-detect
code, the value of the global variable @code{_8087} is now set by the
startup code according to the environment override: 3 if @code{387} is
set to @samp{y}, 0 otherwise.

@findex _put_path
@findex _put_path2
@cindex environment variables, in file names
You can use the special @file{/dev/env/foo/} construct in file names
to expand it into the value of the environment variable @code{foo}
at run time.  @file{/dev/env/foo~bar~} will expand to @file{bar} if
@code{foo} is undefined, or if its value is empty.

@findex getch
@findex getche
@cindex flushing buffered output
Calling @code{getch} and @code{getche} flushes the @code{stdout} and
@code{stderr} streams, if they are connected to the console and have any
pending buffered characters.

@pindex @r{Emacs, warnings from} GDB
@pindex GDB@r{, debugging Emacs}
@cindex @code{FILE} objects, allocation
A bug in the library caused programs like Emacs, which dump their data
and then restart, to use stale @code{FILE} objects created before they
were dumped.  This caused warning messages to be issued by GDB near the
end of debugging session.  This bug is now fixed.

@findex uclock@r{, on Windows}
Due to a peculiarity of the timer device virtualization, the values
returned by @code{uclock} on Windows during the first 54.9@dmn{msec}
after the first call (which reprograms the timer chip) were erratic,
some of them negative, some positive.  To work around this, the first
call to @code{uclock} on Windows now waits until the next timer tick
before returning, to ensure that all the values returned hence are
monotonously increasing.

@cindex termios, and binary I/O
The termios emulation now uses raw input/output only if the file handle
referring to a device is put into binary mode, and the device itself is
in raw mode.

@cindex termios, input and @code{SIGINT} and @code{SIGQUIT}
The termios input routines no longer generate the @code{SIGINT} and
@code{SIGQUIT} signals twice when @kbd{Ctrl-@key{C}} or
@kbd{Ctrl-@key{\}} are pressed.

@findex __djgpp_set_ctrl_c@r{, non-destructive query}
A call to @code{__djgpp_set_ctrl_c} with a negative argument returns the
current state of @code{SIGINT} and @code{SIGQUIT} generation without
altering it.

@cindex termios, and TAB expansion
The @code{termios} cooked-mode output now expands TABs into the
appropriate number of spaces when writing to the console device.

@findex setmode@r{, and termios}
The @code{setmode} function now switches character devices to raw/cooked
mode even when @code{termios} functions are used.

@findex freopen@r{, read/write access to files}
@code{freopen} now correctly sets the read/write access flags when
@samp{+} is the last (third) character of the @var{mode} string, like in
@samp{wt+} or @samp{ab+}.

@findex searchpath@r{, and file names with slashes}
Previously, @code{searchpath} would always return its argument unchanged
and signal a success, when the argument included slashes or a drive
letter, even if the file didn't actually exist.  This is now fixed:
non-existent files always cause @code{searchpath} to return a
@code{NULL} pointer.

@cindex debug support, and signals
The DJGPP debug support functions in @file{libdbg.a} now have the
capability to debug programs that catch signals such as @code{SIGINT}.
The signal interrupts the debuggee and is reported by the debugger,
instead of aborting the debuggee.  You can also deliver signals to
the debuggee, even if they didn't actually happen.  Most of the work
that made this possible was done by @email{muller@@cerbere.u-strasbg.fr,
Pierre Muller} and @email{pavenis@@lanet.lv, Andris Pavenis}.

@cindex debuggers, and @code{SIGQUIT}
The debugging support functions in @file{libdbg.a} now correctly handle
the @code{SIGQUIT} signal that happens while the debuggee runs.
Previously, a debugger would crash or report @code{SIGINT} in such cases.

@cindex debug support, and floating-point code
The DJGPP functions in @file{libdbg.a} support FP code much better now,
especially when FP exceptions happen in the debugged program.  The full
state of the numeric processor is saved and restored when the execution
thread jumps from the debugger to the debuggee and back.

@cindex debug support, and file redirection
It is now possible to debug programs that redirect their standard
handles, without the debugger losing those handles at the same time.
Debuggers which want to use this feature need to call the new
@code{redir_*} functions before and after jumping to the debuggee's
code.  @xref{redir_debug_init, , Redirection in the debugger, libc,
libc.a reference}.

@cindex debug support, documentation
The documentation for the debug support functions in @file{libdbg.a} is
now part of the library reference.

@cindex debuggers, and the stack length
@cindex debuggers, and the transfer buffer size
When a raw COFF image (i.e., without a stub) is debugged, its stack
length and the size of transfer buffer are now taken from the values
used by the debugger.  This means that you can have predictable results
by stubediting the debugger's executable.

@findex __dpmi_simulate_real_mode_procedure_retf_stack
@code{__dpmi_simulate_real_mode_procedure_retf_stack} no longer fills
part of the real-mode stack with garbage.  The parameters specification
was changed so that the second argument is now the number of 16-bit
words to copy to the real-mode stack, like the DPMI spec requires.

@pindex emu387.dxe@r{, comparison, addition and subtraction}
@pindex libemu.a@r{, comparison, addition and subtraction}
@cindex FP emulator, comparison, addition and subtraction
The floating-point emulator software had a bug in emulation of
subtraction, addition, and comparison instructions, whereby the results
produced for some rare pairs of numbers with the same exponent but
different mantissa were grossly incorrect.  This is now fixed.
This bug was known to cause all kinds of weird failures, like incorrect
values produced by functions @code{sin} and @code{cos}, programs being
trapped inside infinite loops when they called @code{acos}, etc.

@pindex libemu.a@r{, missing} npxsetup.o
The FP emulation library @file{libemu.a} omitted the specially-compiled
FPU setup module @file{npxsetup.o} which arranges for floating-point
instructions to call functions from @file{libemu.a}.  This caused
programs linked with @samp{-lemu} to require the dynamically-loaded
emulator, @file{emu387.dxe}, even though the emulation code was linked
into the program.  This bug is now fixed.

@findex rename@r{,} errno@r{ value when the file is open}
@code{rename} now sets @code{errno} to @code{EACCES} when an attempt is
made to rename an open file.  Previously, @code{errno} was set to
@code{ENOENT} in these cases.

@cindex 8-bit characters, and string-related functions
Library functions that process strings and file names, such as
@code{strupr}, @code{stricmp}, @code{strtol}, @code{fnmatch}, and the
functions from @code{printf} and @code{scanf} families, handle 8-bit
characters correctly when they call @code{ctype}
character-classification functions internally.

@cindex math functions, improved versions
@vindex errno@r{, set by math functions in @file{libc.a}}
New versions of mathematical functions, written by
@email{rudd@@cyberoptics.com, Eric Rudd}, are now included in the
standard C library, @file{libc.a}.  The new versions are
@sc{ansi}-compatible (they set @code{errno} in case of FP errors), yet
very fast and accurate.  Programs that require accurate floating-point
computations can now be linked without @samp{-lm}, unless they need the
@code{matherr} call-back or compliance to standards like X/Open or SVID.

@findex powi
@findex cbrt
@findex expm1
@findex exp2
@findex exp10
@findex sincos
New math functions are provided: @code{powi}, @code{cbrt}, @code{expm1},
@code{exp2}, @code{exp10}, and @code{sincos}.

@findex printf@r{, and negative zero}
@findex fprintf@r{, and negative zero}
@findex sprintf@r{, and negative zero}
@cindex negative zero, printing
If the format specifier for a floating-point number includes the
@samp{+} flag (meaning that the sign should be printed even if the
number is positive), the functions of the @code{printf} family will now
print the negative zero, @code{-0.0}, with an explicit negative sign.

@findex access@r{, loss of} FileFind @r{handle}
@code{access} no longer loses a @code{FileFind} handle on LFN platforms
when called on a root directory or a character device.

@findex _check_v2_prog@r{, leaks file descriptor}
@code{_check_v2_prog} no longer leaks file descriptors when called on a
corrupt executable by name.

@findex setitimer@r{, when called with} NULL@r{ argument}
@code{setitimer} no longer crashes when its second argument is a
@code{NULL} pointer, it simply returns after setting the third argument
to the value of the last timer set with a previous call to
@code{setitimer}.

@findex setitimer@r{, and system clock granularity}
@findex getitimer@r{, and system clock granularity}
@vindex __djgpp_clock_tick_interval@r{, introduced}
@cindex timer tick frequency, and @code{setitimer} function
@code{setitimer} now rounds up timer values smaller than the system
clock granularity to that granularity, before it uses the values.
Therefore, @code{setitimer} and @code{getitimer} will return rounded up
values for such small timers.  The global variable
@code{__djgpp_clock_tick_interval} is provided for changing the
granularity used by @code{setitimer}, in case an application reprograms
the timer chip to run with a non-standard frequency.

@findex ftruncate@r{, and file pointer position}
@code{ftruncate} now leaves the file pointer at the same byte position
as it were before the function was called.

@findex scanf@r{, and octal conversions}
@findex sscanf@r{, and octal conversions}
@findex fscanf@r{, and octal conversions}
@findex vscanf@r{, and octal conversions}
@findex vsscanf@r{, and octal conversions}
@findex vfscanf@r{, and octal conversions}
Functions of the @code{scanf} family now correctly stop the scan when
they encounter a digit larger than 7, and either the format specifies
octal conversion, like in @code{%o}, or the format is @code{%i} and the
leading digit is @code{0}, which implies octal conversion.

@findex scanf@r{, pointer conversions}
@findex sscanf@r{, pointer conversions}
@findex fscanf@r{, pointer conversions}
@findex vscanf@r{, pointer conversions}
@findex vsscanf@r{, pointer conversions}
@findex vfscanf@r{, pointer conversions}
Functions of the @code{scanf} family now use 16 as the base for
converting pointer values read with the @code{%p} format.  Thus, reading
back a pointer written with the @code{%p} format now yields the original
value.

@findex kill@r{, signals to other programs}
@code{kill} now sets @code{errno} to @code{ENOSYS} when called with a
@var{pid} argument that isn't the caller's PID, since DOS doesn't allow
sending signals to other processes.

@cindex template instantiation, improved support
@pindex crt0.S@r{, and long section names}
@pindex djgpp.djl@r{, and long section names}
The startup code and the linker script file @file{djgpp.djl} include
support for long section names.  Long section names are required by the
latest versions of GNU Binutils to support automatic template
instantiation in C++ programs.

@findex tcgetpgrp@r{, added}
@findex tcsetpgrp@r{, added}
The @code{tcgetpgrp} and @code{tcsetpgrp} are now provided in the
library.

@findex realloc@r{, crashes when memory is exhausted}
@code{realloc} no longer crashes when the available virtual memory is
not enough to satisfy the reallocation request.

@findex symlink@r{, source and target in different directories}
Previously, the @code{symlink} function would sometimes think that the
source and the target of the link were in the same directory, when in
fact they weren't.  This bug is now fixed.

@pindex djtar@r{, and the }@file{tarchange.lst}@r{ file}
@code{djtar} now creates the file @file{tarchange.lst} only if it
actually needs to rename some of the files during unpacking.  In
particular, simply listing the contents of an archive, as in @samp{djtar
foo.tgz}, will not produce an empty @file{tarchange.lst} file anymore.

@findex memicmp@r{, included in the library}
The function @code{memicmp} was omitted from the library in version
2.02.  This is fixed now.

@pindex fsdb@r{, Step Over bug}
@pindex fsdb@r{, support for }SIGQUIT
Previously, @code{fsdb} could not step over function calls when 4 or
more breakpoints were set: it would display an error message saying that
@samp{Exception 3 occurred}.  This is now fixed.  In addition,
@code{fsdb} now supports the @code{SIGQUIT} signal, if the program being
debugged generates it.

@pindex emu387.dxe@r{, on Windows}
@pindex libemu.a@r{, on Windows}
@cindex FP emulation, on Windows
The floating-point emulation now works on Windows.  Previously, a bug in
the emulation of the WAIT/FWAIT instructions caused the emulator to get
stuck in an endless loop on Windows.  (On MS-DOS, these two instructions
don't generate an FP exception, and so don't get into the emulator.)

@pindex redir@r{, and FP emulation}
@code{redir} no longer crashes when floating-point instructions are
emulated.

@cindex FP emulation, and @code{SIGFPE}
@cindex @code{SIGFPE} and FP emulation
The emulator setup in the startup code now correctly masks all FP
exceptions in the emulated control word, like the hardware FPU setup
does.  If some numeric exception is unmasked by an application and is
triggered by some abnormal condition in the emulator (e.g., if an
application attempts to compute a square root of a negative number), the
emulation simulates exception 16, the Coprocessor Error exception.
(Previously, the exception number in the DJGPP exception structure was
not set by the emulation, and was left at its old value set by the
Coprocessor Not Present exception generated by the emulated
instruction.  This caused incorrect message to be printed when the
program crashed, and defeated user-defined handlers for @code{SIGFPE}.)


@cindex FP emulation, and @code{Cn} condition codes
@cindex Condition codes and FP emulation
The emulator now correctly sets the condition code bits @code{C0},
@code{C1}, @code{C2}, and @code{C3} when an exceptional condition is
raised, and as result of emulating the @code{FPREM} and @code{FPREM1}
instructions.

@pindex emu387.dxe@r{, and FSQRT instruction}
@pindex libemu.a@r{, and FSQRT instruction}
@cindex FP emulator, and FSQRT instruction
The floating-point emulator software had a bug in emulation of the
@code{FSQRT} instruction, which could cause the calling program to hang.
This was due to incorrect optimization by the version of GCC used to
produce @file{djdev202.zip}.  The new version of the emulator works
around this bug by preventing the compiler from performing these
incorrect optimizations.

@findex fsetpos@r{, return value}
@code{fsetpos} no longer returns zero when it fails to move the file
position pointer.

@pindex djtar@r{, file-name conversions}
@code{djtar} now converts @file{.info-} into @file{.i} only if the
character following @file{.info-} is a digit.  @file{.tar.gz} is
converted to @file{.tgz} only at the end of a file name.  @file{++} is
converted to @file{xx} (instead of @file{plus} in previous versions),
and this conversion is performed for all occurrences of @file{++} in a
file name (previous versions only converted the first occurrence).

@pindex gxx@r{, and missing libgpp.a}
@cindex @file{libstdcxx.a}, and @code{gxx}
The @code{gxx} compiler driver no longer reports an error if the
optional GNU C@t{++} class library @file{libgpp.a} is not installed.  If
@file{libgpp.a} cannot be found where @code{gcc} would look for it,
@code{gxx} does not pass the @samp{-lgpp} option to the linker.  Also,
if the standard C@t{++} library, @file{libstdcxx.a}, cannot be found,
@code{gxx} now tries @file{libstdcx.a} and @file{libstd~1.a}, in case
the user has some LFN-related installation @emph{snafu}.

@cindex FP emulation, abnormal results
The FP emulation behaves closer to a real FPU when an FP instruction
produces abnormal results, such as @code{Inf} or @code{NaN}.  In
particular:

@itemize @bullet
@item
@cindex Overflow in emulation of arithmetic FP instructions
@cindex Underflow in emulation of arithmetic FP instructions
Overflow and underflow are now correctly detected in addition,
subtraction, multiplication and division, and instructions that perform
these operations internally.  Overflow causes an @code{Inf} to be stored
in the results, while underflow usually results in a denormal or a zero.

@item
Undefined operations, such as division of zero by zero or of @code{Inf}
by an @code{Inf}, produce a @code{NaN}.

@item
@cindex FST/FSTP instructions, emulation of, over/underflow
Emulation of @code{FST} and @code{FSTP} instructions avoids overflowing
of the exponent when it is too large for the destination format; it
stores an @code{Inf} or a maximum finite number instead.  Operands that
are too small for the destination format cause either a denormal or a
zero to be stored.

@item
@cindex FXCH instruction, emulation, abnormal operands
The emulation of @code{FXCH} stores a @code{NaN} when one or both of its
operands is a @code{NaN}.

@item
@cindex FYL2X instruction, emulation pops the stack
@findex acosh@r{, }Inf@r{ or}NaN@r{ operands in emulator}
@findex asinh@r{, }Inf@r{ or}NaN@r{ operands in emulator}
The emulation of @code{FYL2X} always pops the operands from the FPU
stack, even if one of the operands is invalid (@code{Inf} or
@code{NaN}), or if the operand on top of the stack is negative.  This
affects functions @code{acosh} and @code{asinh}.

@item
@cindex FPREM/FPREM1 instruction, emulation for large arguments
@findex ceil@r{, for negative arguments, emulation}
The emulation of the @code{FPREM} and @code{FPREM1} instructions no
longer hangs the program when the difference of the exponents of the
operands is larger than 64.  Instead, it correctly implements the
``partial remainder'' algorithm defined by the Intel manuals.  Also, the
sign of the result of these instructions is now in accordance with the
Intel manuals (this affects the @code{ceil} function for small negative
arguments).

@item
@cindex FPTAN instruction, emulation, argument out of range
@findex tan@r{, emulation, argument out of range}
The emulation of @code{FPTAN} now correctly handles the case where its
operand is out of range.

@item
@cindex FPATAN instruction, emulation, accuracy
@findex atan@r{, accuracy of emulation}
@findex atan2@r{, accuracy of emulation}
@findex asin@r{, accuracy of emulation}
@findex acos@r{, accuracy of emulation}
@code{FPATAN} emulation now uses a better approximation which is
accurate to 63 bits, even when its argument is near 1.  (Previously, it
would suffer a catastrophic accuracy loss of up to 13 significant digits
for arguments near 1.)  This affects functions @code{atan},
@code{atan2}, @code{asin}, and @code{acos}.

@item
@cindex FSQRT instruction, emulation for infinite arguments
@findex sqrt@r{, emulation for infinite arguments}
The emulation of @code{FSQRT} behaves correctly for infinite arguments.

@item
@cindex FRNDINT instruction, emulation for negative arguments
@findex fmod@r{, emulation for negative arguments}
@code{FRNDINT} emulation returns a negative zero for negative
arguments.  This affects the @code{fmod} function for negative
arguments.

@item
@cindex FSCALE instruction, emulation, handles overflow
The emulation of @code{FSCALE} handles overflow correctly.

@item
@cindex FSINCOS instruction, emulation for large arguments
@cindex FSIN instruction, emulation for large arguments
@cindex FCOS instruction, emulation for large arguments
@findex sin@r{, emulation for large arguments}
@findex cos@r{, emulation for large arguments}
@findex sincos@r{, emulation for large arguments}
@findex tan@r{, emulation for large arguments}
The emulations of @code{FSINCOS}, @code{FSIN} and @code{FCOS} return a
@code{NaN} for an argument that is a @code{NaN}, and raise an Invalid
Operation exception for an @code{Inf} argument; this is what the Intel
manuals require.  This affects functions @code{sin}, @code{cos},
@code{sincos}, and @code{tan}.

@item
@cindex FST/FSTP instructions, emulation of, rounding
The emulation of instructions @code{FST} and @code{FSTP} that store
FP registers into @code{float} or @code{double} variables, now correctly
round the stored value according to the current rounding mode.
Previously, the stored value was always chopped (truncated) at the last
stored bit of the mantissa.
@end itemize

@cindex @code{wchar_t} type, and Windows programs
The @code{wchar_t} data type is changed so that DJGPP now supports
16-bit wide characters.  This is required for @sc{rsxntdj} programs to
be compatible with Windows implementation of Unicode.

@findex _use_lfn@r{, and invalid drives}
@findex _USE_LFN@r{, and invalid drives}
@findex _get_volume_info@r{, and invalid drives}
@cindex LFN support and invalid drives
The long file-name (LFN) support is no longer disabled after
@code{_use_lfn} (or some other library functions that call it) were
called with a file name which refers to an invalid drive or a drive
whose media has been removed (e.g. an empty floppy drive).
@code{_get_volume_info} now returns @code{_FILESYS_UNKNOWN} for such
drives.

@pindex symify@r{, and long file/function names}
@code{symify} no longer crashes when the name of the function or source
file are too long to fit on a single screen line.  It also doesn't
overwrite the address on the next screen line.  Instead, @code{symify}
truncates the long names to fit on a single screen line.

@findex tmpfile@r{, when file handles are exhausted}
@code{tmpfile} no longer gets stuck in an endless loop when all the
available file handles are exhausted.
