1 /*
2 * (c) Copyright 1992, Luc Rooijakkers. All rights reserved.
3 * Copyright (c) 1996-2005 Michael T Pins. All rights reserved.
4 *
5 * Character set support (rudimentary)
6 */
7
8 #include <string.h>
9 #include <ctype.h>
10 #include "config.h"
11 #include "chset.h"
12
13 static struct chset chsets[] = {
14 "us-ascii", 7,
15 "iso-8859-1", 8,
16 "iso-8859-2", 8,
17 "iso-8859-3", 8,
18 "iso-8859-4", 8,
19 "iso-8859-5", 8,
20 "iso-8859-6", 8,
21 "iso-8859-7", 8,
22 "iso-8859-8", 8,
23 "iso-8859-9", 8,
24 "iso-8859-15", 8,
25 "unknown", 0,
26 NULL, 0,
27 };
28
29 struct chset *curchset = chsets;
30
31 struct chset *
getchset(char * name)32 getchset(char *name)
33 {
34 struct chset *csp;
35 char *sp;
36
37 for (sp = name; *sp; sp++)
38 if (isupper(*sp))
39 *sp = tolower(*sp);
40
41 for (csp = chsets; csp->cs_name != NULL; csp++) {
42 if (strcmp(csp->cs_name, name) == 0)
43 return csp;
44 }
45
46 return NULL;
47 }
48