IPV6 update

This commit is contained in:
Joseph Henry
2016-09-28 16:46:30 -07:00
parent 3bd9561246
commit f3570584ce
619 changed files with 7019 additions and 193742 deletions

View File

@@ -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)
{
@@ -274,6 +292,7 @@ unsigned int Utils::snprintf(char *buf,unsigned int len,const char *fmt,...)
if ((n >= (int)len)||(n < 0)) {
if (len)
buf[len - 1] = (char)0;
abort();
throw std::length_error("buf[] overflow in Utils::snprintf");
}