setrunelocale.c (38333) | setrunelocale.c (61218) |
---|---|
1/*- 2 * Copyright (c) 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Paul Borman at Krystal Technologies. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 18 unchanged lines hidden (view full) --- 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. | 1/*- 2 * Copyright (c) 1993 3 * The Regents of the University of California. All rights reserved. 4 * 5 * This code is derived from software contributed to Berkeley by 6 * Paul Borman at Krystal Technologies. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 18 unchanged lines hidden (view full) --- 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. |
35 * 36 * $FreeBSD: head/lib/libc/locale/setrunelocale.c 61218 2000-06-03 12:24:08Z ache $ |
|
35 */ 36 37#include <rune.h> 38#include <errno.h> 39#include <limits.h> 40#include <string.h> 41#include <stdio.h> 42#include <stdlib.h> 43#include <unistd.h> 44#include "setlocale.h" 45 46extern int _none_init __P((_RuneLocale *)); | 37 */ 38 39#include <rune.h> 40#include <errno.h> 41#include <limits.h> 42#include <string.h> 43#include <stdio.h> 44#include <stdlib.h> 45#include <unistd.h> 46#include "setlocale.h" 47 48extern int _none_init __P((_RuneLocale *)); |
47#ifdef XPG4 | |
48extern int _UTF2_init __P((_RuneLocale *)); 49extern int _EUC_init __P((_RuneLocale *)); 50extern int _BIG5_init __P((_RuneLocale *)); 51extern int _MSKanji_init __P((_RuneLocale *)); | 49extern int _UTF2_init __P((_RuneLocale *)); 50extern int _EUC_init __P((_RuneLocale *)); 51extern int _BIG5_init __P((_RuneLocale *)); 52extern int _MSKanji_init __P((_RuneLocale *)); |
52extern int _xpg4_setrunelocale __P((char *)); 53#endif | |
54extern _RuneLocale *_Read_RuneMagi __P((FILE *)); 55 | 53extern _RuneLocale *_Read_RuneMagi __P((FILE *)); 54 |
56#ifdef XPG4 | |
57int 58setrunelocale(encoding) 59 char *encoding; 60{ | 55int 56setrunelocale(encoding) 57 char *encoding; 58{ |
61 return _xpg4_setrunelocale(encoding); 62} 63#endif 64 65int 66#ifndef XPG4 67setrunelocale(encoding) 68#else 69_xpg4_setrunelocale(encoding) 70#endif 71 char *encoding; 72{ | |
73 FILE *fp; 74 char name[PATH_MAX]; 75 _RuneLocale *rl; 76 77 if (!encoding || strlen(encoding) > ENCODING_LEN) 78 return(EFAULT); 79 80 /* --- 31 unchanged lines hidden (view full) --- 112 return(ENOENT); 113 114 if ((rl = _Read_RuneMagi(fp)) == 0) { 115 fclose(fp); 116 return(EFTYPE); 117 } 118 fclose(fp); 119 | 59 FILE *fp; 60 char name[PATH_MAX]; 61 _RuneLocale *rl; 62 63 if (!encoding || strlen(encoding) > ENCODING_LEN) 64 return(EFAULT); 65 66 /* --- 31 unchanged lines hidden (view full) --- 98 return(ENOENT); 99 100 if ((rl = _Read_RuneMagi(fp)) == 0) { 101 fclose(fp); 102 return(EFTYPE); 103 } 104 fclose(fp); 105 |
120#ifdef XPG4 121 if (!rl->encoding[0] || !strcmp(rl->encoding, "UTF2")) 122 return(_UTF2_init(rl)); 123#else | |
124 if (!rl->encoding[0]) 125 return(EINVAL); | 106 if (!rl->encoding[0]) 107 return(EINVAL); |
126#endif | |
127 else if (!strcmp(rl->encoding, "NONE")) 128 return(_none_init(rl)); | 108 else if (!strcmp(rl->encoding, "NONE")) 109 return(_none_init(rl)); |
129#ifdef XPG4 | 110 else if (!strcmp(rl->encoding, "UTF2")) 111 return(_UTF2_init(rl)); |
130 else if (!strcmp(rl->encoding, "EUC")) 131 return(_EUC_init(rl)); 132 else if (!strcmp(rl->encoding, "BIG5")) 133 return(_BIG5_init(rl)); 134 else if (!strcmp(rl->encoding, "MSKanji")) 135 return(_MSKanji_init(rl)); | 112 else if (!strcmp(rl->encoding, "EUC")) 113 return(_EUC_init(rl)); 114 else if (!strcmp(rl->encoding, "BIG5")) 115 return(_BIG5_init(rl)); 116 else if (!strcmp(rl->encoding, "MSKanji")) 117 return(_MSKanji_init(rl)); |
136#endif | |
137 else 138 return(EINVAL); 139} 140 | 118 else 119 return(EINVAL); 120} 121 |