Fix #29: add ico image/x-icon to mime type to support favicon.ico. Removed duplicate...
[MonkeyD.git] / src / chars.c
blob54c717bafaaeecc63d33bb559a1a0a0b8acaec30
1 /* Monkey HTTP Daemon
2 * ------------------
3 * Copyright (C) 2001-2003, Eduardo Silva P.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Library General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #include <stdio.h>
22 /* iso_8859_15 (man iso_8859_15) */
23 int get_char(int code)
25 switch(code){
26 /* Perl is great :) */
27 case 160: return ' ';
28 case 161: return '¡';
29 case 162: return '¢';
30 case 163: return '£';
31 case 164: return '¤';
32 case 165: return '¥';
33 case 166: return '¦';
34 case 167: return '§';
35 case 168: return '¨';
36 case 169: return '©';
37 case 170: return 'ª';
38 case 171: return '«';
39 case 172: return '¬';
40 case 173: return '­';
41 case 174: return '®';
42 case 175: return '¯';
43 case 176: return '°';
44 case 177: return '±';
45 case 178: return '²';
46 case 179: return '³';
47 case 180: return '´';
48 case 181: return 'µ';
49 case 182: return '¶';
50 case 183: return '·';
51 case 184: return '¸';
52 case 185: return '¹';
53 case 186: return 'º';
54 case 187: return '»';
55 case 188: return '¼';
56 case 189: return '½';
57 case 190: return '¾';
58 case 191: return '¿';
59 case 192: return 'À';
60 case 193: return 'Á';
61 case 194: return 'Â';
62 case 195: return 'Ã';
63 case 196: return 'Ä';
64 case 197: return 'Å';
65 case 198: return 'Æ';
66 case 199: return 'Ç';
67 case 200: return 'È';
68 case 201: return 'É';
69 case 202: return 'Ê';
70 case 203: return 'Ë';
71 case 204: return 'Ì';
72 case 205: return 'Í';
73 case 206: return 'Î';
74 case 207: return 'Ï';
75 case 208: return 'Ð';
76 case 209: return 'Ñ';
77 case 210: return 'Ò';
78 case 211: return 'Ó';
79 case 212: return 'Ô';
80 case 213: return 'Õ';
81 case 214: return 'Ö';
82 case 215: return '×';
83 case 216: return 'Ø';
84 case 217: return 'Ù';
85 case 218: return 'Ú';
86 case 219: return 'Û';
87 case 220: return 'Ü';
88 case 221: return 'Ý';
89 case 222: return 'Þ';
90 case 223: return 'ß';
91 case 224: return 'à';
92 case 225: return 'á';
93 case 226: return 'â';
94 case 227: return 'ã';
95 case 228: return 'ä';
96 case 229: return 'å';
97 case 230: return 'æ';
98 case 231: return 'ç';
99 case 232: return 'è';
100 case 233: return 'é';
101 case 234: return 'ê';
102 case 235: return 'ë';
103 case 236: return 'ì';
104 case 237: return 'í';
105 case 238: return 'î';
106 case 239: return 'ï';
107 case 240: return 'ð';
108 case 241: return 'ñ';
109 case 242: return 'ò';
110 case 243: return 'ó';
111 case 244: return 'ô';
112 case 245: return 'õ';
113 case 246: return 'ö';
114 case 247: return '÷';
115 case 248: return 'ø';
116 case 249: return 'ù';
117 case 250: return 'ú';
118 case 251: return 'û';
119 case 252: return 'ü';
120 case 253: return 'ý';
121 case 254: return 'þ';
122 case 255: return 'ÿ';
124 return -1;
127 /* Transorma numeracion Hexa a base decimal */
128 int hex2int(char *pChars)
130 int Hi;
131 int Lo;
132 int Result;
134 Hi=pChars[0];
135 if ('0'<=Hi&&Hi<='9') {
136 Hi-='0';
137 } else if ('a'<=Hi&&Hi<='f') {
138 Hi-=('a'-10);
139 } else if ('A'<=Hi&&Hi<='F') {
140 Hi-=('A'-10);
142 Lo = pChars[1];
143 if ('0'<=Lo&&Lo<='9') {
144 Lo-='0';
145 } else if ('a'<=Lo&&Lo<='f') {
146 Lo-=('a'-10);
147 } else if ('A'<=Lo&&Lo<='F') {
148 Lo-=('A'-10);
150 Result=Lo+(16*Hi);
152 return (Result);