clrerr.c revision 178721
1186545Srwatson/*-
2191273Srwatson * Copyright (c) 1990, 1993
3186545Srwatson *	The Regents of the University of California.  All rights reserved.
4186545Srwatson *
5186545Srwatson * This code is derived from software contributed to Berkeley by
6186545Srwatson * Chris Torek.
7186545Srwatson *
8186545Srwatson * Redistribution and use in source and binary forms, with or without
9186545Srwatson * modification, are permitted provided that the following conditions
10186545Srwatson * are met:
11186545Srwatson * 1. Redistributions of source code must retain the above copyright
12186545Srwatson *    notice, this list of conditions and the following disclaimer.
13186545Srwatson * 2. Redistributions in binary form must reproduce the above copyright
14186545Srwatson *    notice, this list of conditions and the following disclaimer in the
15186545Srwatson *    documentation and/or other materials provided with the distribution.
16186545Srwatson * 4. Neither the name of the University nor the names of its contributors
17186545Srwatson *    may be used to endorse or promote products derived from this software
18186545Srwatson *    without specific prior written permission.
19186545Srwatson *
20186545Srwatson * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21186545Srwatson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22186545Srwatson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23186545Srwatson * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24186545Srwatson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25186545Srwatson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26186545Srwatson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27186545Srwatson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28186545Srwatson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29191273Srwatson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30186545Srwatson * SUCH DAMAGE.
31186545Srwatson */
32186545Srwatson
33186545Srwatson#if defined(LIBC_SCCS) && !defined(lint)
34186545Srwatsonstatic char sccsid[] = "@(#)clrerr.c	8.1 (Berkeley) 6/4/93";
35186545Srwatson#endif /* LIBC_SCCS and not lint */
36186545Srwatson#include <sys/cdefs.h>
37186545Srwatson__FBSDID("$FreeBSD: head/lib/libc/stdio/clrerr.c 178721 2008-05-02 15:25:07Z jhb $");
38186545Srwatson
39186545Srwatson#include "namespace.h"
40186545Srwatson#include <stdio.h>
41186545Srwatson#include "un-namespace.h"
42186545Srwatson#include "local.h"
43186545Srwatson#include "libc_private.h"
44186545Srwatson
45186545Srwatson#define	__sclearerr(p)	((void)((p)->_flags &= ~(__SERR|__SEOF)))
46186545Srwatson
47186545Srwatsonvoid
48186545Srwatsonclearerr(fp)
49186545Srwatson	FILE *fp;
50186545Srwatson{
51186545Srwatson	FLOCKFILE(fp);
52186545Srwatson	__sclearerr(fp);
53186545Srwatson	FUNLOCKFILE(fp);
54186545Srwatson}
55186545Srwatson
56186545Srwatsonvoid
57186545Srwatsonclearerr_unlocked(FILE *fp)
58186545Srwatson{
59186545Srwatson
60186545Srwatson	__sclearerr(fp);
61186545Srwatson}
62186545Srwatson