Remove cruft left behind by removed stats_p_hook.
[seven-1.x.git] / modules / static_modules.c.SH
blob424af6a816730331faae0a4c41adc8e406f82a20
1 #!/bin/sh
2 # static_modules.c.SH: Generates our static module list
4 SYMS=`for x in $*; do basename $x .o|sed -es/^m_//; done`
5 cat > static_modules.c <<EOF
6 /*
7 * This file is automatically generated: do not modify
8 * ircd-ratbox: A slightly useful ircd
10 * Copyright (C) 2003 Aaron Sethman <androsyn@ratbox.org>
11 * Copyright (C) 2003-2005 ircd-ratbox development team
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
26 * USA
29 #include "stdinc.h"
30 #include "modules.h"
31 #include "hash.h"
32 #include "s_log.h"
34 EOF
36 for x in $SYMS; do
37 echo extern struct mapi_header_av1 "$x"_mheader\;
38 done >> static_modules.c
41 echo static const struct mapi_header_av1 *mapi_headers[] = { >> static_modules.c
42 for x in $SYMS; do
43 echo \&"$x"_mheader,
44 done >> static_modules.c
46 echo NULL }\; >> static_modules.c
48 cat >> static_modules.c <<EOF
49 void load_static_modules(void)
51 int x;
52 int *mapi_version;
53 for(x = 0; mapi_headers[x] != NULL; x++)
55 mapi_version = (int *)mapi_headers[x];
56 if(MAPI_MAGIC(*mapi_version) != MAPI_MAGIC_HDR)
58 ilog(L_MAIN, "Error: linked in module without a MAPI header..giving up");
59 exit(70);
61 switch(MAPI_VERSION(*mapi_version))
63 case 1:
65 struct mapi_mheader_av1 *mheader = (struct mapi_mheader_av1*)mapi_version;
66 if (mheader->mapi_register && (mheader->mapi_register() == -1))
68 ilog(L_MAIN, "Error: linked in module failed loading..giving up");
69 exit(70);
72 if(mheader->mapi_command_list)
74 struct Message **m;
75 for(m = mheader->mapi_command_list; *m; ++m)
76 mod_add_cmd(*m);
79 if(mheader->mapi_hook_list)
81 mapi_hlist_av1 *m;
82 for(m = mheader->mapi_hook_list; m->hapi_name; ++m)
83 *m->hapi_id = register_hook(m->hapi_name);
86 if(mheader->mapi_hfn_list)
88 mapi_hfn_list_av1 *m;
89 for(m = mheader->mapi_hfn_list; m->hapi_name; ++m)
90 add_hook(m->hapi_name, m->fn);
94 break;
97 default:
99 ilog(L_MAIN, "Error: Unknown MAPI version in linked in module..giving up");
100 exit(70);