Subversion Repositories Kolibri OS

Rev

Rev 4874 | Rev 6068 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4874 Rev 4921
Line 76... Line 76...
76
int
76
int
77
_DEFUN(_puts_r, (ptr, s),
77
_DEFUN(_puts_r, (ptr, s),
78
       struct _reent *ptr _AND
78
       struct _reent *ptr _AND
79
       _CONST char * s)
79
       _CONST char * s)
80
{
80
{
-
 
81
#ifdef _FVWRITE_IN_STREAMIO
-
 
82
  int result;
81
  size_t c = strlen (s);
83
  size_t c = strlen (s);
82
  struct __suio uio;
84
  struct __suio uio;
83
  struct __siov iov[2];
85
  struct __siov iov[2];
-
 
86
  FILE *fp;
Line 84... Line 87...
84
 
87
 
85
  iov[0].iov_base = s;
88
  iov[0].iov_base = s;
86
  iov[0].iov_len = c;
89
  iov[0].iov_len = c;
87
  iov[1].iov_base = "\n";
90
  iov[1].iov_base = "\n";
88
  iov[1].iov_len = 1;
91
  iov[1].iov_len = 1;
89
  uio.uio_resid = c + 1;
92
  uio.uio_resid = c + 1;
90
  uio.uio_iov = &iov[0];
93
  uio.uio_iov = &iov[0];
-
 
94
  uio.uio_iovcnt = 2;
-
 
95
 
-
 
96
  _REENT_SMALL_CHECK_INIT (ptr);
-
 
97
  fp = _stdout_r (ptr);
-
 
98
  _newlib_flockfile_start (fp);
-
 
99
  ORIENT (fp, -1);
-
 
100
  result = (__sfvwrite_r (ptr, fp, &uio) ? EOF : '\n');
-
 
101
  _newlib_flockfile_end (fp);
-
 
102
  return result;
-
 
103
#else
-
 
104
  int result = EOF;
-
 
105
  const char *p = s;
91
  uio.uio_iovcnt = 2;
106
  FILE *fp;
-
 
107
  _REENT_SMALL_CHECK_INIT (ptr);
-
 
108
 
-
 
109
  fp = _stdout_r (ptr);
92
  _REENT_SMALL_CHECK_INIT (ptr);
110
  _newlib_flockfile_start (fp);
-
 
111
  ORIENT (fp, -1);
-
 
112
  /* Make sure we can write.  */
-
 
113
  if (cantwrite (ptr, fp))
-
 
114
    goto err;
-
 
115
 
-
 
116
  while (*p)
93
  ORIENT (stdout, -1);
117
    {
-
 
118
      if (__sputc_r (ptr, *p++, fp) == EOF)
-
 
119
	goto err;
-
 
120
    }
-
 
121
  if (__sputc_r (ptr, '\n', fp) == EOF)
-
 
122
    goto err;
-
 
123
 
-
 
124
  result = '\n';
-
 
125
 
-
 
126
err:
-
 
127
  _newlib_flockfile_end (fp);
-
 
128
  return result;
94
  return (__sfvwrite_r (ptr, _stdout_r (ptr), &uio) ? EOF : '\n');
129
#endif
Line 95... Line 130...
95
}
130
}
Line 96... Line 131...
96
 
131