From d7fd8ccef64244a9bcc38049a944a818bc296465 Mon Sep 17 00:00:00 2001 From: svenhoefer Date: Mon, 13 Nov 2017 21:17:36 +0100 Subject: [PATCH] - proc_tools: c => cpp; add new helper member to write bool values Signed-off-by: Thilo Graf --- src/system/Makefile.am | 2 +- src/system/{proc_tools.c => proc_tools.cpp} | 5 +++++ src/system/proc_tools.h | 7 +------ 3 files changed, 7 insertions(+), 7 deletions(-) rename src/system/{proc_tools.c => proc_tools.cpp} (92%) diff --git a/src/system/Makefile.am b/src/system/Makefile.am index 4944a7047..9c05d303b 100644 --- a/src/system/Makefile.am +++ b/src/system/Makefile.am @@ -37,7 +37,7 @@ libneutrino_system_a_SOURCES = \ localize.cpp \ helpers.cpp \ ping.cpp \ - proc_tools.c \ + proc_tools.cpp \ settings.cpp \ stacktrace.cpp \ sysload.cpp \ diff --git a/src/system/proc_tools.c b/src/system/proc_tools.cpp similarity index 92% rename from src/system/proc_tools.c rename to src/system/proc_tools.cpp index 0983de937..5d863b80b 100644 --- a/src/system/proc_tools.c +++ b/src/system/proc_tools.cpp @@ -28,6 +28,11 @@ int proc_put(const char *path, const char *value, const int len) return ret; } +int proc_put(const char *path, bool state) +{ + return proc_put(path, state ? "1" : "0", 1); +} + int proc_get(const char *path, char *value, const int len) { int ret, ret2; diff --git a/src/system/proc_tools.h b/src/system/proc_tools.h index 2a3a8cd5e..720fe1790 100644 --- a/src/system/proc_tools.h +++ b/src/system/proc_tools.h @@ -8,13 +8,8 @@ */ #ifndef __PROC_TOOLS_H__ #define __PROC_TOOLS_H__ -#ifdef __cplusplus -extern "C" { -#endif int proc_put(const char *path, const char *value, const int len); +int proc_put(const char *path, bool state); int proc_get(const char *path, char *value, const int len); unsigned int proc_get_hex(const char *path); -#ifdef __cplusplus -} -#endif #endif