]> git.pld-linux.org Git - packages/console-tools.git/blob - console-tools-acm.patch
- updated gettext BR
[packages/console-tools.git] / console-tools-acm.patch
1 --- console-tools-0.3.3/lib/cfont/fontstruct.c.jj       Fri Feb 25 18:19:16 2000
2 +++ console-tools-0.3.3/lib/cfont/fontstruct.c  Fri Feb 25 19:37:42 2000
3 @@ -60,6 +60,7 @@ simple_font* read_simple_font (FILE* fon
4        filesize = -1;                  /* cannot know, so say we don't know */
5      }
6  
7 +  if (0)
8    fprintf (stderr, "Format: %u\n", font_format);
9    
10    /*
11 --- console-tools-0.3.3/lib/console/acm.c.jj    Tue Sep 21 19:18:39 1999
12 +++ console-tools-0.3.3/lib/console/acm.c       Fri Feb 25 19:34:48 2000
13 @@ -33,16 +33,7 @@ int acm_load(int fd, FILE *fp) 
14    if (fstat(fp->_fileno, &stbuf)) 
15      perror(_("Cannot stat ACM file")), exit(1);
16  
17 -  /* first try a wg15-charmap (glibc) file format */
18 -  if (-1 != glibc_acm_read (fp, wbuf, False))
19 -    {
20 -      if (ioctl(fd,PIO_UNISCRNMAP,wbuf))
21 -       perror(_("PIO_UNISCRNMAP ioctl")), exit(1);
22 -      else
23 -       return 0;
24 -    }
25 -
26 -  /*  next try a UTF screen-map: either ASCII (no restriction) or binary (regular file) */
27 +  /*  Try a UTF screen-map: either ASCII (no restriction) or binary (regular file) */
28    if (!(parse_failed = (-1 == acm_read_ascii(fp,wbuf,&is_unicode))) ||
29        (S_ISREG(stbuf.st_mode) && 
30         (stbuf.st_size == (sizeof(unicode) * E_TABSZ))))  /* test for binary UTF map by size */
31 @@ -122,91 +113,8 @@ int acm_load(int fd, FILE *fp) 
32  }
33  
34  
35 -/* Reads a charmap file from /usr/share/i18n/charmaps as a SFM file
36 - *
37 - * - returns -1 on error.
38 - * - returns it in `unicode' in an E_TABSZ-elements array.
39 - *   (ie. real 16-bit) mapping.
40 - *
41 - * FIXME: This is very fragile and depends on the precise syntax of the file.
42 - * Works for usual files; probably a yacc grammar would be better
43 - */
44 -int glibc_acm_read (FILE *fp, unicode buf[], lct_boolean fail_on_error)
45 -{
46 -  char linebuf [256];  /* line buffer */
47 -  char *p;
48 -  int in_int, out_int, i;
49 -  char *in, *out, *skip;
50 -  int charmap_section = 0, linenum = 0;
51 -  sigset_t sigset, old_sigset;
52 -       
53 -  /* first 128 codes defaults to ASCII */ 
54 -  for (i=0; i<128; i++) buf[i] = i;
55 -  /* remaining defaults to replacement char (usually E_TABSZ = 256) */
56 -  for ( ; i<E_TABSZ; i++) buf[i] = 0xfffd;
57 -       
58 -  /* block SIGCHLD */
59 -  sigemptyset (&sigset);
60 -  sigaddset (&sigset, SIGCHLD);
61 -  sigprocmask (SIG_BLOCK, &sigset, &old_sigset);
62 -       
63 -  do
64 -    { 
65 -      if ( NULL == fgets (linebuf, sizeof (linebuf), fp))
66 -       {
67 -         if (feof (fp))
68 -           break;
69 -         else if (fail_on_error)
70 -           {
71 -             perror (_("uni_charmap_read(): error reading line"));
72 -             exit (2);
73 -           }
74 -         else
75 -           {
76 -             return -1;
77 -           }
78 -       }
79 -      linenum++;
80 -               
81 -      p = strtok (linebuf," \t\n");
82 -
83 -      if (!p || *p == '%') 
84 -       /* skip empty lines and comments */
85 -       continue;
86 -      if (*p != '<')
87 -       {
88 -         if (!strcmp (p,"CHARMAP"))
89 -           charmap_section = 1;
90 -         continue;
91 -       }
92 -      if (charmap_section)
93 -       {
94 -         skip = strtok (NULL, "x");
95 -         in = strtok (NULL, "<");
96 -         out = strtok (NULL, ">");
97 -         if (!in || !out)
98 -           {
99 -             if (fail_on_error) 
100 -               fprintf (stderr,_("Couldn't parse line %d\n"),linenum);
101 -             /* restore sig mask */
102 -             sigprocmask (SIG_SETMASK, &old_sigset, NULL);
103 -             return -1;
104 -           }
105 -         sscanf (in,"%x",&in_int);
106 -         sscanf (out+1, "%x", &out_int);
107 -         buf [in_int] = out_int;
108 -       }
109 -    } while (1);
110 -
111 -  /* restore sig mask */
112 -  sigprocmask (SIG_SETMASK, &old_sigset, NULL);
113 -
114 -  return 0;
115 -}
116 -
117 -
118  /*
119 - * - reads `fp' as a 16-bit ASCII SFM file.
120 + * - reads `fp' as a 16-bit ASCII ACM file or wg-15 (glibc) file.
121   * - returns -1 on error.
122   * - returns it in `unicode' in an E_TABSZ-elements array.
123   * - sets `*is_unicode' flagiff there were any non-8-bit
124 @@ -223,6 +131,8 @@ int acm_read_ascii(FILE *fp, unicode buf
125    int i;                                         /* loop index - result holder */
126    int ret_code = 0;                              /* return code */
127    sigset_t sigset, old_sigset;
128 +  int charmap_section = 0, linenum = 0;
129 +  char *inp, *outp;
130    
131    assert (is_unicode);
132    
133 @@ -254,10 +164,44 @@ int acm_read_ascii(FILE *fp, unicode buf
134        /* get "charset-relative charcode", stripping leading spaces */
135        p = strtok(buffer," \t\n");
136  
137 +      linenum++;
138 +
139        /* skip empty lines and comments */
140 -      if (!p || *p == '#')
141 +      if (!p || *p == '#' || *p == '%')
142           continue;
143  
144 +      if (charmap_section)
145 +       {
146 +         if (*p != '<')
147 +           continue;
148 +         strtok (NULL, "x");
149 +         inp = strtok (NULL, "<");
150 +         outp = strtok (NULL, ">");
151 +         if (!inp || !outp)
152 +           {
153 +             /* restore sig mask */
154 +             sigprocmask (SIG_SETMASK, &old_sigset, NULL);
155 +             return -1;
156 +           }
157 +         sscanf (inp,"%x",&in);
158 +         sscanf (outp+1, "%x", &on);
159 +         buf [in] = on;
160 +         continue;
161 +       }
162 +
163 +      if (!strcmp (p, "CHARMAP"))
164 +       {
165 +         charmap_section = 1;
166 +         ret_code = 0;
167 +         *is_unicode = True;
168 +         /* Reinitialize buf because wg-15 (glibc) format starts here. */
169 +         /* first 128 codes defaults to ASCII */ 
170 +         for (i=0; i<128; i++) buf[i] = i;
171 +         /* remaining defaults to replacement char (usually E_TABSZ = 256) */
172 +         for ( ; i<E_TABSZ; i++) buf[i] = 0xfffd;
173 +         continue;
174 +       }
175 +
176        /* get unicode mapping */
177        q = strtok(NULL," \t\n");
178        if (q) 
179 @@ -266,14 +210,14 @@ int acm_read_ascii(FILE *fp, unicode buf
180           if (in < 0 || in > 255)
181             {
182               ret_code = -1;
183 -             break;
184 +             continue;
185             }
186           
187           on = ctoi(q, &tmp_is_unicode);
188           if (in < 0 && on > 65535)
189             {
190               ret_code = -1;
191 -             break;
192 +             continue;
193             }
194           
195           *is_unicode |= tmp_is_unicode;
196 @@ -282,7 +226,7 @@ int acm_read_ascii(FILE *fp, unicode buf
197        else 
198         {
199           ret_code = -1;
200 -         break;
201 +         continue;
202         }
203      }
204    while (1); /* terminated by break on feof() */
205 --- console-tools-0.3.3/include/lct/console.h.jj        Thu Aug 26 00:00:55 1999
206 +++ console-tools-0.3.3/include/lct/console.h   Fri Feb 25 18:46:09 2000
207 @@ -28,7 +28,6 @@ void acm_save (int fd, char* omfil);
208  int acm_load(int fd, FILE *fp);
209  int fcm_read_ascii(FILE *fp, unsigned char buf[]);
210  int acm_read_ascii(FILE *fp, unicode buf[], lct_boolean* is_unicode);
211 -int glibc_acm_read (FILE *fp, unicode buf[], lct_boolean fail_on_error);
212  
213  /* unimap-misc.c */
214  int set_kernel_sfm(int fd, struct unimapdesc *);
215 --- console-tools-0.3.3/CREDITS.jj      Thu Aug 26 00:14:53 1999
216 +++ console-tools-0.3.3/CREDITS Fri Feb 25 19:03:57 2000
217 @@ -50,8 +50,8 @@ N: Joel Hoffman
218  E: joel@wam.umd.edu
219  
220  N: Jakub Jelinek
221 -E: jj@sunsite.ms.mff.cuni.cz
222 -S: Czech Republic ?
223 +E: jakub@redhat.com
224 +S: Czech Republic
225  
226  N: Risto Kankkunen
227  D: Original author of dumpkeys and loadkeys
This page took 0.084584 seconds and 3 git commands to generate.