From e30f7c80c94160eb4fd62fec2da67acc8c341b54 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 11 Jan 2023 16:21:09 +0100 Subject: [PATCH] added Socket Project --- Socket/CMakeLists.txt | 17 +++++++++++++++++ Socket/lfr_socket.cpp | 18 ++++++++++++++++++ Socket/lfr_socket.h | 3 +++ 3 files changed, 38 insertions(+) create mode 100644 Socket/CMakeLists.txt create mode 100644 Socket/lfr_socket.cpp create mode 100644 Socket/lfr_socket.h diff --git a/Socket/CMakeLists.txt b/Socket/CMakeLists.txt new file mode 100644 index 0000000..ff8b458 --- /dev/null +++ b/Socket/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.1.0) +project(lfr_socket VERSION 0.1.0) + +include(CTest) +enable_testing() + +set(THREADS_PREFER_PTHREAD_FLAG ON) + +find_package(Threads REQUIRED) + +add_executable(lfr_socket lfr_socket.cpp) + +target_link_libraries( lfr_socket Threads::Threads) + +set(CPACK_PROJECT_NAME ${PROJECT_NAME}) +set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) +include(CPack) diff --git a/Socket/lfr_socket.cpp b/Socket/lfr_socket.cpp new file mode 100644 index 0000000..d483d7b --- /dev/null +++ b/Socket/lfr_socket.cpp @@ -0,0 +1,18 @@ +#include "lfr_socket.h" +#include +#include +#include + +int main() +{ + std::string line; + boost::regex pat( "^Subject: (Re: |Aw: )*(.*)" ); + + while (std::cin) + { + std::getline(std::cin, line); + boost::smatch matches; + if (boost::regex_match(line, matches, pat)) + std::cout << matches[2] << std::endl; + } +} \ No newline at end of file diff --git a/Socket/lfr_socket.h b/Socket/lfr_socket.h new file mode 100644 index 0000000..cdf0cec --- /dev/null +++ b/Socket/lfr_socket.h @@ -0,0 +1,3 @@ +#pragma once + +#include \ No newline at end of file