#include
#include
char devname[16];
main()
{ int f, mode;
if ((f = open("/dev/ttyv0", O_RDONLY, 0)) < 0) { perror(0); exit();}
ioctl(f, VT_GETACTIVE, &mode);
close(f);
sprintf(devname,"/dev/ttyv%1x", mode-1);
printf("current console - %s\n", devname);
if ((f = open(devname, O_RDONLY, 0)) < 0) { perror(0); exit();}
if (ioctl(f, KDSKBMODE, K_XLATE) < 0) {perror(0); exit();}
printf("keyboard mode set to XLATE\n");
exit();
}