2 # static_modules.c.SH: Generates our static module list
3 # $Id: static_modules.c.SH 6 2005-09-10 01:02:21Z nenolod $
5 SYMS
=`for x in $*; do basename $x .o|sed -es/^m_//; done`
6 cat > static_modules.c
<<EOF
8 * This file is automatically generated: do not modify
9 * ircd-ratbox: A slightly useful ircd
11 * Copyright (C) 2003 Aaron Sethman <androsyn@ratbox.org>
12 * Copyright (C) 2003-2005 ircd-ratbox development team
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 2 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 * GNU General Public License for more details.
24 * You should have received a copy of the GNU General Public License
25 * along with this program; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
38 echo extern struct mapi_header_av1
"$x"_mheader\
;
39 done >> static_modules.c
42 echo static const struct mapi_header_av1
*mapi_headers
[] = { >> static_modules.c
45 done >> static_modules.c
47 echo NULL
}\
; >> static_modules.c
49 cat >> static_modules.c
<<EOF
50 void load_static_modules(void)
54 for(x = 0; mapi_headers[x] != NULL; x++)
56 mapi_version = (int *)mapi_headers[x];
57 if(MAPI_MAGIC(*mapi_version) != MAPI_MAGIC_HDR)
59 ilog(L_MAIN, "Error: linked in module without a MAPI header..giving up");
62 switch(MAPI_VERSION(*mapi_version))
66 struct mapi_mheader_av1 *mheader = (struct mapi_mheader_av1*)mapi_version;
67 if (mheader->mapi_register && (mheader->mapi_register() == -1))
69 ilog(L_MAIN, "Error: linked in module failed loading..giving up");
73 if(mheader->mapi_command_list)
76 for(m = mheader->mapi_command_list; *m; ++m)
80 if(mheader->mapi_hook_list)
83 for(m = mheader->mapi_hook_list; m->hapi_name; ++m)
84 *m->hapi_id = register_hook(m->hapi_name);
87 if(mheader->mapi_hfn_list)
90 for(m = mheader->mapi_hfn_list; m->hapi_name; ++m)
91 add_hook(m->hapi_name, m->fn);
100 ilog(L_MAIN, "Error: Unknown MAPI version in linked in module..giving up");