1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (c) 2013 Peter Wemm
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 *    notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 *    notice, this list of conditions and the following disclaimer in the
14 *    documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $FreeBSD$
29 */
30
31/*
32 * These are ABI implementations for when the raw iconv_* symbol
33 * space was exposed via libc.so.7 in its early life.  This is
34 * a transition aide, these wrappers will not normally ever be
35 * executed except via __sym_compat() references.
36 */
37#include <sys/types.h>
38#include <iconv.h>
39#include "iconv-internal.h"
40
41size_t
42__iconv_compat(iconv_t a, char ** b, size_t * c, char ** d,
43     size_t * e, __uint32_t f, size_t *g)
44{
45	return __bsd___iconv(a, b, c, d, e, f, g);
46}
47
48void
49__iconv_free_list_compat(char ** a, size_t b)
50{
51	__bsd___iconv_free_list(a, b);
52}
53
54int
55__iconv_get_list_compat(char ***a, size_t *b, __iconv_bool c)
56{
57	return __bsd___iconv_get_list(a, b, c);
58}
59
60size_t
61iconv_compat(iconv_t a, char ** __restrict b,
62      size_t * __restrict c, char ** __restrict d,
63      size_t * __restrict e)
64{
65	return __bsd_iconv(a, b, c, d, e);
66}
67
68const char *
69iconv_canonicalize_compat(const char *a)
70{
71	return __bsd_iconv_canonicalize(a);
72}
73
74int
75iconv_close_compat(iconv_t a)
76{
77	return __bsd_iconv_close(a);
78}
79
80iconv_t
81iconv_open_compat(const char *a, const char *b)
82{
83	return __bsd_iconv_open(a, b);
84}
85
86int
87iconv_open_into_compat(const char *a, const char *b, iconv_allocation_t *c)
88{
89	return __bsd_iconv_open_into(a, b, c);
90}
91
92void
93iconv_set_relocation_prefix_compat(const char *a, const char *b)
94{
95	return __bsd_iconv_set_relocation_prefix(a, b);
96}
97
98int
99iconvctl_compat(iconv_t a, int b, void *c)
100{
101	return __bsd_iconvctl(a, b, c);
102}
103
104void
105iconvlist_compat(int (*a) (unsigned int, const char * const *, void *), void *b)
106{
107	return __bsd_iconvlist(a, b);
108}
109
110int _iconv_version_compat = 0x0108;	/* Magic - not used */
111
112__sym_compat(__iconv, __iconv_compat, FBSD_1.2);
113__sym_compat(__iconv_free_list, __iconv_free_list_compat, FBSD_1.2);
114__sym_compat(__iconv_get_list, __iconv_get_list_compat, FBSD_1.2);
115__sym_compat(_iconv_version, _iconv_version_compat, FBSD_1.3);
116__sym_compat(iconv, iconv_compat, FBSD_1.3);
117__sym_compat(iconv_canonicalize, iconv_canonicalize_compat, FBSD_1.2);
118__sym_compat(iconv_close, iconv_close_compat, FBSD_1.3);
119__sym_compat(iconv_open, iconv_open_compat, FBSD_1.3);
120__sym_compat(iconv_open_into, iconv_open_into_compat, FBSD_1.3);
121__sym_compat(iconv_set_relocation_prefix, iconv_set_relocation_prefix_compat, FBSD_1.3);
122__sym_compat(iconvctl, iconvctl_compat, FBSD_1.3);
123__sym_compat(iconvlist, iconvlist_compat, FBSD_1.3);
124