void WriteNulls( f_handle file, unsigned_32 len, char *name ) /*******************************************************************/ /* copy nulls for uninitialized data */ { static unsigned NullArray[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; for( ; len > sizeof( NullArray ); len -= sizeof( NullArray ) ) { QWrite( file, NullArray, sizeof( NullArray ), name ); } if( len > 0 ) { QWrite( file, NullArray, len, name ); } }
void ErrorExit( const char *msg ) /*******************************/ { QWrite( STDERR_HANDLE, msg, strlen( msg ), "console" ); QWriteNL( STDERR_HANDLE, "console" ); Suicide(); }
void StopMapBuffering( void ) /**********************************/ // flush buffer & shut buffering off. { if( BufferSize != 0 ) { QWrite( MapFile, TokBuff, BufferSize, MapFName ); } Buffering = FALSE; BufferSize = 0; }
int CopyFile( const char * file1, const char * file2 ) /****************************************************/ { size_t len; auto struct stat statblk; auto struct utimbuf utimebuf; remove( file2 ); OutFile = NOFILE; InFile = QOpen( file1, O_RDONLY | O_BINARY, 0 ); OutFile = QOpen( file2, O_WRONLY | O_TRUNC | O_CREAT | O_BINARY, 0 ); while( (len = QRead( InFile, InputBuffer, MAX_OBJECT_REC_SIZE )) != 0 ) { QWrite( OutFile, InputBuffer, len ); } CloseFiles(); if( stat( file1, &statblk ) == 0 ) { utimebuf.actime = statblk.st_atime; utimebuf.modtime = statblk.st_mtime; utime( file2, &utimebuf ); } return( OK ); }
void QWriteNL( f_handle file, const char *name ) /**********************************************/ { QWrite( file, "\n", 1, name ); }
void CommandOut( const char *command ) /************************************/ { QWrite( STDOUT_HANDLE, command, strlen( command ), "console" ); QWriteNL( STDOUT_HANDLE, "console" ); }
void ErrorOut( const char *msg ) /******************************/ { QWrite( STDERR_HANDLE, msg, strlen( msg ), "console" ); }
void QWriteNL( f_handle file, char *name ) /***********************************************/ { QWrite( file, NLSeq, sizeof( NLSeq ) - 1, name ); }
void WriteStdOut( char *str ) /**********************************/ { QWrite( STDOUT_HANDLE, str, strlen( str ), NULL ); }
void SpillWrite( virt_mem_size base, size_t off, const void *mem, size_t size ) /*****************************************************************************/ { QSeek( TempFile, base + (unsigned long)off - 1, TFileName ); QWrite( TempFile, mem, size, TFileName ); }