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 "2 ioctl_list" "PIO_FONTX") * (find-man "4 console_ioctl" " PIO_FONTX") * (find-node "(libc)Error Messages" "char * strerror (int ERRNUM)") */ /* (find-angg "vtutil4/piofontx51.c") * (find-angg "vtutil4/piofontx.c") * (find-angg "DAVINCI/peek.c") * (find-luamanualw3m "#luaL_checkint") * (find-luamanualw3m "#lua_pushlstring") * (find-luamanualw3m "#lua_register") * (find-luamanualw3m "#pdf-package.loadlib") * (find-luamanualw3m "#lua_CFunction") * (find-lua51file "src/lua.h" "push functions (C -> stack)") * (find-lua51file "src/loadlib.c" "luaL_checkstring") * (find-lua51file "src/") * (find-lua51file "src/lua.h") * (find-lua51file "src/lauxlib.h" "checkint") * (find-sh0 "gcc -shared -o piofontx51.so -I$LUA51SRC/src piofontx51.c; ls -l piofontx51.so") * (find-sh0 "gcc -shared -o lbitlib51.so -I$LUA51SRC/src lbitlib.c; ls -l lbitlib51.so") * (find-pilfile "") * (find-pilw3m "index.html") * (find-pilw3m "26.2.html") */ 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") */