diff options
author | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
---|---|---|
committer | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
commit | e611b132f9b8abe35b362e5870b74bce94a1e58e (patch) | |
tree | a5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/crt32/stdio/clearerr.c | |
download | NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2 NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip |
Diffstat (limited to 'private/crt32/stdio/clearerr.c')
-rw-r--r-- | private/crt32/stdio/clearerr.c | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/private/crt32/stdio/clearerr.c b/private/crt32/stdio/clearerr.c new file mode 100644 index 000000000..a5d651a7d --- /dev/null +++ b/private/crt32/stdio/clearerr.c @@ -0,0 +1,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); +} |