int
main (int argc, char **argv) {
int c, n, cols, rows, nr, i, j, k;
- char *sep, *console = NULL;
+ int mode;
+ char *space, *sep, *console = NULL;
int list[64], lth, info = 0, verbose = 0;
set_progname(argv[0]);
if (optind != argc)
usage();
+ fd = getfd(console);
+
+ if (ioctl(fd, KDGKBMODE, &mode)) {
+ perror("KDGKBMODE");
+ leave(1);
+ }
+ if (mode == K_UNICODE)
+ space = "\xef\x80\xa0"; /* U+F020 (direct-to-font space) */
+ else
+ space = " ";
+
if (info) {
nr = rows = cols = 0;
n = getfont(fd, NULL, &nr, &rows, &cols);
leave(0);
}
- fd = getfd(console);
-
settrivialscreenmap();
getoldunicodemap();
cols = ((n > 256) ? 32 : 16);
nr = 64/cols;
rows = (n+cols-1)/cols;
- sep = ((cols == 16) ? " " : " ");
+ sep = ((cols == 16) ? "%1$s%1$s" : "%1$s");
for (i=0; i<rows; i++) {
if (i % nr == 0) {
list[lth++] = k+j*rows;
setnewunicodemap(list, lth);
}
- printf(" ");
+ printf("%1$s%1$s%1$s%1$s", space);
for(j=0; j < cols && i+j*rows < n; j++) {
putchar(BASE + (i%nr)*cols+j);
- printf("%s", sep);
+ printf(sep, space);
if (j%8 == 7)
- printf("%s", sep);
+ printf(sep, space);
}
putchar('\n');
if (i%8 == 7)