Skip to content

Commit 703c628

Browse files
add licenses
1 parent 947a0e2 commit 703c628

File tree

8 files changed

+580
-29
lines changed

8 files changed

+580
-29
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.13.4 FATAL_ERROR)
44
# ======================================================================================================================
55

66
# project
7-
project(Modbus_TCP_client_shm LANGUAGES CXX VERSION 1.0.2)
7+
project(Modbus_TCP_client_shm LANGUAGES CXX VERSION 1.0.3)
88

99
# settings
1010
set(Target "Modbus_TCP_client_shm") # Executable name (without file extension!)

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2021 Nikolas Koesling
3+
Copyright (c) 2021-2022 Nikolas Koesling
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

src/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
target_sources(${Target} PRIVATE main.cpp)
55
target_sources(${Target} PRIVATE modbus_shm.cpp)
66
target_sources(${Target} PRIVATE Modbus_TCP_Slave.cpp)
7+
target_sources(${Target} PRIVATE license.cpp)
78

89

910
# ---------------------------------------- header files (*.jpp, *.h, ...) ----------------------------------------------
1011
# ======================================================================================================================
1112
target_sources(${Target} PRIVATE modbus_shm.hpp)
1213
target_sources(${Target} PRIVATE Modbus_TCP_Slave.hpp)
14+
target_sources(${Target} PRIVATE license.hpp)
1315

1416

1517

src/Modbus_TCP_Slave.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace TCP {
99
//! Modbus TCP slave
1010
class Slave {
1111
private:
12-
modbus_t * modbus; //!< modbus object (see libmodbus library)
12+
modbus_t *modbus; //!< modbus object (see libmodbus library)
1313
modbus_mapping_t *mapping; //!< modbus data object (see libmodbus library)
1414
bool delete_mapping; //!< indicates whether the mapping object was created by this instance
1515
int socket = -1; //!< socket of the modbus connection
@@ -23,7 +23,7 @@ class Slave {
2323
*/
2424
explicit Slave(const std::string &ip = "0.0.0.0",
2525
short unsigned int port = 502,
26-
modbus_mapping_t * mapping = nullptr);
26+
modbus_mapping_t *mapping = nullptr);
2727

2828
/*! \brief destroy the modbus slave
2929
*

src/license.cpp

Lines changed: 558 additions & 0 deletions
Large diffs are not rendered by default.

src/license.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#pragma once
2+
3+
#include <ostream>
4+
5+
void print_licenses(std::ostream &o);

src/main.cpp

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <unistd.h>
88

99
#include "Modbus_TCP_Slave.hpp"
10+
#include "license.hpp"
1011
#include "modbus_shm.hpp"
1112

1213
//! terminate flag
@@ -83,7 +84,9 @@ int main(int argc, char **argv) {
8384
("h,help",
8485
"print usage")
8586
("version",
86-
"print version information");
87+
"print version information")
88+
("license",
89+
"show licences");
8790
// clang-format on
8891

8992
// parse arguments
@@ -111,29 +114,6 @@ int main(int argc, char **argv) {
111114
std::cout << "This application uses the following libraries:" << std::endl;
112115
std::cout << " - cxxopts by jarro2783 (https://github.com/jarro2783/cxxopts)" << std::endl;
113116
std::cout << " - libmodbus by Stéphane Raimbault (https://github.com/stephane/libmodbus)" << std::endl;
114-
std::cout << std::endl;
115-
std::cout << std::endl;
116-
std::cout << "MIT License:" << std::endl;
117-
std::cout << std::endl;
118-
std::cout << "Copyright (c) 2021 Nikolas Koesling" << std::endl;
119-
std::cout << std::endl;
120-
std::cout << "Permission is hereby granted, free of charge, to any person obtaining a copy" << std::endl;
121-
std::cout << "of this software and associated documentation files (the \"Software\"), to deal" << std::endl;
122-
std::cout << "in the Software without restriction, including without limitation the rights" << std::endl;
123-
std::cout << "to use, copy, modify, merge, publish, distribute, sublicense, and/or sell" << std::endl;
124-
std::cout << "copies of the Software, and to permit persons to whom the Software is" << std::endl;
125-
std::cout << "furnished to do so, subject to the following conditions:" << std::endl;
126-
std::cout << std::endl;
127-
std::cout << "The above copyright notice and this permission notice shall be included in all" << std::endl;
128-
std::cout << "copies or substantial portions of the Software." << std::endl;
129-
std::cout << std::endl;
130-
std::cout << "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR" << std::endl;
131-
std::cout << "IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY," << std::endl;
132-
std::cout << "FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE" << std::endl;
133-
std::cout << "AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER" << std::endl;
134-
std::cout << "LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM," << std::endl;
135-
std::cout << "OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE" << std::endl;
136-
std::cout << "SOFTWARE." << std::endl;
137117
exit(EX_OK);
138118
}
139119

@@ -143,6 +123,12 @@ int main(int argc, char **argv) {
143123
exit(EX_OK);
144124
}
145125

126+
// print licenses
127+
if (args.count("license")) {
128+
print_licenses(std::cout);
129+
exit(EX_OK);
130+
}
131+
146132
// check arguments
147133
if (args["do-registers"].as<std::size_t>() > 0x10000) {
148134
std::cerr << "to many do_registers (maximum: 65536)." << std::endl;

src/modbus_shm.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Shm_Mapping {
2121
std::string name = std::string(); //!< name of the object
2222
int fd = -1; //!< file descriptor
2323
std::size_t size; //!< size in bytes
24-
void * addr = nullptr; //!< mapped address
24+
void *addr = nullptr; //!< mapped address
2525
};
2626

2727
//! modbus lib storage object

0 commit comments

Comments
 (0)