Пример #1
0
int
ferror(FILE* fp) {
    int ret;
    FLOCKFILE(fp);
    ret = __sferror(fp);
    FUNLOCKFILE(fp);
    return (ret);
}
Пример #2
0
I getdelim(S *s,size_t*n, I d, FILE *f)//target, current capacity, delimiter, file
{
  unsigned char *q;
  I w=0;

  flockfile(f);
  //ORIENT(f,-1)  //is this dangerous?

  if (!s) {errno = EINVAL; goto error;}

  if (f->_r <= 0 && __srefill(f))
  {
    /* If f is at EOF already, we just need space for the NUL. */
    if (__sferror(f) || expander(s, 1)) goto error;
    funlockfile(f);
    (*s)[0] = '\0';
    R *n=-1;
  }

  while ((q = memchr(f->_p, d, f->_r)) == NULL)
  {
    if (appender(s, &w, (S) f->_p, f->_r)) goto error;
    if (__srefill(f))
    {
      if (__sferror(f)) goto error;
      goto done;  /* hit EOF */
    }
  }
  q++;  /* snarf the delimiter, too */
  if (appender(s, &w, (S) f->_p, q - f->_p)) goto error;
  f->_r -= q - f->_p;
  f->_p = q;

  done:
    /* Invariant: *s has space for at least w+1 bytes. */
    (*s)[w] = '\0';
    funlockfile(f);
    R *n=w;

  error:
    f->_flags |= __SERR;
    funlockfile(f);
    R *n=-1;
}
Пример #3
0
int
ferror (FILE * fp)
{
  int result;
  CHECK_INIT(_REENT, fp);
  _newlib_flockfile_start (fp);
  result = __sferror (fp);
  _newlib_flockfile_end (fp);
  return result;
}
Пример #4
0
int
ferror(FILE *fp)
{
	int r;

	_DIAGASSERT(fp != NULL);

	FLOCKFILE(fp);
	r = __sferror(fp);
	FUNLOCKFILE(fp);
	return r;
}
Пример #5
0
int ferror_unlocked(FILE* fp) {
  return __sferror(fp);
}
Пример #6
0
ANSI C requires <<ferror>>.

<<ferror_unlocked>> is a BSD extension also provided by GNU libc.

No supporting OS subroutines are required.
*/

#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "%W% (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */

#include <_ansi.h>
#include <stdio.h>
#include "local.h"

/* A subroutine version of the macro ferror.  */

#undef ferror

int
_DEFUN(ferror, (fp),
       FILE * fp)
{
  int result;
  CHECK_INIT(_REENT, fp);
  _newlib_flockfile_start (fp);
  result = __sferror (fp);
  _newlib_flockfile_end (fp);
  return result;
}
Пример #7
0
int
ferror(FILE *fp)
{
	return (__sferror(fp));
}
Пример #8
0
int
pd_ferror_unlocked_p(FILEpd *fp)
{

	return (__sferror(fp));
}
Пример #9
0
int ferror(
    FILE *fp
)
{
    return __sferror(fp);
}