]>
jfr.im git - irc/quakenet/newserv.git/blob - chanserv/mkcommandlist.pl
19 print "Usage: $0 <module name>\n";
27 $smallname=~s/\.so$//;
30 $cname=$smallname . ".c";
31 $smallname=~s/^chanserv_//;
35 next if (/commandlist.c/);
36 next if ($_ eq $cname);
39 my ($cn, $cl, $ca, $cd, $cf, $cp, $ch);
42 open INFILE
,"<$fname";
47 if (/CMDNAME: (.*)/) {
51 if (/CMDLEVEL: (.*)/) {
55 if (/CMDARGS: (.*)/) {
59 if (/CMDDESC: (.*)/) {
63 if (/CMDFUNC: (.*)/) {
67 if (/CMDPROTO: (.*)/) {
71 if (/CMDHELP: (.*)/) {
76 if (defined $cn and defined $cl and defined $ca and defined $cd and defined $cf and defined $cp) {
87 print "Warning: found source file $fname without complete tags, skipping...\n";
92 print "No commands found - are you in the right directory?\n";
93 print "Exiting before I destroy something important.\n";
98 open CL
, ">commandlist.c";
100 print CL
"/* Automatically generated by mkcommandlist.pl, do not edit. */\n\n";
101 print CL
"#include \"../chanserv.h\"\n\n";
104 print CL
"/* Prototypes */\n";
109 my @names2 = @cmdnames;
110 my @func2 = @cmdfunc;
112 print CL
"void ".$smallname."_init(void);\n";
113 print CL
"void ".$smallname."_fini(void);\n\n";
115 print CL
"\nvoid _init() {\n";
116 print CL
" ".$smallname."_init();\n";
118 while (my $cn = shift @cmdnames) {
119 print CL
" chanservaddcommand(\"".$cn."\", ".(shift @cmdlevels).", ".(shift @cmdargs).", ";
120 print CL
(shift @cmdfunc).", \"".(shift @cmddesc)."\", \"".(shift @help),"\");\n";
123 print CL
"}\n\nvoid _fini() {\n";
124 print CL
" ".$smallname."_fini();\n";
126 while (my $cn = shift @names2) {
127 print CL
" chanservremovecommand(\"".$cn."\", ".(shift @func2).");\n";
134 open MF
,">autobuild.mk";
136 print MF
"# Automatically generated Makefile, do not edit.\n";
138 print MF
"\n$modname: ";
140 push @files,"commandlist.c";