Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
#include <lua.h> #include <lauxlib.h> #include <sys/ioctl.h> #include <linux/kd.h> #include <unistd.h> #include <string.h> #include <errno.h> /* #include <fcntl.h> * #include <stdio.h> * (find-man "2 ioctl" "On success, zero is returned") * (find-man "4 console_ioctl" " PIO_FONTX") * (find-node "(libc)Error Messages" "char * strerror (int ERRNUM)") */ /* (find-luafile "include/lua.h" "push functions (C -> stack)") * (find-lua50ref "Querying the Stack") * (find-lua50ref "Getting Values from the Stack") * (find-lua50file "src/lib/loadlib.c" "luaL_checkstring") * (find-lua50file "src/lib/") * (find-lua50file "include/") * (find-lua50file "include/lua.h") * (find-lua50file "include/lauxlib.h" "checkint") */ static int lua_piofontx(lua_State* L) { struct consolefontdesc cfd; int len; cfd.chardata = (char *) luaL_checklstring(L, 1, &len); cfd.charcount = luaL_checkint(L, 2); cfd.charheight = luaL_checkint(L, 3); if(ioctl(STDIN_FILENO, PIO_FONTX, &cfd)) { lua_pushstring(L, strerror(errno)); return 1; } return 0; } LUALIB_API int piofontx_init(lua_State *L) { lua_register(L, "piofontx", lua_piofontx); return 0; } /* (eev "cd ~/vtutil4/; make clean; make piofontx.so") */