ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/ermyth/modules/contrib/os_tabletest.C
Revision: 1.4
Committed: Sun Sep 16 18:54:43 2007 UTC (19 years ago) by pippijn
Content type: text/plain
Branch: MAIN
Changes since 1.3: +10 -5 lines
Log Message:
#defines to enum

File Contents

# User Rev Content
1 pippijn 1.4 /**
2     * os_tabletest.C: Some module TODO
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 pippijn 1.2 * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team
10     * Copyright © 2007 Atheme Development Group
11     * Rights to this code are as documented in doc/pod/license.pod.
12     *
13 pippijn 1.4 * $Id: os_tabletest.C,v 1.3 2007-08-29 08:04:33 pippijn Exp $
14 pippijn 1.2 */
15    
16 pippijn 1.1 #include "atheme.h"
17 pippijn 1.2 #include <ermyth/module.h>
18    
19 pippijn 1.4 static char const rcsid[] = "$Id: os_tabletest.C,v 1.3 2007-08-29 08:04:33 pippijn Exp $";
20 pippijn 1.1
21 pippijn 1.2 REGISTER_MODULE ("operserv/tabletest", false, "The Ermyth Team <http://ermyth.schmorp.de>");
22 pippijn 1.1
23     static void os_cmd_tabletest (sourceinfo_t *si, int parc, char *parv[]);
24    
25 pippijn 1.2 command_t const os_tabletest = { "TABLETEST", "Table test.", AC_NONE, 0, os_cmd_tabletest };
26 pippijn 1.1
27 pippijn 1.2 E cmdvec os_cmdtree;
28 pippijn 1.1
29 pippijn 1.2 bool
30     _modinit (module *m)
31 pippijn 1.1 {
32 pippijn 1.2 os_cmdtree << os_tabletest;
33 pippijn 1.1
34 pippijn 1.2 return true;
35 pippijn 1.1 }
36    
37     void
38     _moddeinit ()
39     {
40     os_cmdtree >> os_tabletest;
41     }
42    
43     static void
44     os_cmd_tabletest (sourceinfo_t *si, int parc, char *parv[])
45     {
46     table_t *t = table_new ("Table \2test\2");
47     table_row_t *r = table_row_new (t);
48    
49     table_cell_associate (r, "foo", "bar");
50     table_cell_associate (r, "F", "-");
51     table_cell_associate (r, "baz", "splork");
52    
53     r = table_row_new (t);
54    
55     table_cell_associate (r, "foo", "1");
56     table_cell_associate (r, "F", "+");
57     table_cell_associate (r, "baz", "2");
58    
59     r = table_row_new (t);
60    
61     table_cell_associate (r, "foo", "beagle4");
62     table_cell_associate (r, "F", "+");
63     table_cell_associate (r, "baz", "boo");
64    
65     command_success_table (si, t);
66    
67     object_unref (t);
68     }