1*16d86563SAlexander Pyhalov /*
2*16d86563SAlexander Pyhalov  * CDDL HEADER START
3*16d86563SAlexander Pyhalov  *
4*16d86563SAlexander Pyhalov  * The contents of this file are subject to the terms of the
5*16d86563SAlexander Pyhalov  * Common Development and Distribution License (the "License").
6*16d86563SAlexander Pyhalov  * You may not use this file except in compliance with the License.
7*16d86563SAlexander Pyhalov  *
8*16d86563SAlexander Pyhalov  * You can obtain a copy of the license at src/OPENSOLARIS.LICENSE
9*16d86563SAlexander Pyhalov  * or http://www.opensolaris.org/os/licensing.
10*16d86563SAlexander Pyhalov  * See the License for the specific language governing permissions
11*16d86563SAlexander Pyhalov  * and limitations under the License.
12*16d86563SAlexander Pyhalov  *
13*16d86563SAlexander Pyhalov  * When distributing Covered Code, include this CDDL HEADER in each
14*16d86563SAlexander Pyhalov  * file and include the License file at src/OPENSOLARIS.LICENSE.
15*16d86563SAlexander Pyhalov  * If applicable, add the following below this CDDL HEADER, with the
16*16d86563SAlexander Pyhalov  * fields enclosed by brackets "[]" replaced with your own identifying
17*16d86563SAlexander Pyhalov  * information: Portions Copyright [yyyy] [name of copyright owner]
18*16d86563SAlexander Pyhalov  *
19*16d86563SAlexander Pyhalov  * CDDL HEADER END
20*16d86563SAlexander Pyhalov  */
21*16d86563SAlexander Pyhalov /*
22*16d86563SAlexander Pyhalov  * Copyright (c) 1996 by Sun Microsystems, Inc.
23*16d86563SAlexander Pyhalov  */
24*16d86563SAlexander Pyhalov 
25*16d86563SAlexander Pyhalov 
26*16d86563SAlexander Pyhalov #include <stdlib.h>
27*16d86563SAlexander Pyhalov #include <errno.h>
28*16d86563SAlexander Pyhalov #include <widec.h>
29*16d86563SAlexander Pyhalov #include "common_def.h"
30*16d86563SAlexander Pyhalov #include "common_han.h"
31*16d86563SAlexander Pyhalov 
32*16d86563SAlexander Pyhalov /*
33*16d86563SAlexander Pyhalov  * Adummy object to run tar successfully on ko.UTF-8 locale
34*16d86563SAlexander Pyhalov  */
35*16d86563SAlexander Pyhalov 
36*16d86563SAlexander Pyhalov typedef struct __conv_desc {
37*16d86563SAlexander Pyhalov 	char	dummy;
38*16d86563SAlexander Pyhalov } _conv_desc;
39*16d86563SAlexander Pyhalov 
40*16d86563SAlexander Pyhalov /****  _ I C V _ O P E N  ****/
41*16d86563SAlexander Pyhalov 
_icv_open()42*16d86563SAlexander Pyhalov void* _icv_open()
43*16d86563SAlexander Pyhalov {
44*16d86563SAlexander Pyhalov 	_conv_desc* cd = (_conv_desc*)malloc(sizeof(_conv_desc));
45*16d86563SAlexander Pyhalov 
46*16d86563SAlexander Pyhalov 	if (cd == (_conv_desc*)NULL)
47*16d86563SAlexander Pyhalov 	{
48*16d86563SAlexander Pyhalov 		errno = ENOMEM;
49*16d86563SAlexander Pyhalov 		return((void*)-1);
50*16d86563SAlexander Pyhalov 	}
51*16d86563SAlexander Pyhalov 
52*16d86563SAlexander Pyhalov 	return((void*)cd);
53*16d86563SAlexander Pyhalov }  /* end of int _icv_open(). */
54*16d86563SAlexander Pyhalov 
55*16d86563SAlexander Pyhalov 
56*16d86563SAlexander Pyhalov /****  _ I C V _ C L O S E  ****/
57*16d86563SAlexander Pyhalov 
_icv_close(_conv_desc * cd)58*16d86563SAlexander Pyhalov void _icv_close(_conv_desc* cd)
59*16d86563SAlexander Pyhalov {
60*16d86563SAlexander Pyhalov 	if (!cd)
61*16d86563SAlexander Pyhalov 		errno = EBADF;
62*16d86563SAlexander Pyhalov 	else
63*16d86563SAlexander Pyhalov 		free((void*)cd);
64*16d86563SAlexander Pyhalov }  /* end of void _icv_close(_conv_desc*). */
65*16d86563SAlexander Pyhalov 
66*16d86563SAlexander Pyhalov 
67*16d86563SAlexander Pyhalov /****  _ I C V _ I C O N V  ****/
68*16d86563SAlexander Pyhalov 
_icv_iconv(_conv_desc * cd,char ** inbuf,size_t * inbufleft,char ** outbuf,size_t * outbufleft)69*16d86563SAlexander Pyhalov size_t _icv_iconv(_conv_desc* cd, char** inbuf, size_t* inbufleft,
70*16d86563SAlexander Pyhalov 			char** outbuf, size_t* outbufleft)
71*16d86563SAlexander Pyhalov {
72*16d86563SAlexander Pyhalov 	size_t		ret_val = 0;
73*16d86563SAlexander Pyhalov 	unsigned char*	ib;
74*16d86563SAlexander Pyhalov 	unsigned char*	ob;
75*16d86563SAlexander Pyhalov 	unsigned char*	ibtail;
76*16d86563SAlexander Pyhalov 	unsigned char*	obtail;
77*16d86563SAlexander Pyhalov 
78*16d86563SAlexander Pyhalov 	/*
79*16d86563SAlexander Pyhalov 	 * Simply copy input to output as it is
80*16d86563SAlexander Pyhalov 	 */
81*16d86563SAlexander Pyhalov 
82*16d86563SAlexander Pyhalov 	return ret_val;
83*16d86563SAlexander Pyhalov 
84*16d86563SAlexander Pyhalov 	ib = (unsigned char*)*inbuf;
85*16d86563SAlexander Pyhalov 	ob = (unsigned char*)*outbuf;
86*16d86563SAlexander Pyhalov 	ibtail = ib + *inbufleft;
87*16d86563SAlexander Pyhalov 	obtail = ob + *outbufleft;
88*16d86563SAlexander Pyhalov 
89*16d86563SAlexander Pyhalov 	memcpy((char *)ob, (char *)ib, ibtail);
90*16d86563SAlexander Pyhalov 
91*16d86563SAlexander Pyhalov 	return(ret_val);
92*16d86563SAlexander Pyhalov }  /* end of size_t _icv_iconv(int*, char**, size_t*, char**, size_t*).*/
93