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 */
8 fprintf (stderr, "Format: %u\n", font_format);
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);
17 - /* first try a wg15-charmap (glibc) file format */
18 - if (-1 != glibc_acm_read (fp, wbuf, False))
20 - if (ioctl(fd,PIO_UNISCRNMAP,wbuf))
21 - perror(_("PIO_UNISCRNMAP ioctl")), exit(1);
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)
35 -/* Reads a charmap file from /usr/share/i18n/charmaps as a SFM file
37 - * - returns -1 on error.
38 - * - returns it in `unicode' in an E_TABSZ-elements array.
39 - * (ie. real 16-bit) mapping.
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
44 -int glibc_acm_read (FILE *fp, unicode buf[], lct_boolean fail_on_error)
46 - char linebuf [256]; /* line buffer */
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;
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;
59 - sigemptyset (&sigset);
60 - sigaddset (&sigset, SIGCHLD);
61 - sigprocmask (SIG_BLOCK, &sigset, &old_sigset);
65 - if ( NULL == fgets (linebuf, sizeof (linebuf), fp))
69 - else if (fail_on_error)
71 - perror (_("uni_charmap_read(): error reading line"));
81 - p = strtok (linebuf," \t\n");
83 - if (!p || *p == '%')
84 - /* skip empty lines and comments */
88 - if (!strcmp (p,"CHARMAP"))
89 - charmap_section = 1;
92 - if (charmap_section)
94 - skip = strtok (NULL, "x");
95 - in = strtok (NULL, "<");
96 - out = strtok (NULL, ">");
100 - fprintf (stderr,_("Couldn't parse line %d\n"),linenum);
101 - /* restore sig mask */
102 - sigprocmask (SIG_SETMASK, &old_sigset, NULL);
105 - sscanf (in,"%x",&in_int);
106 - sscanf (out+1, "%x", &out_int);
107 - buf [in_int] = out_int;
111 - /* restore sig mask */
112 - sigprocmask (SIG_SETMASK, &old_sigset, NULL);
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;
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");
139 /* skip empty lines and comments */
140 - if (!p || *p == '#')
141 + if (!p || *p == '#' || *p == '%')
144 + if (charmap_section)
148 + strtok (NULL, "x");
149 + inp = strtok (NULL, "<");
150 + outp = strtok (NULL, ">");
153 + /* restore sig mask */
154 + sigprocmask (SIG_SETMASK, &old_sigset, NULL);
157 + sscanf (inp,"%x",&in);
158 + sscanf (outp+1, "%x", &on);
163 + if (!strcmp (p, "CHARMAP"))
165 + charmap_section = 1;
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;
176 /* get unicode mapping */
177 q = strtok(NULL," \t\n");
179 @@ -266,14 +210,14 @@ int acm_read_ascii(FILE *fp, unicode buf
180 if (in < 0 || in > 255)
187 on = ctoi(q, &tmp_is_unicode);
188 if (in < 0 && on > 65535)
195 *is_unicode |= tmp_is_unicode;
196 @@ -282,7 +226,7 @@ int acm_read_ascii(FILE *fp, unicode buf
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);
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
221 -E: jj@sunsite.ms.mff.cuni.cz
227 D: Original author of dumpkeys and loadkeys