summaryrefslogtreecommitdiffstats
path: root/src/xz/util.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-15 09:41:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-15 09:41:35 +0000
commit2ed1dcfa30b3967f7d6df74fba78ce23ed065497 (patch)
tree8ff5a74b07bf976cd88df2460e1c9cafb27f050a /src/xz/util.h
parentReleasing progress-linux version 5.6.1+really5.4.5-1~progress7.99u1. (diff)
downloadxz-utils-2ed1dcfa30b3967f7d6df74fba78ce23ed065497.tar.xz
xz-utils-2ed1dcfa30b3967f7d6df74fba78ce23ed065497.zip
Merging upstream version 5.6.2.
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