📄 libfbx-modules.c
字号:
/* * libfbx-modules.c -- Module handling functions. * (C)opyright 2001 U4X Labs * * Written by: Paul Mundt <lethal@u4xlabs.com> * * $Id: libfbx-modules.c,v 1.6 2001/02/11 07:12:51 lethal Exp $ * * This is where all of the module handling functions for * libfbx are located. * * See ChangeLog for modifications, CREDITS for credits. * * All source herein is copyright U4X Labs and its original author. * Any code modifications or additions are (C)opyright the original * author and U4X Labs respectively. * * libfbx is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * libfbx is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with libfbx; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA */#include <libfbx/libfbx.h>#include <libfbx/libfbx-drivers.h>#include <unistd.h>#include <dlfcn.h>#include <config.h>fb_module fb_modules[] = { { "MATROX", "mga" }, { "3Dfx Voodoo3", "3dfx" }, { "3Dfx Banshee", "3dfx" }, { "ATY Mach64", "ati" }, { "ATY Rage128", "ati" }, { NULL, NULL },};/* * Note: surface should be fb_screen for now. It exists * to provide for future expansion. */int fb_load_module(char *name){ fb_surface *surface = fb_screen; char modname[LEN], *errstr; if (name == NULL) return -1; snprintf(modname, sizeof(modname), "%s/libfbx-%s.so", MODULEDIR, name); if (access(modname, F_OK) < 0) { perror("Can't open module for reading"); return -1; } surface->driver->handle = dlopen(modname, RTLD_LAZY); if (surface->driver->handle == NULL) { perror("Can't open module"); return -1; } surface->driver->init = dlsym(surface->driver->handle, "fb_module_init"); if ((errstr = dlerror()) != NULL) { fprintf(stderr, "%s\n", errstr); return -1; } surface->driver->exit = dlsym(surface->driver->handle, "fb_module_exit"); if ((errstr = dlerror()) != NULL) { fprintf(stderr, "%s\n", errstr); return -1; } return 0;}void fb_unload_module(){ fb_surface *surface = fb_screen; dlclose(surface->driver->handle); surface->driver->handle = NULL;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -