8322 nl: misleading-indentation
[unleashed/tickless.git] / usr / src / lib / libfakekernel / common / kiconv.c
blob7d33813eb7aea677c624aa565595cfaf793767b0
1 /*
2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
5 * 1.0 of the CDDL.
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
13 * Copyright 2013 Nexenta Systems, Inc. All rights reserved.
17 #include <sys/types.h>
18 #include <sys/time.h>
19 #include <sys/systm.h>
20 #include <sys/errno.h>
21 #include <sys/kiconv.h>
23 #include <errno.h>
24 #include <iconv.h>
27 kiconv_t
28 kiconv_open(const char *tocode, const char *fromcode)
30 return (iconv_open(tocode, fromcode));
33 int
34 kiconv_close(kiconv_t handle)
36 if (iconv_close(handle) < 0)
37 return (EBADF);
39 return (0);
42 size_t
43 kiconv(
44 kiconv_t handle,
45 char **inbuf,
46 size_t *inbytesleft,
47 char **outbuf,
48 size_t *outbytesleft,
49 int *errno_out)
51 size_t code;
53 code = iconv(handle, (const char **)inbuf, inbytesleft,
54 outbuf, outbytesleft);
55 *errno_out = errno;
56 return (code);