Skip to content

Commit 9f9f0c9

Browse files
Merge pull request #39 from NikolasK-source/main
update to 1.6.2
2 parents e2f289a + 4bc49c8 commit 9f9f0c9

File tree

7 files changed

+10
-291
lines changed

7 files changed

+10
-291
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cmake_minimum_required(VERSION 3.22.1 FATAL_ERROR)
99
# ======================================================================================================================
1010

1111
# project
12-
project(Modbus_TCP_client_shm LANGUAGES CXX VERSION 1.6.1)
12+
project(Modbus_TCP_client_shm LANGUAGES CXX VERSION 1.6.2)
1313

1414
# settings
1515
set(Target "modbus-tcp-client-shm") # Executable name (without file extension!)

ClangFormat.cmake

Lines changed: 0 additions & 52 deletions
This file was deleted.

compileropts.cmake

Lines changed: 0 additions & 59 deletions
This file was deleted.

define.cmake

Lines changed: 0 additions & 52 deletions
This file was deleted.

modbus.cmake

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/main.cpp

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@
4343
//! Maximum number of registers per type
4444
static constexpr size_t MODBUS_MAX_REGS = 0x10000;
4545

46-
//! Help output line width
47-
static constexpr std::size_t HELP_WIDTH = 120;
48-
4946
//! Default permissions for the created shared memory
5047
static constexpr mode_t DEFAULT_SHM_PERMISSIONS = 0660;
5148

@@ -200,7 +197,15 @@ int main(int argc, char **argv) {
200197

201198
// print usage
202199
if (args.count("help")) {
203-
options.set_width(HELP_WIDTH);
200+
static constexpr std::size_t MIN_HELP_SIZE = 80;
201+
if (isatty(STDIN_FILENO)) {
202+
struct winsize w {};
203+
if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1) { // NOLINT
204+
options.set_width(std::max(static_cast<decltype(w.ws_col)>(MIN_HELP_SIZE), w.ws_col));
205+
}
206+
} else {
207+
options.set_width(MIN_HELP_SIZE);
208+
}
204209
#ifdef OS_LINUX
205210
if (isatty(STDIN_FILENO)) {
206211
struct winsize w {};
@@ -230,16 +235,6 @@ int main(int argc, char **argv) {
230235
}
231236

232237
// print version
233-
if (args.count("longversion")) {
234-
std::cout << PROJECT_NAME << ' ' << PROJECT_VERSION << " (compiled with " << COMPILER_INFO << " on "
235-
<< SYSTEM_INFO << ')'
236-
#ifndef OS_LINUX
237-
<< "-nonlinux"
238-
#endif
239-
<< '\n';
240-
return EX_OK;
241-
}
242-
243238
if (args.count("shortversion")) {
244239
std::cout << PROJECT_VERSION << '\n';
245240
return EX_OK;

warnings.cmake

Lines changed: 0 additions & 82 deletions
This file was deleted.

0 commit comments

Comments
 (0)