system/src/newlib/_syscalls.c
/* fd, is a user file descriptor. */
fd, is a user file descriptor.
fd is a user file descriptor .
int
_write (int fd, char* ptr, int len)
{
  int res;
  struct fdent *pfd;
  pfd = findslot (fd);
  if (pfd == NULL)
    {
      errno = EBADF;
      return -1;
    }
  res = _swiwrite (pfd->handle, ptr, len);
  if (res < 0)
    {
      return -1;
    }
  pfd->pos += len - res;
  if ((len - res) == 0)
    {
      return error (0);
    }
  return (len - res);
}
int _write ( int fd , char * ptr , int len ) { int res ; struct fdent * pfd ; pfd = findslot ( fd ) ; if ( pfd == NULL ) { errno = EBADF ; return -1 ; } res = _swiwrite ( pfd -> handle , ptr , len ) ; if ( res < 0 ) { return -1 ; } pfd -> pos += len - res ; if ( ( len - res ) == 0 ) { return error ( 0 ) ; } return ( len - res ) ; }
fd, is a user file descriptor.
fd is a user file descriptor .
/* Clearly an error. */ /* We wrote 0 bytes?
   Retrieve errno just in case. */