diff options
author | Niklas Een <niklas@een.se> | 2013-06-28 21:11:26 -0700 |
---|---|---|
committer | Niklas Een <niklas@een.se> | 2013-06-28 21:11:26 -0700 |
commit | 43df8967b55222072d4e50201438c4c193dc0bd0 (patch) | |
tree | 51894af3c0bf904f60850b115dad580c7f6d00d2 /src/misc | |
parent | fe40fd5c80926c8e529695528507aab49d808888 (diff) | |
download | abc-43df8967b55222072d4e50201438c4c193dc0bd0.tar.gz abc-43df8967b55222072d4e50201438c4c193dc0bd0.tar.bz2 abc-43df8967b55222072d4e50201438c4c193dc0bd0.zip |
Fixed a problem in BridgeMode; it will now correctly detect if the pipe has been closed and exit ABC.
Diffstat (limited to 'src/misc')
-rw-r--r-- | src/misc/util/utilBridge.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/misc/util/utilBridge.c b/src/misc/util/utilBridge.c index 3ac7ba2c..cd00dec6 100644 --- a/src/misc/util/utilBridge.c +++ b/src/misc/util/utilBridge.c @@ -22,6 +22,9 @@ #include <string.h> #include <stdlib.h> #include <assert.h> +#ifdef LIN +#include <unistd.h> +#endif #include "aig/gia/gia.h" @@ -124,9 +127,24 @@ void Gia_CreateHeader( FILE * pFile, int Type, int Size, unsigned char * pBuffer fprintf( pFile, " " ); fprintf( pFile, "%.16d", Size ); fprintf( pFile, " " ); + #ifndef LIN RetValue = fwrite( pBuffer, Size, 1, pFile ); assert( RetValue == 1 || Size == 0); fflush( pFile ); + #else + fflush(pFile); + int fd = fileno(pFile); + + ssize_t bytes_written = 0; + while (bytes_written < Size){ + ssize_t n = write(fd, &pBuffer[bytes_written], Size - bytes_written); + if (n < 0){ + fprintf(stderr, "BridgeMode: failed to send package; aborting\n"); fflush(stderr); + _exit(255); + } + bytes_written += n; + } + #endif } @@ -244,7 +262,7 @@ int Gia_ManToBridgeResult( FILE * pFile, int Result, Abc_Cex_t * pCex ) Synopsis [] Description [] - + SideEffects [] SeeAlso [] @@ -393,7 +411,7 @@ int Gia_ManFromBridgeReadPackage( FILE * pFile, int * pType, int * pSize, unsign Synopsis [] Description [] - + SideEffects [] SeeAlso [] @@ -439,7 +457,7 @@ Gia_Man_t * Gia_ManFromBridge( FILE * pFile, Vec_Int_t ** pvInit ) Synopsis [] Description [] - + SideEffects [] SeeAlso [] @@ -462,7 +480,7 @@ void Gia_ManToBridgeAbsNetlistTest( char * pFileName, Gia_Man_t * p, int msg_typ Synopsis [] Description [] - + SideEffects [] SeeAlso [] |