Move to kernel style SPDX license identifiers
[lttng-ust.git] / snprintf / mbrtowc_sb.c
1 /* $OpenBSD: mbrtowc_sb.c,v 1.4 2005/11/27 20:03:06 cloder Exp $ */
2 /* $NetBSD: multibyte_sb.c,v 1.4 2003/08/07 16:43:04 agc Exp $ */
3
4 /*
5 * SPDX-License-Identifier: BSD-3-Clause
6 *
7 * Copyright (C) 1991 The Regents of the University of California.
8 * All rights reserved.
9 */
10
11 #include <errno.h>
12 #include <stdlib.h>
13 #include <wchar.h>
14
15 /*ARGSUSED*/
16 size_t
17 ust_safe_mbrtowc(wchar_t *pwc, const char *s, size_t n,
18 mbstate_t *ps __attribute__((unused)))
19 {
20
21 /* pwc may be NULL */
22 /* s may be NULL */
23 /* ps appears to be unused */
24
25 if (s == NULL)
26 return 0;
27 if (n == 0)
28 return (size_t)-1;
29 if (pwc)
30 *pwc = (wchar_t)(unsigned char)*s;
31 return (*s != '\0');
32 }
This page took 0.030271 seconds and 4 git commands to generate.