Here is a list of changes from DJGPP V2.02 to V2.03
Bugs in the
itimer functions are fixed. In particular:
itimervalstructure don’t cause internal calculations in
getitimernow returns correct info in the
alarmfunction work correctly when the calling program invokes the
uclocklibrary function before setting a timer.
mktime now notice changes in
the value of the
TZ environment variable during the program run,
and adjust their computation accordingly. They also don’t fail for the
first date after the epoch.
mktime now avoids looping for
preposterously long time when passed very large values in the members of
When passed an empty string as the file name,
stat now fails and
ENOENT, instead of returning information
about the current directory. Also,
stat no longer reports
invalid time stamps for root directories of floppy disks that were
written on Windows 9X or Windows NT.
The startup code now correctly sets up the keys that generate
SIGQUIT signals on PC98 machines.
fputc no longer return -1 when they write the
(signed char)0xff to a file.
The header wctype.h from v2.02 caused pre-processor errors, and could not be included before ctype.h. This is now fixed.
Functions of the
printf family no longer cause the calling
program to crash when passed
long double variables with invalid
bit patterns (the so-called unnormal numbers). Such arguments are
now printed as ‘Unnormal’.
srand now documented as returning a void.
rand48 and friends are now in libc.
Many fixes to calls to
toupper with signed chars.
The rmcb stub doesn’t restore the flags so that you can return different ones.
Doc fixes for ansi/posix portability.
Handle error conditions in bin2h.
tests/libclink/check.cc - remove duplicates.
Remove unneeded includes from rand.c.
system properly in termios (Ctrl-Z).
Work around a gcc 2.8.1 bug in emu387.
Linking with -lemu should obviate the need for emu387.dxe.
The “Hidden Features” chapter of the Knowledge Base now actually describes most of the special features provided by DJGPP.
redir no longer fails to run programs when the program name
is a substring of the redirected I/O file(s).
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
argv array is now correct in these cases.
textbackground now support the 16 background
colors mode (e.g., after a call to
textbackground would ignore the high intensity color bit in its
textcolor would clobber that bit sometimes.
A call to
lowvideo doesn’t clobber the background color anymore.
The global variable
ScreenAttrib now always matches the value of
attribute member of the
text_info struct returned by
If the last character of a response file is ‘^Z’, it is now
ignored. Previous versions would pass it to the
Use two ‘^Z’ characters in a row if you actually need to pass such
a character as part of the last element of the
fputs now returns
EOF when called on an unbuffered stream,
and there’s some error (such as
ENOSPC) in writing to that
If both arguments of
rename refer to the same
file, they no longer remove that file.
Functions of the
scanf family no longer crash or work incorrectly
when passed format specifiers with upper-case letters, such as
‘%lX’ or ‘%E’. Non-ANSI extensions to the format
specifiers and qualifiers, such as ‘%lld’ and ‘%U’, are now
documented and their portability information included in the library
__crt0_load_environment_file called by the startup
code now strips trailing blanks and TABs from the ‘[program]’ lines
of the DJGPP.ENV file which define sections for individual
programs. This is so editing 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.
utod no longer overwrite the stack when invoked
on file names longer than 80 characters.
system works when its argument uses redirection to/from quoted
file names (e.g., when the file name includes embedded whitespace).
Buffered stdio functions, such as
printf, and all their relatives pay attention to
termios settings of the terminal device and behave accordingly.
For example, you can get single-character, no-echo input with the
struct termios charmode; tcgetattr (0, &charmode); charmode.c_lflag &= ~(ECHO | ICANON | ISIG); tcsetattr (0, &charmode);
If you reset the
BRKINT flags in the
termios structure, or set the
tcsetattr now disables
SIGINT generation by a
Ctrl-C or Ctrl-BREAK keypress, and generation of
SIGQUIT by pressing Ctrl-\.
A call like ‘tcflush (0, TCIFLUSH);’ now empties the BIOS keyboard
buffer in addition to the internal buffer maintained by the
termios input processing. This is compatible with the Unix
tcflush should “discard all data received but
system no longer crashes when given invalid
command lines which involve pipe symbols ‘|’. Typically, such
command lines should have been run by a Unix-style shell, like Bash.
However, sometimes, due to some system configuration snafu, the
SHELL variable in the environment didn’t point to such a shell,
system would try to execute the command line using its
internal emulator of COMMAND.COM; it would then crash due to a
bug. This is now solved:
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.
Previously, when attempt was made to open a file, and all the available
file handles were exhausted,
open would sometimes truncate an
existing file on Windows 9X. This is now fixed.
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.
387 environment variable overrides the FPU auto-detect
code, the value of the global variable
_8087 is now set by the
startup code according to the environment override: 3 if
set to ‘y’, 0 otherwise.
You can use the special /dev/env/foo/ construct in file names
to expand it into the value of the environment variable
at run time. /dev/env/foo~bar~ will expand to bar if
foo is undefined, or if its value is empty.
getche flushes the
stderr streams, if they are connected to the console and have any
pending buffered characters.
A bug in the library caused programs like Emacs, which dump their data
and then restart, to use stale
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.
Due to a peculiarity of the timer device virtualization, the values
uclock on Windows during the first 54.9msec
after the first call (which reprograms the timer chip) were erratic,
some of them negative, some positive. To work around this, the first
uclock on Windows now waits until the next timer tick
before returning, to ensure that all the values returned hence are
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.
The termios input routines no longer generate the
SIGQUIT signals twice when Ctrl-C or
Ctrl-\ are pressed.
A call to
__djgpp_set_ctrl_c with a negative argument returns the
current state of
SIGQUIT generation without
termios cooked-mode output now expands TABs into the
appropriate number of spaces when writing to the console device.
setmode function now switches character devices to raw/cooked
mode even when
termios functions are used.
freopen now correctly sets the read/write access flags when
‘+’ is the last (third) character of the mode string, like in
‘wt+’ or ‘ab+’.
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
searchpath to return a
The DJGPP debug support functions in libdbg.a now have the
capability to debug programs that catch signals such as
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 Pierre Muller and Andris Pavenis.
The debugging support functions in libdbg.a now correctly handle
SIGQUIT signal that happens while the debuggee runs.
Previously, a debugger would crash or report
SIGINT in such cases.
The DJGPP functions in 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.
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
redir_* functions before and after jumping to the debuggee’s
code. See Redirection in the debugger in libc.a reference.
The documentation for the debug support functions in libdbg.a is now part of the library reference.
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.
__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.
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
cos, programs being
trapped inside infinite loops when they called
The FP emulation library libemu.a omitted the specially-compiled FPU setup module npxsetup.o which arranges for floating-point instructions to call functions from libemu.a. This caused programs linked with ‘-lemu’ to require the dynamically-loaded emulator, emu387.dxe, even though the emulation code was linked into the program. This bug is now fixed.
rename now sets
EACCES when an attempt is
made to rename an open file. Previously,
errno was set to
ENOENT in these cases.
Library functions that process strings and file names, such as
fnmatch, and the
scanf families, handle 8-bit
characters correctly when they call
character-classification functions internally.
New versions of mathematical functions, written by
Eric Rudd, are now included in the
standard C library, libc.a. The new versions are
ANSI-compatible (they set
errno in case of FP errors), yet
very fast and accurate. Programs that require accurate floating-point
computations can now be linked without ‘-lm’, unless they need the
matherr call-back or compliance to standards like X/Open or SVID.
New math functions are provided:
If the format specifier for a floating-point number includes the
‘+’ flag (meaning that the sign should be printed even if the
number is positive), the functions of the
printf family will now
print the negative zero,
-0.0, with an explicit negative sign.
access no longer loses a
FileFind handle on LFN platforms
when called on a root directory or a character device.
_check_v2_prog no longer leaks file descriptors when called on a
corrupt executable by name.
setitimer no longer crashes when its second argument is a
NULL pointer, it simply returns after setting the third argument
to the value of the last timer set with a previous call to
setitimer now rounds up timer values smaller than the system
clock granularity to that granularity, before it uses the values.
getitimer will return rounded up
values for such small timers. The global variable
__djgpp_clock_tick_interval is provided for changing the
granularity used by
setitimer, in case an application reprograms
the timer chip to run with a non-standard frequency.
ftruncate now leaves the file pointer at the same byte position
as it were before the function was called.
Functions of the
scanf family now correctly stop the scan when
they encounter a digit larger than 7, and either the format specifies
octal conversion, like in
%o, or the format is
%i and the
leading digit is
0, which implies octal conversion.
Functions of the
scanf family now use 16 as the base for
converting pointer values read with the
%p format. Thus, reading
back a pointer written with the
%p format now yields the original
kill now sets
ENOSYS when called with a
pid argument that isn’t the caller’s PID, since DOS doesn’t allow
sending signals to other processes.
The startup code and the linker script 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.
tcsetpgrp are now provided in the
realloc no longer crashes when the available virtual memory is
not enough to satisfy the reallocation request.
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.
djtar now creates the 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 ‘djtar
foo.tgz’, will not produce an empty tarchange.lst file anymore.
memicmp was omitted from the library in version
2.02. This is fixed now.
fsdb could not step over function calls when 4 or
more breakpoints were set: it would display an error message saying that
‘Exception 3 occurred’. This is now fixed. In addition,
fsdb now supports the
SIGQUIT signal, if the program being
debugged generates it.
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.)
redir no longer crashes when floating-point instructions are
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
The emulator now correctly sets the condition code bits
C3 when an exceptional condition is
raised, and as result of emulating the
The floating-point emulator software had a bug in emulation of the
FSQRT instruction, which could cause the calling program to hang.
This was due to incorrect optimization by the version of GCC used to
produce djdev202.zip. The new version of the emulator works
around this bug by preventing the compiler from performing these
fsetpos no longer returns zero when it fails to move the file
djtar now converts .info- into .i only if the
character following .info- is a digit. .tar.gz is
converted to .tgz only at the end of a file name. ++ is
converted to xx (instead of plus in previous versions),
and this conversion is performed for all occurrences of ++ in a
file name (previous versions only converted the first occurrence).
gxx compiler driver no longer reports an error if the
optional GNU C++ class library libgpp.a is not installed. If
libgpp.a cannot be found where
gcc would look for it,
gxx does not pass the ‘-lgpp’ option to the linker. Also,
if the standard C++ library, libstdcxx.a, cannot be found,
gxx now tries libstdcx.a and libstd~1.a, in case
the user has some LFN-related installation snafu.
The FP emulation behaves closer to a real FPU when an FP instruction
produces abnormal results, such as
Infto be stored in the results, while underflow usually results in a denormal or a zero.
Inf, produce a
FSTPinstructions avoids overflowing of the exponent when it is too large for the destination format; it stores an
Infor a maximum finite number instead. Operands that are too small for the destination format cause either a denormal or a zero to be stored.
NaNwhen one or both of its operands is a
FYL2Xalways pops the operands from the FPU stack, even if one of the operands is invalid (
NaN), or if the operand on top of the stack is negative. This affects functions
FPREM1instructions 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
ceilfunction for small negative arguments).
FPTANnow correctly handles the case where its operand is out of range.
FPATANemulation 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
FSQRTbehaves correctly for infinite arguments.
FRNDINTemulation returns a negative zero for negative arguments. This affects the
fmodfunction for negative arguments.
FSCALEhandles overflow correctly.
NaNfor an argument that is a
NaN, and raise an Invalid Operation exception for an
Infargument; this is what the Intel manuals require. This affects functions
FSTPthat store FP registers into
doublevariables, 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.
wchar_t data type is changed so that DJGPP now supports
16-bit wide characters. This is required for RSXNTDJ programs to
be compatible with Windows implementation of Unicode.
The long file-name (LFN) support is no longer disabled after
_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).
_get_volume_info now returns
_FILESYS_UNKNOWN for such
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,
truncates the long names to fit on a single screen line.
tmpfile no longer gets stuck in an endless loop when all the
available file handles are exhausted.