aboutsummaryrefslogtreecommitdiff
path: root/src/xz/util.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/xz/util.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/xz/util.h b/src/xz/util.h
index 6d7e1481..1da40371 100644
--- a/src/xz/util.h
+++ b/src/xz/util.h
@@ -105,6 +105,20 @@ lzma_attribute((__format__(__printf__, 3, 4)))
extern void my_snprintf(char **pos, size_t *left, const char *fmt, ...);
+/// \brief Test if file descriptor is a terminal
+///
+/// For POSIX systems, this is a simple wrapper around isatty(). However on
+/// Windows, isatty() returns true for all character devices, not just
+/// terminals.
+///
+/// \param fd File descriptor to test
+///
+/// \return bool:
+/// - true if file descriptor is a terminal
+/// - false otherwise
+extern bool is_tty(int fd);
+
+
/// \brief Test if stdin is a terminal
///
/// If stdin is a terminal, an error message is printed and exit status set