[SYSTEM] Apply patch from Debian.
authorAlexey Gladkov <legion@altlinux.org>
Sun, 4 Feb 2007 20:52:19 +0000 (23:52 +0300)
committerAlexey Gladkov <legion@altlinux.org>
Sun, 4 Feb 2007 20:52:19 +0000 (23:52 +0300)
Apply charsets0.diff patch from Debian distribution.
Stores in charsets[0] the current Unicode<->name mapping,
otherwise some symbols could not be retrieved if they
appear with different names.
Date: 2004-07-31

Signed-off-by: Alexey Gladkov <legion@altlinux.org>
src/ksyms.c

index 97f44e6..4c3591b 100644 (file)
@@ -1618,6 +1618,7 @@ struct cs {
     sym *charnames;
     int start;
 } charsets[] = {
+    { "", NULL, 256 },
     { "iso-8859-1",    latin1_syms, 160 },
     { "iso-8859-2",    latin2_syms, 160 },
     { "iso-8859-3",    latin3_syms, 160 },
@@ -1653,7 +1654,7 @@ list_charsets(FILE *f) {
                fprintf(f, "%s{", mm[j]);
                ct = 0;
                lth = strlen(mm[j]);
-               for(i=0; i < sizeof(charsets)/sizeof(charsets[0]); i++) {
+               for(i=1; i < sizeof(charsets)/sizeof(charsets[0]); i++) {
                        if(!strncmp(charsets[i].charset, mm[j], lth)) {
                                if(ct++)
                                        fprintf(f, ",");
@@ -1662,7 +1663,7 @@ list_charsets(FILE *f) {
                }
                fprintf(f, "}");
        }
-       for(i=0; i < sizeof(charsets)/sizeof(charsets[0]); i++) {
+       for(i=1; i < sizeof(charsets)/sizeof(charsets[0]); i++) {
                for (j=0; j<sizeof(mm)/sizeof(mm[0]); j++) {
                        lth = strlen(mm[j]);
                        if(!strncmp(charsets[i].charset, mm[j], lth))
@@ -1684,8 +1685,11 @@ set_charset(const char *charset) {
                return 0;
        }
 
-       for (i = 0; i < sizeof(charsets)/sizeof(charsets[0]); i++) {
+       for (i = 1; i < sizeof(charsets)/sizeof(charsets[0]); i++) {
                if (!strcasecmp(charsets[i].charset, charset)) {
+                       charsets[0].charset = charsets[i].charset;
+                       charsets[0].charnames = charsets[i].charnames;
+                       charsets[0].start = charsets[i].start;
                        p = charsets[i].charnames;
                        for (i = charsets[i].start; i < 256; i++,p++) {
                                if(p->name[0])