diff --git a/harbour/ChangeLog b/harbour/ChangeLog index b6fd4415e5..fa56e4dde8 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,10 @@ +19990908-01:33 EDT Paul Tucker + * source/rtl/environ.c + corrected to work with msvc. + The format passed to sprintf is now a variable. Under Windows, + the hb_osletter is actually the build number, and the default + format was not printing it correctly. + 19990908-00:05 EDT David G. Holm * source/rtl/environ.c ! Version 1.43 added Windows code to detect the Windows version, but diff --git a/harbour/source/rtl/environ.c b/harbour/source/rtl/environ.c index c9f9a26ee6..ad8928d2a1 100644 --- a/harbour/source/rtl/environ.c +++ b/harbour/source/rtl/environ.c @@ -11,10 +11,16 @@ /* Note: The following #ifdef block for __IBMCPP__ must be ahead of any and all #include statements! */ + #ifdef __IBMCPP__ #define INCL_DOSMISC #endif +#if defined(_MSC_VER) && (defined(_Windows) || defined(_WIN32)) + #define WIN32_LEAN_AND_MEAN + #include "windows.h" +#endif + #include "extend.h" #include "errorapi.h" #include "hbver.h" @@ -45,6 +51,8 @@ HARBOUR HB_OS( void ) { + char *cformat = "%s %d.%02d%c"; + #ifdef __MPW__ /* TODO: not implemented yet */ hb_retc( "MacOS" ); @@ -108,7 +116,6 @@ HARBOUR HB_OS( void ) break; case VER_PLATFORM_WIN32_NT: - hb_osmajor = osVer.dwMajorVersion; hb_osminor = osVer.dwMinorVersion; hb_osletter = osVer.dwBuildNumber; @@ -122,6 +129,7 @@ HARBOUR HB_OS( void ) hb_os = "Windows 32s"; break; } + cformat = "%s %d.%02d.%04d"; } #else #if defined(__MSC__) || defined(_MSC_VER) @@ -212,11 +220,11 @@ HARBOUR HB_OS( void ) #endif /* __GNUC__ */ #endif /* __IBMCPP__ */ - + if( ! hb_os ) strcpy( version, "Unknown" ); else if( hb_osmajor == -1 ) strcpy( version, hb_os ); else if( hb_osmajor == -2 ) { /* NOP */ } - else sprintf( version, "%s %d.%02d%c", hb_os, hb_osmajor, hb_osminor, hb_osletter ); + else sprintf( version, cformat, hb_os, hb_osmajor, hb_osminor, hb_osletter ); hb_retc( version ); #ifdef __DJGPP__ hb_xfree( hb_os );