Mail Archives: djgpp/1997/07/31/13:17:37
You wrote:
>I've notied that _osmajor/_osminor are not set in CRT before
>calling main(). Is this intentional or simply an oversight?
>Comparing with e.g. Borland (as we often do), these variables
>are set there.
No, that sure looks like a bug.
>
>The fix would simply to insert "_get_dos_version(0)" in
>"__crt1_startup()" (file \djgpp\src\src\libc\crt1.c).
Yes. Here's a patch I made:
*** crt0/crt1.c Mon Sep 2 00:52:34 1996
--- crt0/newcrt1.c Thu Jul 31 08:44:42 1997
***************
*** 14,17 ****
--- 14,18 ----
#include <fcntl.h>
#include <libc/environ.h>
+ #include <dos.h> /* for _osmajor/_osminor */
/* Global variables */
***************
*** 133,136 ****
--- 134,147 ----
size_t __PROXY_LEN = sizeof(__PROXY)-1;
+ static void
+ setup_os_version(void)
+ {
+ unsigned short v;
+ v = _get_dos_version(0); /* Get the reported version */
+ _osmajor = (v >> 8) & 0xff; /* paranoia */
+ _osminor = v & 0xff;
+ }
+
+
void
__crt1_startup(void)
***************
*** 139,142 ****
--- 150,154 ----
__bss_count ++;
__crt0_argv = 0;
+ setup_os_version();
setup_core_selector();
setup_screens();
Nate Eldredge
eldredge AT ap DOT net
- Raw text -