diff --git a/src/mkdwarfs_main.cpp b/src/mkdwarfs_main.cpp index ab6dc0d2..05cab38a 100644 --- a/src/mkdwarfs_main.cpp +++ b/src/mkdwarfs_main.cpp @@ -39,9 +39,13 @@ #include #include +#ifdef _WIN32 +#include +#else #include #include #include +#endif #include #include @@ -191,10 +195,17 @@ int parse_order_option(std::string const& ordname, std::string const& opt, return 0; } +// TODO: move elsewhere 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; ::ioctl(STDOUT_FILENO, TIOCGWINSZ, &w); return w.ws_col; +#endif } struct level_defaults {