system/src/newlib/_syscalls.c
/* fd, is a valid user file handle.
 Translates the return of _swiread into
 bytes read. */
fd, is a valid user file handle.
Translates the return of _swiread into
bytes read.
fd is a valid user file handle . Translates the return of _swiread into bytes read .
int
_read (int fd, char* ptr, int len)
{
  int res;
  struct fdent *pfd;
  pfd = findslot (fd);
  if (pfd == NULL)
    {
      errno = EBADF;
      return -1;
    }
  res = _swiread (pfd->handle, ptr, len);
  if (res == -1)
    {
      return res;
    }
  pfd->pos += len - res;
  return len - res;
}
int _read ( int fd , char * ptr , int len ) { int res ; struct fdent * pfd ; pfd = findslot ( fd ) ; if ( pfd == NULL ) { errno = EBADF ; return -1 ; } res = _swiread ( pfd -> handle , ptr , len ) ; if ( res == -1 ) { return res ; } pfd -> pos += len - res ; return len - res ; }
fd, is a valid user file handle.
fd is a valid user file handle .
/* res == len is not an error,
   at least if we want feof() to work.  */