Added a strlcpy() call for usage in BeOS (OpenBeOS has it built-in already).

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2081 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2002-11-25 17:35:21 +00:00
parent d369893781
commit 0f374ebc88
2 changed files with 23 additions and 0 deletions

View File

@ -136,3 +136,22 @@ BlockArray::MakeEmpty()
fArray->count = 0;
}
// #pragma mark -
extern "C" size_t
strlcpy(char *dest, char const *source, size_t length)
{
if (length == 0)
return strlen(source);
size_t i = 0;
for (; i < length - 1 && source[i]; i++)
dest[i] = source[i];
dest[i] = '\0';
return i + strlen(source + i);
}

View File

@ -153,4 +153,8 @@ template<class Node> struct list {
# error The macros atomic_set(), and atomic_test_and_set() are not defined for the target processor
#endif
extern "C" size_t strlcpy(char *dest, char const *source, size_t length);
#endif /* UTILITY_H */