/* * assumes that if you care, you're running under vt * and therefore these are set. */ int readgeom(int *nrow, int *ncol, int *width, int *height) { static int fd = -1; char buf[64]; if(fd < 0 && (fd = open("/dev/wctl", OREAD)) < 0) return -1; /* wait for event, but don't care what it says */ if(read(fd, buf, sizeof buf) < 0) return -1; *nrow = intgetenv("LINES", 24); *ncol = intgetenv("COLS", 80); *width = intgetenv("XPIXELS", 640); *height = intgetenv("YPIXELS", 480); return 0; }
static void init_final(void) { char *libname; char *libnames[] = { "libpsport4all.so", "libpsport4gm.so", "libpsport4openib.so", "libpsport4mvapi.so", "libpsport4.so", NULL }; char *libdirs[] = { "", LIBDIR, NULL }; char **ln_p; char **ld_p; char buf[400]; static int initialized = 0; if (initialized) { return; } initialized = 1; intgetenv(&env_debug, ENV_DEBUG); libname = getenv(ENV_LIB); if (libname) { DPRINT(1, "set %s = %s", ENV_LIB, libname); if (load_lib(libname)) return; DPRINT(1, "loading %s failed!", libname); } else { DPRINT(2, "%s not set", ENV_LIB); } for (ln_p = libnames; *ln_p; ln_p++) { for (ld_p = libdirs; *ld_p; ld_p++) { strcpy(buf, *ld_p); strcat(buf, *ln_p); if (load_lib(buf)) return; } } fprintf(stderr, "Cant load one of "); for (ln_p = libnames; *ln_p; ln_p++) { fprintf(stderr, "%s ", *ln_p); } fprintf(stderr, ".\n"); exit(1); }