2008-10-18 11:39 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)

* harbour/source/common/hbgete.c
    * modified hb_getenv_buffer() to return logical value indicating
      that environment variable exists even if no buffer is passed
This commit is contained in:
Przemyslaw Czerpak
2008-10-18 09:39:42 +00:00
parent 967c149c42
commit 25fe51e9e5
2 changed files with 26 additions and 27 deletions

View File

@@ -8,6 +8,11 @@
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
*/
2008-10-18 11:39 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/source/common/hbgete.c
* modified hb_getenv_buffer() to return logical value indicating
that environment variable exists even if no buffer is passed
2008-10-18 10:56 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* common.mak
* make_b32.mak

View File

@@ -117,46 +117,40 @@ BOOL hb_getenv_buffer( const char * szName, char * szBuffer, int nSize )
{
BOOL bRetVal = FALSE;
if( szBuffer != NULL && nSize != 0 )
{
szBuffer[ 0 ] = '\0';
#if defined(HB_OS_WIN_32)
{
bRetVal = GetEnvironmentVariableA( szName, szBuffer, nSize ) != 0;
}
bRetVal = GetEnvironmentVariableA( szName, szBuffer, nSize ) != 0;
#elif defined(HB_OS_OS2)
{
{
#ifdef __GNUC__
PSZ EnvValue = "";
#else
PCSZ EnvValue = "";
#endif
if( DosScanEnv( szName, &EnvValue ) == NO_ERROR )
{
hb_strncpy( szBuffer, EnvValue, nSize - 1 );
bRetVal = TRUE;
}
}
#else
if( DosScanEnv( szName, &EnvValue ) == NO_ERROR )
{
char * pszTemp = getenv( szName );
if( pszTemp != NULL )
{
hb_strncpy( szBuffer, pszTemp, nSize - 1 );
bRetVal = TRUE;
}
bRetVal = TRUE;
if( szBuffer != NULL && nSize != 0 )
hb_strncpy( szBuffer, EnvValue, nSize - 1 );
}
#endif
}
#else
{
char * pszTemp = getenv( szName );
if( pszTemp != NULL )
{
if( szBuffer != NULL && nSize != 0 )
hb_strncpy( szBuffer, pszTemp, nSize - 1 );
bRetVal = TRUE;
}
}
#endif
if( !bRetVal && szBuffer != NULL && nSize != 0 )
szBuffer[ 0 ] = '\0';
return bRetVal;
}