Commit a6bfd495 by Alan Mishchenko

Improved printout of command history.

parent da683846
...@@ -62,6 +62,7 @@ extern void Cmd_FlagUpdateValue( Abc_Frame_t * pAbc, const char * key, ch ...@@ -62,6 +62,7 @@ extern void Cmd_FlagUpdateValue( Abc_Frame_t * pAbc, const char * key, ch
extern void Cmd_HistoryAddCommand( Abc_Frame_t * pAbc, const char * command ); extern void Cmd_HistoryAddCommand( Abc_Frame_t * pAbc, const char * command );
extern void Cmd_HistoryRead( Abc_Frame_t * p ); extern void Cmd_HistoryRead( Abc_Frame_t * p );
extern void Cmd_HistoryWrite( Abc_Frame_t * p, int Limit ); extern void Cmd_HistoryWrite( Abc_Frame_t * p, int Limit );
extern void Cmd_HistoryPrint( Abc_Frame_t * p, int Limit );
/*=== cmdLoad.c ========================================================*/ /*=== cmdLoad.c ========================================================*/
extern int CmdCommandLoad( Abc_Frame_t * pAbc, int argc, char ** argv ); extern int CmdCommandLoad( Abc_Frame_t * pAbc, int argc, char ** argv );
......
...@@ -55,7 +55,8 @@ void Cmd_HistoryAddCommand( Abc_Frame_t * p, const char * command ) ...@@ -55,7 +55,8 @@ void Cmd_HistoryAddCommand( Abc_Frame_t * p, const char * command )
strcpy( Buffer, command ); strcpy( Buffer, command );
if ( Buffer[Len-1] == '\n' ) if ( Buffer[Len-1] == '\n' )
Buffer[Len-1] = 0; Buffer[Len-1] = 0;
if ( strncmp(Buffer,"set",3) && if ( strlen(Buffer) > 3 &&
strncmp(Buffer,"set",3) &&
strncmp(Buffer,"quit",4) && strncmp(Buffer,"quit",4) &&
strncmp(Buffer,"source",6) && strncmp(Buffer,"source",6) &&
strncmp(Buffer,"history",7) && strncmp(Buffer,"hi ", 3) && strcmp(Buffer,"hi") ) strncmp(Buffer,"history",7) && strncmp(Buffer,"hi ", 3) && strcmp(Buffer,"hi") )
...@@ -140,6 +141,30 @@ void Cmd_HistoryWrite( Abc_Frame_t * p, int Limit ) ...@@ -140,6 +141,30 @@ void Cmd_HistoryWrite( Abc_Frame_t * p, int Limit )
#endif #endif
} }
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Cmd_HistoryPrint( Abc_Frame_t * p, int Limit )
{
#if defined(WIN32)
char * pStr;
int i;
Limit = Abc_MaxInt( 0, Vec_PtrSize(p->aHistory)-Limit );
printf( "================== Command history ==================\n" );
Vec_PtrForEachEntryStart( char *, p->aHistory, pStr, i, Limit )
printf( "%s\n", pStr );
printf( "=====================================================\n" );
#endif
}
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/// END OF FILE /// /// END OF FILE ///
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
......
...@@ -709,7 +709,7 @@ int Cmd_CommandAbcLoadPlugIn( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -709,7 +709,7 @@ int Cmd_CommandAbcLoadPlugIn( Abc_Frame_t * pAbc, int argc, char ** argv )
// plugin_commands.push(Pair(cmd_name, binary_name)); // plugin_commands.push(Pair(cmd_name, binary_name));
Vec_PtrPush( pAbc->vPlugInComBinPairs, Extra_UtilStrsav(pBuffer) ); Vec_PtrPush( pAbc->vPlugInComBinPairs, Extra_UtilStrsav(pBuffer) );
Vec_PtrPush( pAbc->vPlugInComBinPairs, Extra_UtilStrsav(pStrDirBin) ); Vec_PtrPush( pAbc->vPlugInComBinPairs, Extra_UtilStrsav(pStrDirBin) );
printf( "Creating command %s with binary %s\n", pBuffer, pStrDirBin ); // printf( "Creating command %s with binary %s\n", pBuffer, pStrDirBin );
} }
fclose( pFile ); fclose( pFile );
Util_SignalTmpFileRemove( pTempFile, 0 ); Util_SignalTmpFileRemove( pTempFile, 0 );
......
...@@ -268,8 +268,11 @@ int Abc_RealMain( int argc, char * argv[] ) ...@@ -268,8 +268,11 @@ int Abc_RealMain( int argc, char * argv[] )
else else
{ {
// start interactive mode // start interactive mode
// print the hello line // print the hello line
Abc_UtilsPrintHello( pAbc ); Abc_UtilsPrintHello( pAbc );
// print history of the recent commands
Cmd_HistoryPrint( pAbc, 10 );
// source the resource file // source the resource file
if ( fInitSource ) if ( fInitSource )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment