Example #1
0
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 );
    }
}
Example #2
0
void ErrorExit( const char *msg )
/*******************************/
{
    QWrite( STDERR_HANDLE, msg, strlen( msg ), "console" );
    QWriteNL( STDERR_HANDLE, "console" );
    Suicide();
}
Example #3
0
void StopMapBuffering( void )
/**********************************/
// flush buffer & shut buffering off.
{
    if( BufferSize != 0 ) {
        QWrite( MapFile, TokBuff, BufferSize, MapFName );
    }
    Buffering = FALSE;
    BufferSize = 0;
}
Example #4
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 );
}
Example #5
0
void QWriteNL( f_handle file, const char *name )
/**********************************************/
{
    QWrite( file, "\n", 1, name );
}
Example #6
0
void CommandOut( const char *command )
/************************************/
{
    QWrite( STDOUT_HANDLE, command, strlen( command ), "console" );
    QWriteNL( STDOUT_HANDLE, "console" );
}
Example #7
0
void ErrorOut( const char *msg )
/******************************/
{
    QWrite( STDERR_HANDLE, msg, strlen( msg ), "console" );
}
Example #8
0
void QWriteNL( f_handle file, char *name )
/***********************************************/
{
    QWrite( file, NLSeq, sizeof( NLSeq ) - 1, name );
}
Example #9
0
void WriteStdOut( char *str )
/**********************************/
{
    QWrite( STDOUT_HANDLE, str, strlen( str ), NULL );
}
Example #10
0
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 );
}