summaryrefslogtreecommitdiff
path: root/node/Utils.cpp
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2016-06-16 12:28:43 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2016-06-16 12:28:43 -0700
commite09c1a1c11522c11c6ea81dcb1c52a4e8a2f5c6c (patch)
treeba6d0381aa472ec1811bd9f16627e10f48f2d203 /node/Utils.cpp
parentb104bb4762a07dcb0a950b33c7419b298c2b6267 (diff)
downloadinfinitytier-e09c1a1c11522c11c6ea81dcb1c52a4e8a2f5c6c.tar.gz
infinitytier-e09c1a1c11522c11c6ea81dcb1c52a4e8a2f5c6c.zip
Big refactor mostly builds. We now have a uniform backward compatible netconf.
Diffstat (limited to 'node/Utils.cpp')
-rw-r--r--node/Utils.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/node/Utils.cpp b/node/Utils.cpp
index 00aeea33..2d9515ee 100644
--- a/node/Utils.cpp
+++ b/node/Utils.cpp
@@ -262,6 +262,24 @@ std::vector<std::string> Utils::split(const char *s,const char *const sep,const
return fields;
}
+bool Utils::scopy(char *dest,unsigned int len,const char *src)
+{
+ if (!len)
+ return false; // sanity check
+ if (!src) {
+ *dest = (char)0;
+ return true;
+ }
+ char *end = dest + len;
+ while ((*dest++ = *src++)) {
+ if (dest == end) {
+ *(--dest) = (char)0;
+ return false;
+ }
+ }
+ return true;
+}
+
unsigned int Utils::snprintf(char *buf,unsigned int len,const char *fmt,...)
throw(std::length_error)
{