|
|
5903dc |
/*******************************************************************/
|
|
|
5903dc |
/* u16ports: u16 variants of wide character string functions. */
|
|
|
12ee61 |
/* Copyright (C) 2017 SysDeer Technologies, LLC */
|
|
|
5903dc |
/* Released under the Standard MIT License; see COPYING.U16PORTS. */
|
|
|
5903dc |
/*******************************************************************/
|
|
|
5903dc |
|
|
|
5903dc |
#include <stdint.h>
|
|
|
5903dc |
#include <u16ports/u16ports.h>
|
|
|
5903dc |
|
|
|
5903dc |
uint16_t * u16_wcpncpy(uint16_t * dst, const uint16_t * src, size_t len)
|
|
|
5903dc |
{
|
|
|
5903dc |
uint16_t * ret;
|
|
|
5903dc |
uint16_t * cap;
|
|
|
5903dc |
size_t n;
|
|
|
5903dc |
|
|
|
5903dc |
cap = &dst[len];
|
|
|
5903dc |
|
|
|
5903dc |
for (n=len; n && *src; n--)
|
|
|
5903dc |
*dst++ = *src++;
|
|
|
5903dc |
|
|
|
5903dc |
ret = *src ? cap : &dst[len-n];
|
|
|
5903dc |
|
|
|
5903dc |
for (; dst
|
|
|
5903dc |
*dst++ = 0;
|
|
|
5903dc |
|
|
|
5903dc |
return ret;
|
|
|
5903dc |
}
|