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