mirror of
https://github.com/Sude-/lgogdownloader.git
synced 2025-02-08 16:33:22 +01:00
Merge branch 'detectTerminal' of https://github.com/chanceVermilion/lgogdownloader
This commit is contained in:
commit
f93c8ee753
@ -378,10 +378,17 @@ void Util::setFilePermissions(const boost::filesystem::path& path, const boost::
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Util::getTerminalWidth()
|
int Util::getTerminalWidth()
|
||||||
|
{
|
||||||
|
int width;
|
||||||
|
if(isatty(STDOUT_FILENO))
|
||||||
{
|
{
|
||||||
struct winsize w;
|
struct winsize w;
|
||||||
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
|
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
|
||||||
return static_cast<int>(w.ws_col);
|
width = static_cast<int>(w.ws_col);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
width = 10000;//Something sufficiently big
|
||||||
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user