diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2012-08-24 12:25:53 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2012-08-24 12:25:53 -0700 |
commit | 7e2b00776213f86f54b9aa601e8593951b9de7d0 (patch) | |
tree | bc8d5f545162d5abf1fab5b4d54d3ae922042b12 /src/base/cmd/cmdHist.c | |
parent | 4a9152d0e1af415b7890b9a501b989b6472dbac8 (diff) | |
download | abc-7e2b00776213f86f54b9aa601e8593951b9de7d0.tar.gz abc-7e2b00776213f86f54b9aa601e8593951b9de7d0.tar.bz2 abc-7e2b00776213f86f54b9aa601e8593951b9de7d0.zip |
Added recording history of used commands into file 'abc.history' (Windows only).
Diffstat (limited to 'src/base/cmd/cmdHist.c')
-rw-r--r-- | src/base/cmd/cmdHist.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/base/cmd/cmdHist.c b/src/base/cmd/cmdHist.c index ba467f76..49808ec5 100644 --- a/src/base/cmd/cmdHist.c +++ b/src/base/cmd/cmdHist.c @@ -54,6 +54,60 @@ void Cmd_HistoryAddCommand( Abc_Frame_t * p, const char * command ) Vec_PtrPush( p->aHistory, Extra_UtilStrsav(Buffer) ); } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Cmd_HistoryRead( Abc_Frame_t * p ) +{ + char Buffer[1000]; + FILE * pFile; + assert( Vec_PtrSize(p->aHistory) == 0 ); + pFile = fopen( "abc.history", "rb" ); + if ( pFile == NULL ) + { +// Abc_Print( 0, "Cannot open file \"abc.history\" for reading.\n" ); + return; + } + while ( fgets( Buffer, 1000, pFile ) != NULL ) + Vec_PtrPush( p->aHistory, Extra_UtilStrsav(Buffer) ); + fclose( pFile ); +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Cmd_HistoryWrite( Abc_Frame_t * p ) +{ + FILE * pFile; + char * pName; + int i; + pFile = fopen( "abc.history", "wb" ); + if ( pFile == NULL ) + { + Abc_Print( 0, "Cannot open file \"abc.history\" for writing.\n" ); + return; + } + Vec_PtrForEachEntry( char *, p->aHistory, pName, i ) + fputs( pName, pFile ); + fclose( pFile ); +} + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// |