ReactOS 0.4.16-dev-1093-g93e9710
isatty.cpp
Go to the documentation of this file.
1//
2// isatty.cpp
3//
4// Copyright (c) Microsoft Corporation. All rights reserved.
5//
6// Defines _isatty(), which tests whether a file refers to a character device.
7//
9
10
11
12// Tests if the given file refers to a character device (e.g. terminal, console,
13// printer, serial port, etc.). Returns nonzero if so; zero if not.
14extern "C" int __cdecl _isatty(int const fh)
15{
16 _CHECK_FH_RETURN(fh, EBADF, 0);
17 _VALIDATE_RETURN((fh >= 0 && (unsigned)fh < (unsigned)_nhandle), EBADF, 0);
18
19 return static_cast<int>(_osfile(fh) & FDEV);
20}
#define EBADF
Definition: acclib.h:82
#define __cdecl
Definition: accygwin.h:79
#define _CHECK_FH_RETURN(handle, errorcode, retexpr)
int _nhandle
Definition: ioinit.cpp:34
#define _VALIDATE_RETURN(expr, errorcode, retexpr)
int __cdecl _isatty(int const fh)
Definition: isatty.cpp:14
#define _osfile(i)
Definition: internal.h:72