ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/modules/operserv/modinspect.C
Revision: 1.8
Committed: Sat Sep 22 14:27:28 2007 UTC (16 years, 8 months ago) by pippijn
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +3 -3 lines
Log Message:
split up ermyth into ermyth-modules, libermyth (currently just ermyth-util) and ermyth-core

File Contents

# Content
1 /**
2 * modinspect.C: A simple module inspector.
3 *
4 * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team
5 * Rights to this code are as documented in COPYING.
6 *
7 *
8 * Portions of this file were derived from sources bearing the following license:
9 * Copyright © 2005-2006 Atheme Development Group
10 * Rights to this code are as documented in doc/pod/license.pod.
11 *
12 * $Id: modinspect.C,v 1.7 2007-09-16 18:54:44 pippijn Exp $
13 */
14
15 #include "atheme.h"
16 #include <ermyth/module.h>
17
18 static char const rcsid[] = "$Id: modinspect.C,v 1.7 2007-09-16 18:54:44 pippijn Exp $";
19
20 REGISTER_MODULE ("operserv/modinspect", false, "The Ermyth Team <http://ermyth.xinutec.org>");
21
22 static void os_cmd_modinspect (sourceinfo_t *si, int parc, char *parv[]);
23
24 E cmdvec os_cmdtree;
25 E helpvec os_helptree;
26
27 command_t const os_modinspect = { "MODINSPECT", N_("Displays information about loaded modules."), PRIV_SERVER_AUSPEX, 1, os_cmd_modinspect };
28
29 bool
30 _modinit (module *m)
31 {
32 os_cmdtree << os_modinspect;
33 help_addentry (os_helptree, "MODINSPECT", "help/operserv/modinspect", NULL);
34
35 return true;
36 }
37
38 void
39 _moddeinit (void)
40 {
41 os_cmdtree >> os_modinspect;
42 help_delentry (os_helptree, "MODINSPECT");
43 }
44
45 static void
46 os_cmd_modinspect (sourceinfo_t *si, int parc, char *parv[])
47 {
48 char *mname = parv[0];
49 module *m;
50
51 if (!mname)
52 {
53 command_fail (si, fault::needmoreparams, STR_INSUFFICIENT_PARAMS, "MODINSPECT");
54 command_fail (si, fault::needmoreparams, _("Syntax: MODINSPECT <module>"));
55 return;
56 }
57
58 logcommand (si, CMDLOG_GET, "MODINSPECT %s", mname);
59
60 m = modules::find (mname);
61
62 if (!m)
63 {
64 command_fail (si, fault::nosuch_target, _("\2%s\2 does not exist."), mname);
65 return;
66 }
67
68 if (!m->enabled)
69 {
70 command_fail (si, fault::nosuch_target, _("\2%s\2 is not loaded."), mname);
71 return;
72 }
73
74 command_success_nodata (si, _("Information on \2%s\2:"), mname);
75 command_success_nodata (si, _("Name : %s"), m->name);
76 command_success_nodata (si, _("Entry point: %p"), m->init);
77 command_success_nodata (si, _("Exit point : %p"), m->fini);
78 command_success_nodata (si, _("Version : %s"), m->version);
79 command_success_nodata (si, _("Vendor : %s"), m->vendor);
80 command_success_nodata (si, _("*** \2End of Info\2 ***"));
81 }