]> mj.ucw.cz Git - libucw.git/blob - charset/setnames.c
Add path to all includes.
[libucw.git] / charset / setnames.c
1 /*
2  *      Character Set Conversion Library 1.0 -- Character Set Names
3  *
4  *      (c) 1998 Martin Mares <mj@atrey.karlin.mff.cuni.cz>
5  *
6  *      This software may be freely distributed and used according to the terms
7  *      of the GNU General Public License.
8  */
9
10 #include <stdio.h>
11 #include <string.h>
12
13 #include "lib/lib.h"
14 #include "charconv.h"
15
16 char *cs_names[] = {
17         "US-ASCII",
18         "ISO-8859-1",
19         "ISO-8859-2",
20         "windows-1250",
21         "x-kam-cs",
22         "CSN_369103",
23         "cp852",
24         "x-mac-ce",
25         "utf-8"
26 };
27
28 int
29 find_charset_by_name(char *c)
30 {
31         unsigned int i;
32
33         for(i=0; i<CONV_NUM_CHARSETS; i++)
34                 if (!strcasecmp(cs_names[i], c))
35                         return i;
36         return -1;
37 }
38
39 char *
40 charset_name(int i)
41 {
42   if (i < 0 || i > CONV_NUM_CHARSETS)
43     return "x-unknown";
44   else
45     return cs_names[i];
46 }