2016-11-10 19:19:21 -05:00
|
|
|
#ifndef ISATTY_HPP
|
|
|
|
#define ISATTY_HPP
|
|
|
|
|
|
|
|
// For isatty()
|
|
|
|
#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
|
|
|
|
#include <unistd.h>
|
|
|
|
#else
|
|
|
|
#ifdef WIN32
|
|
|
|
#include <io.h>
|
|
|
|
#define isatty _isatty
|
|
|
|
#define fileno _fileno
|
|
|
|
#else
|
2016-11-16 15:07:45 -05:00
|
|
|
#error Unknown platform - isatty implementation required
|
2016-11-10 19:19:21 -05:00
|
|
|
#endif // win32
|
|
|
|
#endif // unix
|
|
|
|
|
|
|
|
#include <cstdio>
|
|
|
|
|
2022-12-11 04:10:26 -05:00
|
|
|
namespace osrm::util
|
2016-11-10 19:19:21 -05:00
|
|
|
{
|
|
|
|
|
|
|
|
// Returns true if stdout is a tty, false otherwise
|
|
|
|
// Useful for when you want to do something different when
|
|
|
|
// output is redirected to a logfile
|
|
|
|
inline bool IsStdoutATTY() { return isatty(fileno(stdout)); }
|
|
|
|
|
|
|
|
} // namespace osrm
|
|
|
|
|
2016-11-16 15:07:45 -05:00
|
|
|
#endif
|