Example #1
0
/*
 * Internal (non-MPSAFE) version of fgetwc().  This version takes an
 * mbstate_t argument specifying the initial conversion state.  For
 * wide streams, this should always be fp->_mbstate.  On return, *nread
 * is set to the number of bytes read.
 */
wint_t 
__fgetwc_mbs(FILE *fp, mbstate_t *mbs, int *nread, locale_t locale)
{
	wchar_t wc;
	size_t nconv;
	struct xlocale_ctype *l = XLOCALE_CTYPE(locale);

	*nread = 0;
	if (fp->_r <= 0 && __srefill(fp))
		return (WEOF);
	do {
		nconv = l->__mbrtowc(&wc, fp->_p, fp->_r, mbs);
		if (nconv == (size_t)-1) {
			fp->_flags |= __SERR;
			return (WEOF);
		} else if (nconv == (size_t)-2)
			continue;
		else if (nconv == 0) {
			fp->_p++;
			fp->_r--;
			(*nread)++;
			return (L'\0');
		} else {
			fp->_p += nconv;
			fp->_r -= nconv;
			*nread += nconv;
			return (wc);
		}
	} while (__srefill(fp) == 0);
	if (__sfeof(fp)) {
		fp->_flags |= __SERR;
		errno = EILSEQ;
	}
	return (WEOF);
}
Example #2
0
int
feof(FILE *fp)
{
    int	ret;

    FLOCKFILE(fp);
    ret = __sfeof(fp);
    FUNLOCKFILE(fp);
    return (ret);
}
Example #3
0
int feof_unlocked(FILE* fp) {
  return __sfeof(fp);
}
Example #4
0
has been reached.

RETURNS
<<feof>> returns <<0>> if the end of file has not yet been reached; if
at end of file, the result is nonzero.

PORTABILITY
<<feof>> is required by ANSI C.

No supporting OS subroutines are required.
*/

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

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

#undef feof

int 
_DEFUN(feof, (fp),
       FILE * fp)
{
  int result;
  CHECK_INIT(_REENT, fp);
  _flockfile (fp);
  result = __sfeof (fp);
  _funlockfile (fp);
  return result;
}
Example #5
0
int
feof(FILE *fp)
{
	return (__sfeof(fp));
}
Example #6
0
int feof(FILE *fp)
{
    return __sfeof(fp);
}
int
pd_feof_unlocked_p(FILEpd *fp)
{

	return (__sfeof(fp));
}
Example #8
0
feof( FILE *stream )
{

	return (__sfeof(stream));
}