mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-18 00:40:30 -04:00
More Windows tweaks
This commit is contained in:
parent
e2cd0b641f
commit
eec62aa620
@ -39,9 +39,13 @@
|
|||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <folly/portability/Windows.h>
|
||||||
|
#else
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
#include <boost/program_options.hpp>
|
#include <boost/program_options.hpp>
|
||||||
@ -191,10 +195,17 @@ int parse_order_option(std::string const& ordname, std::string const& opt,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: move elsewhere
|
||||||
size_t get_term_width() {
|
size_t get_term_width() {
|
||||||
|
#ifdef _WIN32
|
||||||
|
CONSOLE_SCREEN_BUFFER_INFO csbi;
|
||||||
|
::GetConsoleScreenBufferInfo(::GetStdHandle(STD_OUTPUT_HANDLE), &csbi);
|
||||||
|
return csbi.srWindow.Right - csbi.srWindow.Left + 1;
|
||||||
|
#else
|
||||||
struct ::winsize w;
|
struct ::winsize w;
|
||||||
::ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
|
::ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
|
||||||
return w.ws_col;
|
return w.ws_col;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
struct level_defaults {
|
struct level_defaults {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user