From ec3d1fce8994009b335792d82e47fb2412483418 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Wed, 24 Feb 2010 09:04:21 +0000 Subject: [PATCH] 2010-02-24 10:03 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbxpp/Makefile + contrib/hbxpp/runshell.prg + Added RUNSHELL() * src/rtl/hbproces.c * contrib/hbxpp/dll.ch * Formatting. --- harbour/ChangeLog | 11 +++- harbour/contrib/hbxpp/Makefile | 1 + harbour/contrib/hbxpp/dll.ch | 4 +- harbour/contrib/hbxpp/runshell.prg | 89 ++++++++++++++++++++++++++++++ harbour/src/rtl/hbproces.c | 2 +- 5 files changed, 103 insertions(+), 4 deletions(-) create mode 100644 harbour/contrib/hbxpp/runshell.prg diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 91dd55b41e..5d3d78576b 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -17,11 +17,20 @@ past entries belonging to author(s): Viktor Szakats. */ +2010-02-24 10:03 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) + * contrib/hbxpp/Makefile + + contrib/hbxpp/runshell.prg + + Added RUNSHELL() + + * src/rtl/hbproces.c + * contrib/hbxpp/dll.ch + * Formatting. + 2010-02-23 14:34 UTC-0800 Pritpal Bedi (pritpal@vouchcac.com) + contrib/hbide/resources/hbide.png + Added icon to be displayable in hbIDE windows title-bar. Please visualize and forward any suggesstion. If possible - you can redesign it. + you can redesign it. 2010-02-23 20:52 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * examples/hbdoc2/hbdoc2.prg diff --git a/harbour/contrib/hbxpp/Makefile b/harbour/contrib/hbxpp/Makefile index 396dc4fb50..2f90943452 100644 --- a/harbour/contrib/hbxpp/Makefile +++ b/harbour/contrib/hbxpp/Makefile @@ -27,6 +27,7 @@ PRG_SOURCES := \ dbstruxx.prg \ dbtotalx.prg \ dbupdatx.prg \ + runshell.prg \ tbcolumx.prg \ tbrowsex.prg \ tgetx.prg \ diff --git a/harbour/contrib/hbxpp/dll.ch b/harbour/contrib/hbxpp/dll.ch index 88d7dd86ab..2cbc2f10ac 100644 --- a/harbour/contrib/hbxpp/dll.ch +++ b/harbour/contrib/hbxpp/dll.ch @@ -68,7 +68,7 @@ /* Only for compatiblity. Harbour always copies the string to a temporary buffer. */ -#define DLL_CALLMODE_COPY 0 -#define DLL_CALLMODE_NORMAL DLL_CALLMODE_COPY +#define DLL_CALLMODE_COPY 0 +#define DLL_CALLMODE_NORMAL DLL_CALLMODE_COPY #endif /* _DLL_CH */ diff --git a/harbour/contrib/hbxpp/runshell.prg b/harbour/contrib/hbxpp/runshell.prg new file mode 100644 index 0000000000..fe3e2393f1 --- /dev/null +++ b/harbour/contrib/hbxpp/runshell.prg @@ -0,0 +1,89 @@ +/* + * $Id$ + */ + +/* + * Harbour Project source code: + * RUNSHELL() + * + * Copyright 2010 Viktor Szakats (harbour.01 syenar.hu) + * www - http://www.harbour-project.org + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this software; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/). + * + * As a special exception, the Harbour Project gives permission for + * additional uses of the text contained in its release of Harbour. + * + * The exception is that, if you link the Harbour libraries with other + * files to produce an executable, this does not by itself cause the + * resulting executable to be covered by the GNU General Public License. + * Your use of that executable is in no way restricted on account of + * linking the Harbour library code into it. + * + * This exception does not however invalidate any other reasons why + * the executable file might be covered by the GNU General Public License. + * + * This exception applies only to the code released by the Harbour + * Project under the name Harbour. If you copy code from other + * Harbour Project or Free Software Foundation releases into a copy of + * Harbour, as the General Public License permits, the exception does + * not apply to the code that you add in this way. To avoid misleading + * anyone as to the status of such modified files, you must delete + * this exception notice from them. + * + * If you write modifications of your own for Harbour, it is your choice + * whether to permit this exception to apply to your modifications. + * If you do not wish that, delete this exception notice. + * + */ + +#include "common.ch" + +FUNCTION RunShell( cCommand, cProgram, lAsync, lBackground ) + + /* Not supported (yet?) */ + HB_SYMBOL_UNUSED( lBackground ) + + IF ! ISCHARACTER( cProgram ) + #if defined( __PLATFORM__UNIX ) + cProgram := hb_getenv( "SHELL" ) + #elif defined( __PLATFORM__OS2 ) + cProgram := hb_getenv( "OS2_SHELL" ) + #else + cProgram := hb_getenv( "COMSPEC" ) + #endif + IF Empty( cProgram ) + #if defined( __PLATFORM__WINDOWS ) + IF hb_osIsWinNT() + cProgram := "cmd.exe" + ELSE + cProgram := "command.com" + ENDIF + #elif defined( __PLATFORM__DOS ) + cProgram := "command.com" + #elif defined( __PLATFORM__OS2 ) + cProgram := "cmd.exe" + #else + cProgram := "" + #endif + ENDIF + ENDIF + + IF ISCHARACTER( cCommand ) + cProgram += " " + cCommand + ENDIF + + RETURN hb_processRun( LTrim( cProgram ), NIL, NIL, NIL, lAsync ) diff --git a/harbour/src/rtl/hbproces.c b/harbour/src/rtl/hbproces.c index a0f979c883..e095601da1 100644 --- a/harbour/src/rtl/hbproces.c +++ b/harbour/src/rtl/hbproces.c @@ -239,7 +239,7 @@ static void hb_getCommand( const char *pszFilename, #endif #if defined( HB_OS_DOS ) || defined( HB_OS_OS2 ) || defined( HB_OS_WIN_CE ) -static int hb_fsProcessExec( const char *pszFilename, +static int hb_fsProcessExec( const char * pszFilename, HB_FHANDLE hStdin, HB_FHANDLE hStdout, HB_FHANDLE hStderr ) {