Date: Thu, 31 Jul 1997 10:14:32 -0700 (PDT) Message-Id: <199707311714.KAA18619@adit.ap.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" To: gova AT bryggen DOT bgnett DOT no From: Nate Eldredge Subject: Re: _osmajor/_osminor not set Cc: djgpp AT delorie DOT com Precedence: bulk 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 #include + #include /* 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