diff options
author | midipix <writeonce@midipix.org> | 2017-11-12 12:35:59 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2017-11-25 11:36:09 -0500 |
commit | 04b6fcdf1b535451939cba300ccf536f0bd939b9 (patch) | |
tree | d53d6eb96a36eb28ee4f6da61ac17a8bfcc2f703 | |
parent | 332506fa5fd504b8527e86726100c9116744a6b4 (diff) | |
download | u16ports-04b6fcdf1b535451939cba300ccf536f0bd939b9.tar.bz2 u16ports-04b6fcdf1b535451939cba300ccf536f0bd939b9.tar.xz |
added u16_wcsstr().
-rw-r--r-- | project/common.mk | 1 | ||||
-rw-r--r-- | src/u16_wcsstr.c | 22 |
2 files changed, 23 insertions, 0 deletions
diff --git a/project/common.mk b/project/common.mk index d76be98..bd5fdb5 100644 --- a/project/common.mk +++ b/project/common.mk @@ -18,6 +18,7 @@ API_SRCS = \ src/u16_wcsncat.c \ src/u16_wcschr.c \ src/u16_wcsrchr.c \ + src/u16_wcsstr.c \ INTERNAL_SRCS = \ 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 <stdint.h> +#include <u16ports/u16ports.h> + +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; +} |