Deleted Added
full compact
nls.c (87866) nls.c (88282)
1/*
2 * Copyright (c) 2000-2001, Boris Popov
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 15 unchanged lines hidden (view full) ---

24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
1/*
2 * Copyright (c) 2000-2001, Boris Popov
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 15 unchanged lines hidden (view full) ---

24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 *
32 * $Id: nls.c,v 1.8 2001/04/16 12:46:46 bp Exp $
32 * $Id: nls.c,v 1.9 2001/08/22 03:31:36 bp Exp $
33 */
34
35#include <sys/types.h>
36#include <sys/iconv.h>
37#include <sys/sysctl.h>
38#include <ctype.h>
33 */
34
35#include <sys/types.h>
36#include <sys/iconv.h>
37#include <sys/sysctl.h>
38#include <ctype.h>
39#ifndef APPLE
39#include <dlfcn.h>
40#include <dlfcn.h>
41#endif
40#include <errno.h>
41#include <stdio.h>
42#include <strings.h>
43#include <stdlib.h>
44#include <locale.h>
45#include <err.h>
46#include <netsmb/smb_lib.h>
47

--- 27 unchanged lines hidden (view full) ---

75 nls_upper[i] = toupper(i);
76 }
77 return 0;
78}
79
80int
81nls_setrecode(const char *local, const char *external)
82{
42#include <errno.h>
43#include <stdio.h>
44#include <strings.h>
45#include <stdlib.h>
46#include <locale.h>
47#include <err.h>
48#include <netsmb/smb_lib.h>
49

--- 27 unchanged lines hidden (view full) ---

77 nls_upper[i] = toupper(i);
78 }
79 return 0;
80}
81
82int
83nls_setrecode(const char *local, const char *external)
84{
85#ifdef APPLE
86 return ENOENT;
87#else
83 iconv_t icd;
84
85 if (iconv_loaded == 2)
86 return ENOENT;
87 else if (iconv_loaded == 0) {
88 iconv_loaded++;
89 iconv_lib = dlopen("libiconv.so", RTLD_LAZY | RTLD_GLOBAL);
90 if (iconv_lib == NULL) {

--- 17 unchanged lines hidden (view full) ---

108 icd = my_iconv_open(local, external);
109 if (icd == (iconv_t)-1) {
110 my_iconv_close(nls_toext);
111 nls_toext = (iconv_t)0;
112 return errno;
113 }
114 nls_toloc = icd;
115 return 0;
88 iconv_t icd;
89
90 if (iconv_loaded == 2)
91 return ENOENT;
92 else if (iconv_loaded == 0) {
93 iconv_loaded++;
94 iconv_lib = dlopen("libiconv.so", RTLD_LAZY | RTLD_GLOBAL);
95 if (iconv_lib == NULL) {

--- 17 unchanged lines hidden (view full) ---

113 icd = my_iconv_open(local, external);
114 if (icd == (iconv_t)-1) {
115 my_iconv_close(nls_toext);
116 nls_toext = (iconv_t)0;
117 return errno;
118 }
119 nls_toloc = icd;
120 return 0;
121#endif
116}
117
118char *
119nls_str_toloc(char *dst, const char *src)
120{
121 char *p = dst;
122 int inlen, outlen;
123

--- 91 unchanged lines hidden ---
122}
123
124char *
125nls_str_toloc(char *dst, const char *src)
126{
127 char *p = dst;
128 int inlen, outlen;
129

--- 91 unchanged lines hidden ---