2008-01-31 17:40 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)

* bin/hb-func.sh
     + Updated for lib name change.
       Please test & review.

   * source/rtl/net.c
   * include/hbapi.h
     + Added hb_netname() and hb_username() low level versions 
       of NETNAME() and hb_USERNAME().
This commit is contained in:
Viktor Szakats
2008-01-31 16:48:02 +00:00
parent d0f269ce90
commit b5ae06cc09
4 changed files with 56 additions and 32 deletions

View File

@@ -8,6 +8,16 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
2008-01-31 17:40 UTC+0100 Viktor Szakats (harbour.01 syenar.hu)
* bin/hb-func.sh
+ Updated for lib name change.
Please test & review.
* source/rtl/net.c
* include/hbapi.h
+ Added hb_netname() and hb_username() low level versions
of NETNAME() and hb_USERNAME().
2008-01-31 17:40 UTC+0100 Ryszard Glab <harbour//rglab.pl>
* config/w32/mingw32.cf
* fixed library name mainstd -> hbmainstd

View File

@@ -71,7 +71,7 @@ mk_hbgetlibs()
then
libs="$libs gtwin"
fi
echo -n "vm pp rtl rdd dbffpt dbfcdx dbfntx hsx hbsix usrrdd ${HB_DB_DRVEXT} macro common lang codepage gtcrs gtsln gtxvt gtxwc gtalleg gtcgi gtstd gtpca gttrm $libs gtwvt gtgui gtdos gtos2 debug profiler compiler hbpcre"
echo -n "hbvm hbpp hbrtl hbrdd rddfpt rddcdx rddntx hbhsx hbsix hbusrrdd ${HB_DB_DRVEXT} hbmacro hbcommon hblang hbcpage gtcrs gtsln gtxvt gtxwc gtalleg gtcgi gtstd gtpca gttrm $libs gtwvt gtgui gtdos gtos2 hbdebug profiler hbcplr hbpcre"
else
echo -n "$@"
fi
@@ -88,7 +88,7 @@ mk_hbgetlibsctb()
then
libs="$libs gtwin"
fi
echo -n "$libs hbrddads hbct hbnf hbzlib hbtip xhb hbgd hbodbc hbpg hbmysql hbrddado hbw32 hbgtwvg"
echo -n "$libs rddads hbct hbnf hbzlib hbtip xhb hbgd hbodbc hbpg hbmysql rddado hbw32 gtwvg"
else
echo -n "$@"
fi
@@ -424,7 +424,7 @@ else
fi
[ "\${HB_MT}" = "MT" ] && [ -f "\${HB_LIB_INSTALL}/\${pref}\${l}mt\${ext}" ] && l="\${l}mt"
[ -f "\${HB_LIB_INSTALL}/\${pref}\${l}\${ext}" ] && HARBOUR_LIBS="\${HARBOUR_LIBS} -l\${l}"
libs="gtalleg debug profiler ${hb_libsc}"
libs="gtalleg hbdebug profiler ${hb_libsc}"
fi
for l in \${libs}
do
@@ -603,7 +603,7 @@ mk_hblibso()
for l in ${hb_libs}
do
case $l in
debug|profiler|fm|hbodbc|gtalleg|hbrddads) ;;
hbdebug|profiler|fm|hbodbc|gtalleg|rddads) ;;
*)
ls="lib${l}.a"
if [ -f lib${l}mt.a ]

View File

@@ -998,6 +998,8 @@ extern HB_EXPORT BOOL hb_printerIsReady( char * pszPrinterName );
/* environment variables access */
/* WARNING: This returned pointer must be freed if not NULL using hb_xfree( ( void * ) ptr ); */
extern char * hb_getenv( const char * name );
extern char * hb_netname( void );
extern char * hb_username( void );
/* Version tracking related things */
#ifdef HB_FILE_VER_STATIC

View File

