File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 1414#include < csignal>
1515#include < filesystem>
1616#include < iostream>
17+ #include < sys/ioctl.h>
1718#include < sys/resource.h>
1819#include < sys/signalfd.h>
1920#include < sysexits.h>
@@ -200,6 +201,16 @@ int main(int argc, char **argv) {
200201 // print usage
201202 if (args.count (" help" )) {
202203 options.set_width (HELP_WIDTH);
204+ #ifdef OS_LINUX
205+ if (isatty (STDIN_FILENO)) {
206+ struct winsize w {};
207+ if (ioctl (STDOUT_FILENO, TIOCGWINSZ, &w) != -1 ) { // NOLINT
208+ static constexpr auto MIN_TTY_SIZE = static_cast <decltype (w.ws_col )>(80 );
209+ options.set_width (std::max (MIN_TTY_SIZE, w.ws_col ));
210+ }
211+ }
212+ #endif
213+
203214 std::cout << options.help () << ' \n ' ;
204215 std::cout << ' \n ' ;
205216 std::cout << " The modbus registers are mapped to shared memory objects:" << ' \n ' ;
You can’t perform that action at this time.
0 commit comments