From 04b6fcdf1b535451939cba300ccf536f0bd939b9 Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 12 Nov 2017 12:35:59 -0500 Subject: added u16_wcsstr(). --- src/u16_wcsstr.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/u16_wcsstr.c (limited to 'src/u16_wcsstr.c') diff --git a/src/u16_wcsstr.c b/src/u16_wcsstr.c new file mode 100644 index 0000000..63686b6 --- /dev/null +++ b/src/u16_wcsstr.c @@ -0,0 +1,22 @@ +/*******************************************************************/ +/* u16ports: u16 variants of wide character string functions. */ +/* Copyright (C) 2017 Z. Gilboa */ +/* Released under the Standard MIT License; see COPYING.U16PORTS. */ +/*******************************************************************/ + +#include +#include + +uint16_t * u16_wcsstr(const uint16_t * wstr, const uint16_t * wsub) +{ + size_t len; + + if (!(len = u16_wcslen(wsub))) + return (uint16_t *)wstr; + + for (; *wstr; wstr++) + if (!(u16_wcsncmp(wstr,wsub,len))) + return (uint16_t *)wstr; + + return 0; +} -- cgit v1.2.3