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:
@@ -136,3 +136,22 @@ BlockArray::MakeEmpty()
|
|||||||
fArray->count = 0;
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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
|
# error The macros atomic_set(), and atomic_test_and_set() are not defined for the target processor
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
extern "C" size_t strlcpy(char *dest, char const *source, size_t length);
|
||||||
|
|
||||||
|
|
||||||
#endif /* UTILITY_H */
|
#endif /* UTILITY_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user