Loading...
Searching...
No Matches
terminal.hpp
Go to the documentation of this file.
// SPDX-FileCopyrightText: 2006-2025 Knut Reinert & Freie Universität Berlin
// SPDX-FileCopyrightText: 2016-2025 Knut Reinert & MPI für molekulare Genetik
// SPDX-License-Identifier: BSD-3-Clause
#pragma once
#ifndef _WIN32
# include <sys/ioctl.h>
#else
# include <windows.h>
#endif
#include <cstdio>
#include <unistd.h>
#include <seqan3/core/platform.hpp>
namespace seqan3::detail
{
// ----------------------------------------------------------------------------
// Function is_terminal()
// ----------------------------------------------------------------------------
inline bool is_terminal()
{
#ifndef _WIN32
return isatty(STDOUT_FILENO);
#else
return false;
#endif
}
// ----------------------------------------------------------------------------
// Function get_terminal_size()
// ----------------------------------------------------------------------------
inline unsigned get_terminal_width()
{
#ifndef _WIN32
struct winsize w;
w.ws_row = 0;
w.ws_col = 0;
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
return w.ws_col;
#else
return 80; // not implemented in windows
#endif
}
} // namespace seqan3::detail
cstdio
platform.hpp
Provides platform and dependency checks.
Hide me