view stitch/srcio.c @ 0:5242703e91d3 tip

Initial checkin for AIM92 aimR8.2 (last updated May 1997).
author tomwalters
date Fri, 20 May 2011 15:19:45 +0100
parents
children
line wrap: on
line source
/*
    srcio.c
    =======

    stdio compatability routines for sources

*/

#include "stitch.h"
#include "source.h"
#include "srcio.h"



/* Can be used for compatability with stdio FILE operations */

int sread( pointer, size, number, source )
char *pointer ;
unsigned size, number ;
Source source ;
{
    ByteCount bytes = size * number ;

    (void) FillSome( source, &bytes, pointer ) ;

    return ( bytes / size ) ;
}

/* sseek() only works for positive, relative seeks i.e. data skiping seeks */

int sseek( source, offset, pointername )
Source source ;
long offset ;
int pointername ;
{
    ByteCount bytes = -offset ;

    if( offset > 0 && pointername == 1 )
	(void) PullSome( source, &bytes ) ;

    return ( 0 ) ;
}

int sclose( source )
Source source ;
{
    ByteCount bytes = 0 ;

    (void) PullSome( source, &bytes ) ;

    return ( 0 ) ;
}