Utah Raster Toolkit  9999-git
URT Development version (post-3.1b)
Functions | Variables
bread.c File Reference
#include "stdio.h"
Include dependency graph for bread.c:

Go to the source code of this file.

Functions

 bread (char *ptr, unsigned size, FILE *iop)
 

Variables

static char rcs_ident [] = "$Header: bread.c,v 2.3 86/06/18 11:46:19 thomas Exp $"
 

Function Documentation

bread ( char *  ptr,
unsigned  size,
FILE *  iop 
)

Definition at line 26 of file bread.c.

30 {
31  register unsigned ndone, s;
32  register int c;
33 
34  if (!size) return 0;
35 
36  ndone = size;
37  if ( iop->_cnt >= ndone )
38  {
39  switch ( ndone )
40  {
41  /* WARNING -- the first two cases should be
42  * "sizeof(short)" and "sizeof(long)", but the compiler
43  * doesn't like those.
44  */
45  case sizeof(short): *(short *)ptr = *(short *)iop->_ptr;
46  break;
47  case sizeof(long): *(long *)ptr = *(int *)iop->_ptr;
48  break;
49  default: /*bcopy( iop->_ptr, ptr, ndone );*/
50 #ifdef vax
51  asm(" movl 4(r10),r0");
52  asm(" movc3 r9,(r0),(r11)");
53 #else
54  bcopy( iop->_ptr, ptr, ndone );
55 #endif
56  }
57  iop->_cnt -= ndone;
58  iop->_ptr += ndone;
59  }
60  else
61  while ( ndone != 0 )
62  {
63  if ( iop->_cnt == 0 )
64  if ((c = _filbuf(iop)) == EOF)
65  return (size - ndone) ;
66  else
67  {
68  *ptr++ = c;
69  ndone--;
70  }
71 
72  if (s = ndone)
73  {
74  if ( s > iop->_cnt )
75  s = iop->_cnt;
76  iop->_cnt -= s; /* work-around for CC bug */
77 /* bcopy( iop->_ptr, ptr, s );*/
78  asm(" movl 4(r10),r0");
79  asm(" movc3 r8,(r0),(r11)");
80  iop->_ptr += s;
81  ndone -= s;
82  ptr += s;
83  }
84  }
85 
86  return size;
87 }
_urt_stack * s
Definition: rleClock.c:919
int * ptr
Definition: scanargs.c:57
gpr_ $offset_t size
Definition: getap.c:96

Variable Documentation

char rcs_ident[] = "$Header: bread.c,v 2.3 86/06/18 11:46:19 thomas Exp $"
static

Definition at line 22 of file bread.c.