stdio.c revision b9e0ed731aea37f0d19af2ca032cbb37c264a9a5
/*
* Copyright (C) 2000, 2001, 2004, 2007, 2011-2014, 2016 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id$ */
#include <config.h>
#include <errno.h>
#include <unistd.h>
#include "errno2result.h"
FILE *f;
if (f == NULL)
return (isc__errno2result(errno));
*fp = f;
return (ISC_R_SUCCESS);
}
isc_stdio_close(FILE *f) {
int r;
r = fclose(f);
if (r == 0)
return (ISC_R_SUCCESS);
else
return (isc__errno2result(errno));
}
int r;
#ifdef HAVE_FSEEKO
#else
#endif
if (r == 0)
return (ISC_R_SUCCESS);
else
return (isc__errno2result(errno));
}
off_t r;
#ifdef HAVE_FTELLO
r = ftello(f);
#else
r = ftell(f);
#endif
if (r >= 0) {
*offsetp = r;
return (ISC_R_SUCCESS);
} else
return (isc__errno2result(errno));
}
size_t r;
clearerr(f);
if (r != nmemb) {
if (feof(f))
else
}
*nret = r;
return (result);
}
{
size_t r;
clearerr(f);
if (r != nmemb)
*nret = r;
return (result);
}
isc_stdio_flush(FILE *f) {
int r;
r = fflush(f);
if (r == 0)
return (ISC_R_SUCCESS);
else
return (isc__errno2result(errno));
}
/*
* OpenBSD has deprecated ENOTSUP in favor of EOPNOTSUPP.
*/
#if defined(EOPNOTSUPP) && !defined(ENOTSUP)
#define ENOTSUP EOPNOTSUPP
#endif
isc_stdio_sync(FILE *f) {
int r;
return (isc__errno2result(errno));
/*
* Only call fsync() on regular files.
*/
return (ISC_R_SUCCESS);
if (r == 0)
return (ISC_R_SUCCESS);
else
return (isc__errno2result(errno));
}