2019-03-06 14:32:51 +01:00
|
|
|
//---
|
|
|
|
// gint:core:string - replicas of a few string functions
|
|
|
|
//---
|
|
|
|
|
|
|
|
#include <gint/defs/types.h>
|
|
|
|
#include <gint/defs/attributes.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
|
|
|
GWEAK size_t strlen(const char *str)
|
|
|
|
{
|
|
|
|
int len = 0;
|
|
|
|
while(str[len]) len++;
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
2019-05-04 12:07:14 +02:00
|
|
|
GWEAK char *strncpy(char *dst, const char *src, size_t n)
|
|
|
|
{
|
|
|
|
size_t i = 0;
|
|
|
|
while(i < n && (dst[i] = src[i])) i++;
|
|
|
|
return dst;
|
|
|
|
}
|