blob: a5d651a7d425cbbb178f1bbfb667f7652cc23106 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/***
*clearerr.c - clear error and eof flags
*
* Copyright (c) 1985-1991, Microsoft Corporation. All rights reserved.
*
*Purpose:
* defines clearerr() - clear error and eof flags from a stream
*
*Revision History:
* 11-30-83 RN initial version
* 11-02-87 JCR Multi-thread support
* 12-11-87 JCR Added "_LOAD_DS" to declaration
* 05-31-88 PHG Merged DLL and normal versions
* 06-01-88 JCR Clear lowio flags as well as stdio flags
* 02-15-90 GJF Fixed copyright and indents
* 03-16-90 GJF Replaced _LOAD_DS with _CALLTYPE1 and added #include
* <cruntime.h>.
* 07-23-90 SBM Replaced <assertm.h> by <assert.h>
* 10-02-90 GJF New-style function declarator.
* 01-22-91 GJF ANSI naming.
* 03-27-92 DJM POSIX support
*
*******************************************************************************/
#include <cruntime.h>
#include <stdio.h>
#include <assert.h>
#include <file2.h>
#include <os2dll.h>
#include <internal.h>
#ifndef _POSIX_
#include <msdos.h>
#endif
/***
*void clearerr(stream) - clear error and eof flags on a stream
*
*Purpose:
* Resets the error and eof indicators for a stream to 0
*
*Entry:
* FILE *stream - stream to set indicators on
*
*Exit:
* No return value.
* changes the _flag field of the FILE struct.
*
*Exceptions:
*
*******************************************************************************/
void _CALLTYPE1 clearerr (
FILE *stream
)
{
#ifdef MTHREAD
int index;
#endif
assert(stream != NULL);
#ifdef MTHREAD
index = _iob_index(stream);
#endif
_lock_str(index);
/* Clear stdio level flags */
stream->_flag &= ~(_IOERR|_IOEOF);
/* Clear lowio level flags */
#ifndef _POSIX_
_osfile[_fileno(stream)] &= ~(FEOFLAG);
#endif
_unlock_str(index);
}
|