mirror of
https://github.com/eosswedenorg/antelope-keygen
synced 2026-06-18 04:00:03 +02:00
adding core/isatty
This commit is contained in:
parent
bde7afbc4e
commit
f7858cb5bd
3 changed files with 59 additions and 0 deletions
21
src/core/isatty.cpp
Normal file
21
src/core/isatty.cpp
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#if _WIN32
|
||||
#include <io.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#define _isatty isatty
|
||||
#define _fileno fileno
|
||||
#endif
|
||||
#include "isatty.h"
|
||||
|
||||
namespace eoskeygen {
|
||||
|
||||
bool isatty(int fd) {
|
||||
return ::_isatty(fd);
|
||||
}
|
||||
|
||||
bool isatty(FILE* fd) {
|
||||
// fileno() segfaults if fd is null.
|
||||
return fd ? isatty(_fileno(fd)) : false;
|
||||
}
|
||||
|
||||
} // namespace eoskeygen
|
||||
Loading…
Add table
Add a link
Reference in a new issue