@@ -101,50 +101,49 @@
#endif
/* NOTE: Clipper will only return a maximum of 15 bytes from this function.
And it will be padded with spaces. Harbour does the same in the
And it will be padded with spaces. Harbour does the same on the
DOS platform.
[vszakats] */
HB_FUNC( NETNAME )
/* NOTE: The caller must free the returned buffer. [vszakats] */
char * hb_netname( void )
{
#if defined(HB_OS_UNIX) || ( defined(HB_OS_OS2) && defined(__GNUC__) )
# if defined(__WATCOMC__)
char * pszValue = hb_getenv( "HOSTNAME" );
hb_retc_buffer( pszValue );
return hb_getenv( "HOSTNAME" );
# else
char szValue[ MAXGETHOSTNAME + 1 ];
szValue[ 0 ] = '\0';
gethostname( szValue, MAXGETHOSTNAME );
hb_retc( szValue );
char * pszValue = hb_xgrab( MAXGETHOSTNAME + 1 );
pszValue[ 0 ] = '\0';
gethostname( pszValue, MAXGETHOSTNAME );
return szValue;
# endif
#elif defined(HB_OS_DOS)
# if defined(__DJGPP__) || defined(__RSX32__) || defined(__GNUC__)
char szValue[ MAXGETHOSTNAME + 1 ];
szValue[ 0 ] = '\0';
gethostname( szValue, MAXGETHOSTNAME );
hb_retc( szValue );
char * pszValue = hb_xgrab( MAXGETHOSTNAME + 1 );
pszValue[ 0 ] = '\0';
gethostname( pszValue, MAXGETHOSTNAME );
return szValue;
# else
union REGS regs;
char szValue[ 16 ];
szValue[ 0 ] = '\0';
char * pszValue = hb_xgrab( 16 );
pszValue[ 0 ] = '\0';
regs.HB_XREGS.ax = 0x5E00;
{
struct SREGS sregs;
regs.HB_XREGS.dx = FP_OFF( szValue );
sregs.ds = FP_SEG( szValue );
regs.HB_XREGS.dx = FP_OFF( pszValue );
sregs.ds = FP_SEG( pszValue );
HB_DOS_INT86X( 0x21, &regs, &regs, &sregs );
}
hb_retc( regs.h.ch == 0 ? "" : szValue );
return regs.h.ch == 0 ? "" : pszValue;
# endif
#elif defined(HB_OS_WIN_32)
@@ -154,29 +153,32 @@ HB_FUNC( NETNAME )
pszValue[ 0 ] = '\0';
GetComputerNameA( pszValue, &ulLen );
hb_retc_buffer( pszValue );
return pszValue;
#else
hb_retc( NULL );
return NULL;
#endif
}
HB_FUNC( HB_USERNAME )
/* NOTE: The caller must free the returned buffer. [vszakats] */
char * hb_username( void )
{
#if defined(HB_OS_UNIX) || ( defined(HB_OS_OS2) && defined(__GNUC__) )
# if defined(__WATCOMC__)
char * pszValue = hb_getenv( "USER" );
hb_retc_buffer( pszValue );
return hb_getenv( "USER" );
# else
struct passwd * pwd;
pwd = getpwuid( getuid() );
if( pwd )
hb_retc( pwd->pw_name );
{
return hb_strdup( pwd->pw_name );
}
else
hb_retc_buffer( hb_getenv( "USER" ) );
return hb_getenv( "USER" );
# endif
#elif defined(HB_OS_WIN_32)
@@ -186,11 +188,21 @@ HB_FUNC( HB_USERNAME )
pszValue[ 0 ] = '\0';
GetUserNameA( pszValue, &ulLen );
hb_retc_buffer( pszValue );
return pszValue;
#else
hb_retc( NULL );
return NULL;
#endif
}
HB_FUNC( NETNAME )
{
hb_retc_buffer( hb_netname() );
}
HB_FUNC( HB_USERNAME )
{
hb_retc_buffer( hb_username() );
}