summaryrefslogtreecommitdiffstats
path: root/Source/cm_fileno.cxx
diff options
context:
space:
mode:
authorKyle Edwards <kyle.edwards@kitware.com>2023-08-04 18:08:17 (GMT)
committerKyle Edwards <kyle.edwards@kitware.com>2023-08-07 15:26:05 (GMT)
commitfbdb1fd84347f4dcb65a50b888e13ece07a367d7 (patch)
tree009cdfbd3543a7974dc25fee179d24f22a9cf296 /Source/cm_fileno.cxx
parent21edd5af1f24d12612e3f6052b9497b848566855 (diff)
downloadCMake-fbdb1fd84347f4dcb65a50b888e13ece07a367d7.zip
CMake-fbdb1fd84347f4dcb65a50b888e13ece07a367d7.tar.gz
CMake-fbdb1fd84347f4dcb65a50b888e13ece07a367d7.tar.bz2
Source: Add cm_fileno wrapper
And use it where appropriate.
Diffstat (limited to 'Source/cm_fileno.cxx')
-rw-r--r--Source/cm_fileno.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/cm_fileno.cxx b/Source/cm_fileno.cxx
new file mode 100644
index 0000000..a40c5ca
--- /dev/null
+++ b/Source/cm_fileno.cxx
@@ -0,0 +1,15 @@
+/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+ file Copyright.txt or https://cmake.org/licensing for details. */
+#if !defined(_POSIX_C_SOURCE) && !defined(_WIN32) && !defined(__sun) && \
+ !defined(__OpenBSD__)
+/* POSIX APIs are needed */
+// NOLINTNEXTLINE(bugprone-reserved-identifier)
+# define _POSIX_C_SOURCE 200809L
+#endif
+
+#include "cm_fileno.hxx"
+
+int cm_fileno(FILE* f)
+{
+ return fileno(f);
+}