diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 1b26996e5e..ba14ed2c95 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,17 @@ 2002-12-01 13:30 UTC+0100 Foo Bar */ +2007-08-23 18:25 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/source/rtl/gttrm/gttrm.c + * enable automatic LF->CR+LF translation on TTY device + + * harbour/utils/hbdot/hbdot.prg + * do not clear screen when hbdot executed with -h or --help switch + + * harbour/utils/hbtest/hbtest.prg + * use stdout() instead of fwrite(1,) - now GT driver + can catch and redirect output if necessary + 2007-08-23 17:15 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl) * harbour/source/rtl/gttrm/gttrm.c * set cursor position at beginning of new line on application exit diff --git a/harbour/source/rtl/gttrm/gttrm.c b/harbour/source/rtl/gttrm/gttrm.c index ab982a6e35..f4962b9887 100644 --- a/harbour/source/rtl/gttrm/gttrm.c +++ b/harbour/source/rtl/gttrm/gttrm.c @@ -2831,7 +2831,9 @@ static void hb_gt_trm_Init( FHANDLE hFilenoStdin, FHANDLE hFilenoStdout, FHANDLE s_termState.curr_TIO.c_cflag |= CS8 | CREAD; s_termState.curr_TIO.c_iflag &= ~( IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON ); s_termState.curr_TIO.c_oflag &= ~OPOST; - /* s_termState.curr_TIO.c_oflag |= ONLCR | OPOST; */ + /* Enable LF->CR+LF translation */ + s_termState.curr_TIO.c_oflag |= ONLCR | OPOST; + memset( s_termState.curr_TIO.c_cc, 0, NCCS ); /* s_termState.curr_TIO.c_cc[ VMIN ] = 0; */ /* s_termState.curr_TIO.c_cc[ VTIME ] = 0; */ @@ -3085,8 +3087,9 @@ static void hb_gt_trm_Scroll( int iTop, int iLeft, int iBottom, int iRight, HB_GTSUPER_SCROLLUP( iRows, bColor, bChar ); /* update our internal row position */ do - hb_gt_trm_termOut( ( BYTE * ) "\n", 1 ); + hb_gt_trm_termOut( ( BYTE * ) "\n\r", 2 ); while( --iRows > 0 ); + s_termState.iCol = 0; return; } } diff --git a/harbour/utils/hbdot/hbdot.prg b/harbour/utils/hbdot/hbdot.prg index 0d6e7271f1..88c1aed015 100644 --- a/harbour/utils/hbdot/hbdot.prg +++ b/harbour/utils/hbdot/hbdot.prg @@ -82,8 +82,6 @@ PROCEDURE _APPMAIN( cFile, ... ) AADD( s_aIncDir, "-I/usr/local/include/harbour" ) #endif - CLEAR SCREEN - IF PCount() > 0 SWITCH cFile CASE "-?" @@ -104,6 +102,7 @@ PROCEDURE _APPMAIN( cFile, ... ) END ELSE + CLEAR SCREEN SET SCOREBOARD OFF GetList := {} cCommand := "" diff --git a/harbour/utils/hbtest/hbtest.prg b/harbour/utils/hbtest/hbtest.prg index ee3df13cad..dac0451dfc 100644 --- a/harbour/utils/hbtest/hbtest.prg +++ b/harbour/utils/hbtest/hbtest.prg @@ -238,19 +238,19 @@ STATIC FUNCTION TEST_BEGIN( cParam ) /* Feedback */ - FWrite( s_nFhnd, "---------------------------------------------------------------------------" + HB_OSNewLine() +; + OutMsg( s_nFhnd, "---------------------------------------------------------------------------" + HB_OSNewLine() +; " Version: " + Version() + HB_OSNewLine() ) #ifdef __HARBOUR__ - FWrite( s_nFhnd, " Compiler: " + HB_Compiler() + HB_OSNewLine() ) + OutMsg( s_nFhnd, " Compiler: " + HB_Compiler() + HB_OSNewLine() ) #endif - FWrite( s_nFhnd, " OS: " + OS() + HB_OSNewLine() +; + OutMsg( s_nFhnd, " OS: " + OS() + HB_OSNewLine() +; " Date, Time: " + DToC( Date() ) + " " + Time() + HB_OSNewLine() +; " Output: " + s_cFileName + HB_OSNewLine() +; "Shortcut opt.: " + iif( s_lShortcut, "ON", "OFF" ) + HB_OSNewLine() +; " Switches: " + cParam + HB_OSNewLine() +; "===========================================================================" + HB_OSNewLine() ) - FWrite( s_nFhnd, PadR( "R", TEST_RESULT_COL1_WIDTH ) + " " +; + OutMsg( s_nFhnd, PadR( "R", TEST_RESULT_COL1_WIDTH ) + " " +; PadR( "No. Line", TEST_RESULT_COL2_WIDTH ) + " " +; PadR( "TestCall()", TEST_RESULT_COL3_WIDTH ) + " -> " +; PadR( "Result", TEST_RESULT_COL4_WIDTH ) + " | " +; @@ -371,7 +371,7 @@ FUNCTION TEST_CALL( cBlock, bBlock, xResultExpected ) IF lFailed - FWrite( s_nFhnd, PadR( iif( lFailed, "!", iif( lSkipped, "S", " " ) ), TEST_RESULT_COL1_WIDTH ) + " " +; + OutMsg( s_nFhnd, PadR( iif( lFailed, "!", iif( lSkipped, "S", " " ) ), TEST_RESULT_COL1_WIDTH ) + " " +; PadR( Str( s_nCount, 4 ) + " " + ProcName( 1 ) + "(" + LTrim( Str( ProcLine( 1 ), 5 ) ) + ")", TEST_RESULT_COL2_WIDTH ) + " " +; PadR( cBlock, TEST_RESULT_COL3_WIDTH ) +; HB_OSNewLine() +; @@ -382,7 +382,7 @@ FUNCTION TEST_CALL( cBlock, bBlock, xResultExpected ) ELSE - FWrite( s_nFhnd, PadR( iif( lFailed, "!", iif( lSkipped, "S", " " ) ), TEST_RESULT_COL1_WIDTH ) + " " +; + OutMsg( s_nFhnd, PadR( iif( lFailed, "!", iif( lSkipped, "S", " " ) ), TEST_RESULT_COL1_WIDTH ) + " " +; PadR( Str( s_nCount, 4 ) + " " + ProcName( 1 ) + "(" + LTrim( Str( ProcLine( 1 ), 5 ) ) + ")", TEST_RESULT_COL2_WIDTH ) + " " +; PadR( cBlock, TEST_RESULT_COL3_WIDTH ) + " -> " +; PadR( XToStr( xResult ), TEST_RESULT_COL4_WIDTH ) + " | " +; @@ -412,7 +412,7 @@ STATIC FUNCTION TEST_END() s_nEndTime := Seconds() - FWrite( s_nFhnd, "===========================================================================" + HB_OSNewLine() +; + OutMsg( s_nFhnd, "===========================================================================" + HB_OSNewLine() +; "Test calls passed: " + Str( s_nPass ) + " ( " + LTrim( Str( ( 1 - ( s_nFail / s_nPass ) ) * 100, 6, 2 ) ) + " % )" + HB_OSNewLine() +; "Test calls failed: " + Str( s_nFail ) + " ( " + LTrim( Str( ( s_nFail / s_nPass ) * 100, 6, 2 ) ) + " % )" + HB_OSNewLine() +; " ----------" + HB_OSNewLine() +; @@ -422,10 +422,10 @@ STATIC FUNCTION TEST_END() IF s_nFail != 0 IF "CLIPPER (R)" $ Upper( Version() ) - FWrite( s_nFhnd, "WARNING ! Failures detected using CA-Clipper." + HB_OSNewLine() +; + OutMsg( s_nFhnd, "WARNING ! Failures detected using CA-Clipper." + HB_OSNewLine() +; "Please fix those expected results which are not bugs in CA-Clipper itself." + HB_OSNewLine() ) ELSE - FWrite( s_nFhnd, "WARNING ! Failures detected" + HB_OSNewLine() ) + OutMsg( s_nFhnd, "WARNING ! Failures detected" + HB_OSNewLine() ) ENDIF ENDIF @@ -606,11 +606,22 @@ FUNCTION HB_SToD( cDate ) STATIC FUNCTION BADFNAME() #ifdef __PLATFORM__UNIX - return "*BADNAM/*.MEM" + RETURN "*BADNAM/*.MEM" #else - return "*BADNAM*.MEM" + RETURN "*BADNAM*.MEM" #endif +STATIC FUNCTION OutMsg( hFile, cMsg ) + + IF hFile == 1 + OutStd( cMsg ) + ELSEIF hFile == 2 + OutErr( cMsg ) + ELSE + FWrite( hFile, cMsg ) + ENDIF + + RETURN NIL /* Don't change the position of this #include. */ #include "rt_init.ch"