Skip to content

Commit 08ffa91

Browse files
Merge pull request #1 from NikolasK-source/development
add copyright file header and licenses
2 parents 57c8d24 + ab0bb69 commit 08ffa91

9 files changed

+613
-27
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_RTU_client_shm LANGUAGES CXX VERSION 0.1.2)
7+
project(Modbus_RTU_client_shm LANGUAGES CXX VERSION 0.1.3)
88

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

src/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44
target_sources(${Target} PRIVATE main.cpp)
55
target_sources(${Target} PRIVATE modbus_shm.cpp)
66
target_sources(${Target} PRIVATE Modbus_RTU_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_RTU_Slave.hpp)
13-
14+
target_sources(${Target} PRIVATE license.hpp)
1415

1516

1617
# ---------------------------------------- subdirectories --------------------------------------------------------------

src/Modbus_RTU_Slave.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
/*
2+
* Copyright (C) 2021-2022 Nikolas Koesling <nikolas@koesling.info>.
3+
* This program is free software. You can redistribute it and/or modify it under the terms of the MIT License.
4+
*/
5+
16
#include "Modbus_RTU_Slave.hpp"
27

38
#include <stdexcept>
4-
#include <unistd.h>
59

610
namespace Modbus {
711
namespace RTU {

src/Modbus_RTU_Slave.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright (C) 2021-2022 Nikolas Koesling <nikolas@koesling.info>.
3+
* This program is free software. You can redistribute it and/or modify it under the terms of the MIT License.
4+
*/
5+
16
#pragma once
27

38
#include <modbus/modbus.h>

src/license.cpp

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

src/license.hpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright (C) 2022 Nikolas Koesling <nikolas@koesling.info>.
3+
* This program is free software. You can redistribute it and/or modify it under the terms of the MIT License.
4+
*/
5+
6+
#pragma once
7+
8+
#include <ostream>
9+
10+
/**
11+
* \brief print licences
12+
* @param o output stream used to print licenses
13+
*/
14+
void print_licenses(std::ostream &o);

src/main.cpp

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright (C) 2021-2022 Nikolas Koesling <nikolas@koesling.info>.
3+
* This program is free software. You can redistribute it and/or modify it under the terms of the MIT License.
4+
*/
5+
16
#include <csignal>
27
#include <cxxopts.hpp>
38
#include <filesystem>
@@ -7,6 +12,7 @@
712
#include <unistd.h>
813

914
#include "Modbus_RTU_Slave.hpp"
15+
#include "license.hpp"
1016
#include "modbus_shm.hpp"
1117

1218
//! terminate flag
@@ -73,6 +79,7 @@ int main(int argc, char **argv) {
7379
options.add_options()("m,monitor", "output all incoming and outgoing packets to stdout");
7480
options.add_options()("h,help", "print usage");
7581
options.add_options()("version", "print version information");
82+
options.add_options()("license", "show licences");
7683
// clang-format on
7784

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

@@ -132,6 +116,12 @@ int main(int argc, char **argv) {
132116
exit(EX_OK);
133117
}
134118

119+
// print licenses
120+
if (args.count("license")) {
121+
print_licenses(std::cout);
122+
exit(EX_OK);
123+
}
124+
135125
// check arguments
136126
if (args["do-registers"].as<std::size_t>() > 0x10000) {
137127
std::cerr << "to many do_registers (maximum: 65536)." << std::endl;

src/modbus_shm.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
/*
2+
* Copyright (C) 2021-2022 Nikolas Koesling <nikolas@koesling.info>.
3+
* This program is free software. You can redistribute it and/or modify it under the terms of the MIT License.
4+
*/
5+
16
#include "modbus_shm.hpp"
27

38
#include <fcntl.h>
4-
#include <iostream>
59
#include <stdexcept>
610
#include <sys/mman.h>
711
#include <system_error>

src/modbus_shm.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright (C) 2021-2022 Nikolas Koesling <nikolas@koesling.info>.
3+
* This program is free software. You can redistribute it and/or modify it under the terms of the MIT License.
4+
*/
5+
16
#pragma once
27

38
#include "modbus/modbus.h"

0 commit comments

Comments
 (0)