summaryrefslogtreecommitdiffstats
path: root/src/xz/util.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-15 09:41:34 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-15 09:41:34 +0000
commitcf178685aca107aa37c748de11da01562e78c46c (patch)
tree84d60b39c1744edcbdd4dbfc5026583914432dba /src/xz/util.h
parentAdding upstream version 5.6.1+really5.4.5. (diff)
downloadxz-utils-cf178685aca107aa37c748de11da01562e78c46c.tar.xz
xz-utils-cf178685aca107aa37c748de11da01562e78c46c.zip
Adding upstream version 5.6.2.upstream/5.6.2upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--src/xz/util.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/xz/util.h b/src/xz/util.h
index 6d7e148..a2fdd05 100644
--- a/src/xz/util.h
+++ b/src/xz/util.h
@@ -1,3 +1,5 @@
+// SPDX-License-Identifier: 0BSD
+
///////////////////////////////////////////////////////////////////////////////
//
/// \file util.h
@@ -5,9 +7,6 @@
//
// Author: Lasse Collin
//
-// This file has been put into the public domain.
-// You can do whatever you want with this file.
-//
///////////////////////////////////////////////////////////////////////////////
/// \brief Safe malloc() that never returns NULL
@@ -105,6 +104,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