summaryrefslogtreecommitdiff
path: root/console-tools/loadfont.c
diff options
context:
space:
mode:
authorManuel Novoa III <mjn3@codepoet.org>2003-03-19 09:13:01 +0000
committerManuel Novoa III <mjn3@codepoet.org>2003-03-19 09:13:01 +0000
commitcad5364599eb5062d59e0c397ed638ddd61a8d5d (patch)
treea318d0f03aa076c74b576ea45dc543a5669e8e91 /console-tools/loadfont.c
parente01f9662a5bd5d91be4f6b3941b57fff73cd5af1 (diff)
downloadbusybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.gz
busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.tar.bz2
busybox-w32-cad5364599eb5062d59e0c397ed638ddd61a8d5d.zip
Major coreutils update.
Diffstat (limited to 'console-tools/loadfont.c')
-rw-r--r--console-tools/loadfont.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c
index d66500195..6108151a6 100644
--- a/console-tools/loadfont.c
+++ b/console-tools/loadfont.c
@@ -44,11 +44,11 @@ extern int loadfont_main(int argc, char **argv)
44 int fd; 44 int fd;
45 45
46 if (argc != 1) 46 if (argc != 1)
47 show_usage(); 47 bb_show_usage();
48 48
49 fd = open(CURRENT_VC, O_RDWR); 49 fd = open(CURRENT_VC, O_RDWR);
50 if (fd < 0) 50 if (fd < 0)
51 perror_msg_and_die("Error opening " CURRENT_VC); 51 bb_perror_msg_and_die("Error opening " CURRENT_VC);
52 loadnewfont(fd); 52 loadnewfont(fd);
53 53
54 return EXIT_SUCCESS; 54 return EXIT_SUCCESS;
@@ -62,7 +62,7 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize)
62 memset(buf, 0, sizeof(buf)); 62 memset(buf, 0, sizeof(buf));
63 63
64 if (unit < 1 || unit > 32) 64 if (unit < 1 || unit > 32)
65 error_msg_and_die("Bad character size %d", unit); 65 bb_error_msg_and_die("Bad character size %d", unit);
66 66
67 for (i = 0; i < fontsize; i++) 67 for (i = 0; i < fontsize; i++)
68 memcpy(buf + (32 * i), inbuf + (unit * i), unit); 68 memcpy(buf + (32 * i), inbuf + (unit * i), unit);
@@ -77,11 +77,11 @@ static void do_loadfont(int fd, char *inbuf, int unit, int fontsize)
77 77
78 if (ioctl(fd, PIO_FONTX, &cfd) == 0) 78 if (ioctl(fd, PIO_FONTX, &cfd) == 0)
79 return; /* success */ 79 return; /* success */
80 perror_msg("PIO_FONTX ioctl error (trying PIO_FONT)"); 80 bb_perror_msg("PIO_FONTX ioctl error (trying PIO_FONT)");
81 } 81 }
82#endif 82#endif
83 if (ioctl(fd, PIO_FONT, buf)) 83 if (ioctl(fd, PIO_FONT, buf))
84 perror_msg_and_die("PIO_FONT ioctl error"); 84 bb_perror_msg_and_die("PIO_FONT ioctl error");
85} 85}
86 86
87static void 87static void
@@ -119,11 +119,11 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
119 if (ioctl(fd, PIO_UNIMAPCLR, &advice)) { 119 if (ioctl(fd, PIO_UNIMAPCLR, &advice)) {
120#ifdef ENOIOCTLCMD 120#ifdef ENOIOCTLCMD
121 if (errno == ENOIOCTLCMD) { 121 if (errno == ENOIOCTLCMD) {
122 error_msg("It seems this kernel is older than 1.1.92"); 122 bb_error_msg("It seems this kernel is older than 1.1.92");
123 error_msg_and_die("No Unicode mapping table loaded."); 123 bb_error_msg_and_die("No Unicode mapping table loaded.");
124 } else 124 } else
125#endif 125#endif
126 perror_msg_and_die("PIO_UNIMAPCLR"); 126 bb_perror_msg_and_die("PIO_UNIMAPCLR");
127 } 127 }
128 ud.entry_ct = ct; 128 ud.entry_ct = ct;
129 ud.entries = up; 129 ud.entries = up;
@@ -133,7 +133,7 @@ do_loadtable(int fd, unsigned char *inbuf, int tailsz, int fontsize)
133 /* change advice parameters */ 133 /* change advice parameters */
134 } 134 }
135#endif 135#endif
136 perror_msg_and_die("PIO_UNIMAP"); 136 bb_perror_msg_and_die("PIO_UNIMAP");
137 } 137 }
138} 138}
139 139
@@ -150,13 +150,13 @@ static void loadnewfont(int fd)
150 */ 150 */
151 inputlth = fread(inbuf, 1, sizeof(inbuf), stdin); 151 inputlth = fread(inbuf, 1, sizeof(inbuf), stdin);
152 if (ferror(stdin)) 152 if (ferror(stdin))
153 perror_msg_and_die("Error reading input font"); 153 bb_perror_msg_and_die("Error reading input font");
154 /* use malloc/realloc in case of giant files; 154 /* use malloc/realloc in case of giant files;
155 maybe these do not occur: 16kB for the font, 155 maybe these do not occur: 16kB for the font,
156 and 16kB for the map leaves 32 unicode values 156 and 16kB for the map leaves 32 unicode values
157 for each font position */ 157 for each font position */
158 if (!feof(stdin)) 158 if (!feof(stdin))
159 perror_msg_and_die("Font too large"); 159 bb_perror_msg_and_die("Font too large");
160 160
161 /* test for psf first */ 161 /* test for psf first */
162 { 162 {
@@ -174,11 +174,11 @@ static void loadnewfont(int fd)
174 goto no_psf; 174 goto no_psf;
175 175
176 if (psfhdr.mode > PSF_MAXMODE) 176 if (psfhdr.mode > PSF_MAXMODE)
177 error_msg_and_die("Unsupported psf file mode"); 177 bb_error_msg_and_die("Unsupported psf file mode");
178 fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256); 178 fontsize = ((psfhdr.mode & PSF_MODE512) ? 512 : 256);
179#if !defined( PIO_FONTX ) || defined( __sparc__ ) 179#if !defined( PIO_FONTX ) || defined( __sparc__ )
180 if (fontsize != 256) 180 if (fontsize != 256)
181 error_msg_and_die("Only fontsize 256 supported"); 181 bb_error_msg_and_die("Only fontsize 256 supported");
182#endif 182#endif
183 hastable = (psfhdr.mode & PSF_MODEHASTAB); 183 hastable = (psfhdr.mode & PSF_MODEHASTAB);
184 unit = psfhdr.charsize; 184 unit = psfhdr.charsize;
@@ -186,7 +186,7 @@ static void loadnewfont(int fd)
186 186
187 head = head0 + fontsize * unit; 187 head = head0 + fontsize * unit;
188 if (head > inputlth || (!hastable && head != inputlth)) 188 if (head > inputlth || (!hastable && head != inputlth))
189 error_msg_and_die("Input file: bad length"); 189 bb_error_msg_and_die("Input file: bad length");
190 do_loadfont(fd, inbuf + head0, unit, fontsize); 190 do_loadfont(fd, inbuf + head0, unit, fontsize);
191 if (hastable) 191 if (hastable)
192 do_loadtable(fd, inbuf + head, inputlth - head, fontsize); 192 do_loadtable(fd, inbuf + head, inputlth - head, fontsize);
@@ -201,7 +201,7 @@ static void loadnewfont(int fd)
201 } else { 201 } else {
202 /* bare font */ 202 /* bare font */
203 if (inputlth & 0377) 203 if (inputlth & 0377)
204 error_msg_and_die("Bad input file size"); 204 bb_error_msg_and_die("Bad input file size");
205 offset = 0; 205 offset = 0;
206 unit = inputlth / 256; 206 unit = inputlth / 256;
207 } 207 }