gint/src/std/string.c
lephe 2d7a6f154e libc: implement a compliant formatted printer
This is based on a port of kprint, which supports standard formats and
options, except for:

* Large parameters (ll)
* Floating-point types (%e, %E, %f, %F, %g, %G, %a, %A)
2019-07-16 16:14:13 -04:00

22 lines
377 B
C

//---
// 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;
}
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;
}