6fcf93e81b56e51f096fda0827e892eea35da023
[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 #include "various.h"
16
17 /*ARGSUSED*/
18 size_t
19 ust_safe_mbrtowc(wchar_t *pwc, const char *s, size_t n,
20 mbstate_t *ps __attribute__((unused)))
21 {
22
23 /* pwc may be NULL */
24 /* s may be NULL */
25 /* ps appears to be unused */
26
27 if (s == NULL)
28 return 0;
29 if (n == 0)
30 return (size_t)-1;
31 if (pwc)
32 *pwc = (wchar_t)(unsigned char)*s;
33 return (*s != '\0');
34 }
This page took 0.04418 seconds and 3 git commands to generate.