From 45f4f1418c209576f724d5eab3f48b72a774d7ca Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Mon, 24 Sep 2012 22:21:34 +0000 Subject: [PATCH] 2012-09-25 00:20 UTC+0200 Viktor Szakats (harbour syenar.net) * utils/hbmk2/hbmk2.prg + hbstart.hb is now searched also at standard location on *nix system (the same places where hbmk.hbc is searched.) + hbstart.hb is now executed as normal script code (was line by line), so this .hb file can be just like any other .hb file. --- harbour/ChangeLog | 8 ++++++ harbour/utils/hbmk2/hbmk2.prg | 48 ++++++++++++++++++++--------------- 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 105bbe35a7..ba9a70543c 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,14 @@ The license applies to all entries newer than 2009-04-28. */ +2012-09-25 00:20 UTC+0200 Viktor Szakats (harbour syenar.net) + * utils/hbmk2/hbmk2.prg + + hbstart.hb is now searched also at standard location on *nix + system (the same places where hbmk.hbc is searched.) + + hbstart.hb is now executed as normal script code + (was line by line), so this .hb file can be just like + any other .hb file. + 2012-09-24 20:37 UTC+0200 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * harbour/src/vm/macro.c ! added missing HB_STACK_TLS_PRELOAD in last commit - it's necessary diff --git a/harbour/utils/hbmk2/hbmk2.prg b/harbour/utils/hbmk2/hbmk2.prg index 971c04755d..316cae9ce8 100644 --- a/harbour/utils/hbmk2/hbmk2.prg +++ b/harbour/utils/hbmk2/hbmk2.prg @@ -9549,23 +9549,22 @@ STATIC FUNCTION HBC_Find( hbmk, cFile, nNesting ) RETURN lFound +STATIC FUNCTION AutoConfPathList() +#if defined( __PLATFORM__UNIX ) + RETURN { hb_DirSepAdd( GetEnv( "HOME" ) ) + ".harbour",; + "/etc/harbour",; + hb_DirSepAdd( hb_DirBase() ) + "../etc/harbour",; + hb_DirSepAdd( hb_DirBase() ) + "../etc",; + hb_DirBase() } +#else + RETURN { hb_DirBase() } +#endif + STATIC PROCEDURE HBC_ProcessAuto( hbmk ) LOCAL cDir LOCAL cFileName - LOCAL aCFGDirs - - #if defined( __PLATFORM__UNIX ) - aCFGDirs := { hb_DirSepAdd( GetEnv( "HOME" ) ) + ".harbour",; - "/etc/harbour",; - hb_DirSepAdd( hb_DirBase() ) + "../etc/harbour",; - hb_DirSepAdd( hb_DirBase() ) + "../etc",; - hb_DirBase() } - #else - aCFGDirs := { hb_DirBase() } - #endif - - FOR EACH cDir IN aCFGDirs + FOR EACH cDir IN AutoConfPathList() IF hb_FileExists( cFileName := ( hb_PathNormalize( hb_DirSepAdd( cDir ) ) + _HBMK_AUTOHBC_NAME ) ) IF ! hbmk[ _HBMK_lQuiet ] _hbmk_OutStd( hbmk, hb_StrFormat( I_( "Processing configuration: %1$s" ), cFileName ) ) @@ -12760,7 +12759,20 @@ STATIC PROCEDURE __hbshell_plugins_unload( plugins ) #include "inkey.ch" #include "setcurs.ch" -#define _SCRIPT_INIT "hbstart.hb" +#define _HBMK_AUTOSHELL_NAME "hbstart.hb" + +STATIC PROCEDURE __hbshell_ProcessStart() + LOCAL cDir + LOCAL cFileName + + FOR EACH cDir IN ArrayJoin( { "." + hb_ps() }, AutoConfPathList() ) + IF hb_FileExists( cFileName := ( hb_PathNormalize( hb_DirSepAdd( cDir ) ) + _HBMK_AUTOSHELL_NAME ) ) + __hbshell_Exec( hb_MemoRead( cFileName ) ) + EXIT + ENDIF + NEXT + + RETURN /* TODO: rewrite the full-screen shell to be a simple stdout/stdin shell */ STATIC PROCEDURE __hbshell_prompt( aParams, aCommand ) @@ -12772,7 +12784,6 @@ STATIC PROCEDURE __hbshell_prompt( aParams, aCommand ) LOCAL lResize := .F. LOCAL plugins LOCAL cCommand - LOCAL cFileName LOCAL cDomain := "" LOCAL cPrompt @@ -12806,12 +12817,7 @@ STATIC PROCEDURE __hbshell_prompt( aParams, aCommand ) __hbshell_Exec( "?? hb_Version()" ) - IF hb_FileExists( cFileName := _SCRIPT_INIT ) .OR. ; - hb_FileExists( cFileName := ( hb_DirBase() + _SCRIPT_INIT ) ) - FOR EACH cCommand IN hb_ATokens( StrTran( hb_MemoRead( cFileName ), Chr( 13 ), Chr( 10 ) ), Chr( 10 ) ) - __hbshell_Exec( cCommand ) - NEXT - ENDIF + __hbshell_ProcessStart() IF HB_ISARRAY( aCommand ) FOR EACH cCommand IN aCommand