2007-10-16 09:29 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* include/hbextern.ch
* source/rtl/gete.c
+ Added HB_GETENV(). There you have a 2nd parameter
which will be returned in case the requested
envvar doesn't exist. This extensions is still present
in GETE[NV](), but we'd better remove it.
* include/hbextern.ch
* source/rtl/isprint.c
+ Added HB_ISPRINTER() with support for extra parameter
printer port name. This parameter also currently has
support for Win32 printers. Win32 printer name support
was removed from ISPRINTER() to keep compatibility.
ISPRINTER() extra parameter is enabled with HB_COMPAT_XPP
(which is the default).
This commit is contained in:
@@ -8,6 +8,23 @@
|
||||
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
|
||||
*/
|
||||
|
||||
2007-10-16 09:29 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* include/hbextern.ch
|
||||
* source/rtl/gete.c
|
||||
+ Added HB_GETENV(). There you have a 2nd parameter
|
||||
which will be returned in case the requested
|
||||
envvar doesn't exist. This extensions is still present
|
||||
in GETE[NV](), but we'd better remove it.
|
||||
|
||||
* include/hbextern.ch
|
||||
* source/rtl/isprint.c
|
||||
+ Added HB_ISPRINTER() with support for extra parameter
|
||||
printer port name. This parameter also currently has
|
||||
support for Win32 printers. Win32 printer name support
|
||||
was removed from ISPRINTER() to keep compatibility.
|
||||
ISPRINTER() extra parameter is enabled with HB_COMPAT_XPP
|
||||
(which is the default).
|
||||
|
||||
2007-10-15 18:36 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
|
||||
* source/rtl/tbcolumn.prg
|
||||
! Strict C5.2e compatible behaviour made the default.
|
||||
|
||||
@@ -409,6 +409,8 @@ EXTERNAL HB_HEXTONUM
|
||||
EXTERNAL HB_NUMTOHEX
|
||||
EXTERNAL HB_HEXTOSTR
|
||||
EXTERNAL HB_STRTOHEX
|
||||
EXTERNAL HB_ISPRINTER
|
||||
EXTERNAL HB_GETENV
|
||||
|
||||
EXTERNAL HB_INISETCOMMENT
|
||||
EXTERNAL HB_INIREAD
|
||||
|
||||
@@ -125,3 +125,58 @@ HB_FUNC( GETE )
|
||||
{
|
||||
HB_FUNC_EXEC( GETENV );
|
||||
}
|
||||
|
||||
/* NOTE: Harbour extended version of GETENV(). The 2nd parameter
|
||||
can be used to specify a default value, returned if the
|
||||
requested envvar doesn't exist. [vszakats] */
|
||||
|
||||
HB_FUNC( HB_GETENV )
|
||||
{
|
||||
PHB_ITEM pName = hb_param( 1, HB_IT_STRING );
|
||||
|
||||
if( pName )
|
||||
{
|
||||
char * pszName = hb_itemGetC( pName );
|
||||
ULONG ulName = strlen( pszName );
|
||||
ULONG ulPos;
|
||||
|
||||
/* strip the '=' or else it will clear the variable! */
|
||||
|
||||
for( ulPos = 0; ulPos < ulName; ulPos++ )
|
||||
{
|
||||
if( pszName[ ulPos ] == '=' )
|
||||
{
|
||||
pszName[ ulPos ] = '\0';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( pszName[ 0 ] != '\0' )
|
||||
{
|
||||
char * szValue;
|
||||
|
||||
/* NOTE: Convert the envvar name to uppercase. This is required for
|
||||
DOS and OS/2 systems. [vszakats] */
|
||||
|
||||
#if defined(HB_OS_DOS) || defined(HB_OS_OS2)
|
||||
hb_strupr( pszName );
|
||||
#endif
|
||||
|
||||
szValue = hb_getenv( pszName );
|
||||
if( szValue && szValue[ 0 ] != '\0' )
|
||||
hb_retc_buffer( szValue );
|
||||
else
|
||||
{
|
||||
if( szValue )
|
||||
hb_xfree( szValue );
|
||||
hb_retc( hb_parc( 2 ) );
|
||||
}
|
||||
}
|
||||
else
|
||||
hb_retc( NULL );
|
||||
|
||||
hb_itemFreeC( pszName );
|
||||
}
|
||||
else
|
||||
hb_retc( NULL );
|
||||
}
|
||||
|
||||
@@ -157,11 +157,20 @@ HB_EXPORT BOOL hb_printerIsReady( char * pszPrinterName )
|
||||
return bIsPrinter;
|
||||
}
|
||||
|
||||
/* NOTE: The parameter is an extension over CA-Cl*pper, it's also supported
|
||||
by Xbase++. [vszakats] */
|
||||
/* NOTE: The parameter is an XBase++ extension over CA-Cl*pper. [vszakats] */
|
||||
|
||||
HB_FUNC( ISPRINTER )
|
||||
{
|
||||
#ifdef HB_COMPAT_XPP
|
||||
char * pszPrinter = hb_parc( 1 );
|
||||
hb_retl( hb_printerIsReady( pszPrinter ? pszPrinter : ( char * ) "LPT1" ) );
|
||||
#else
|
||||
hb_retl( hb_printerIsReady( "LPT1" ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
HB_FUNC( HB_ISPRINTER )
|
||||
{
|
||||
#if defined(HB_WIN_32_PRINTERS)
|
||||
char DefaultPrinter[MAXBUFFERSIZE];
|
||||
DWORD pdwBufferSize = MAXBUFFERSIZE;
|
||||
|
||||
Reference in New Issue
Block a user