mirror of
https://github.com/fpagliughi/sockpp.git
synced 2026-01-12 00:04:45 +08:00
Minor cleanup
This commit is contained in:
@@ -45,10 +45,8 @@ set(EXECUTABLES
|
||||
)
|
||||
|
||||
foreach(EXECUTABLE ${EXECUTABLES})
|
||||
# --- Executables ---
|
||||
add_executable(${EXECUTABLE} ${EXECUTABLE}.cpp)
|
||||
|
||||
# --- Includes ---
|
||||
target_include_directories(${EXECUTABLE}
|
||||
PUBLIC
|
||||
${SOCKPP_INCLUDE_DIR}
|
||||
@@ -56,8 +54,7 @@ foreach(EXECUTABLE ${EXECUTABLES})
|
||||
${SOCKPP_GENERATED_DIR}/include
|
||||
)
|
||||
|
||||
# --- Link for executables ---
|
||||
target_link_libraries(${EXECUTABLE} ${SOCKPP_LIB})
|
||||
target_link_libraries(${EXECUTABLE} ${SOCKPP_LIB})
|
||||
endforeach()
|
||||
|
||||
# --- Install examples ---
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
// --------------------------------------------------------------------------
|
||||
// This file is part of the "sockpp" C++ socket library.
|
||||
//
|
||||
// Copyright (c) 2021 Frank Pagliughi
|
||||
// Copyright (c) 2021-2023 Frank Pagliughi
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
@@ -58,7 +58,7 @@ using sysclock = chrono::system_clock;
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
cout << "Sample SocketCAN writer for 'sockpp' "
|
||||
cout << "Sample SocketCAN reader for 'sockpp' "
|
||||
<< sockpp::SOCKPP_VERSION << endl;
|
||||
|
||||
string canIface = (argc > 1) ? argv[1] : "can0";
|
||||
@@ -70,14 +70,12 @@ int main(int argc, char* argv[])
|
||||
sockpp::can_socket sock(addr);
|
||||
|
||||
if (!sock) {
|
||||
cerr << "Error binding to the CAN interface " << canIface << "\n\t"
|
||||
cerr << "Error binding to the CAN interface '" << canIface << "'\n\t"
|
||||
<< sock.last_error_str() << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
cout << "Created CAN socket on " << sock.address() << endl;
|
||||
time_t t = sysclock::to_time_t(sysclock::now());
|
||||
|
||||
cout.setf(ios::fixed, ios::floatfield);
|
||||
cout << setfill('0');
|
||||
|
||||
|
||||
@@ -53,7 +53,6 @@
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
#include <sys/un.h>
|
||||
|
||||
#include <linux/can.h>
|
||||
|
||||
namespace sockpp {
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
#include "sockpp/can_socket.h"
|
||||
#include "sockpp/socket.h"
|
||||
#include <sys/ioctl.h>
|
||||
#include <linux/sockios.h>
|
||||
|
||||
using namespace std;
|
||||
using namespace std::chrono;
|
||||
|
||||
@@ -65,7 +65,7 @@ timeval to_timeval(const microseconds& dur)
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// socket
|
||||
// socket
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
int socket::get_last_error()
|
||||
|
||||
Reference in New Issue
Block a user