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 14
14
#include < csignal>
15
15
#include < filesystem>
16
16
#include < iostream>
17
+ #include < sys/ioctl.h>
17
18
#include < sys/resource.h>
18
19
#include < sys/signalfd.h>
19
20
#include < sysexits.h>
@@ -200,6 +201,16 @@ int main(int argc, char **argv) {
200
201
// print usage
201
202
if (args.count (" help" )) {
202
203
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
+
203
214
std::cout << options.help () << ' \n ' ;
204
215
std::cout << ' \n ' ;
205
216
std::cout << " The modbus registers are mapped to shared memory objects:" << ' \n ' ;
You can’t perform that action at this time.
0 commit comments