]>
jfr.im git - irc/quakenet/newserv.git/blob - chanserv/mkcommandlist.pl
18 print "Usage: $0 <module name>\n";
25 next if (/commandlist.c/);
28 my ($cn, $cl, $ca, $cd, $cf, $cp);
30 open INFILE
,"<$fname";
35 if (/CMDNAME: (.*)/) {
39 if (/CMDLEVEL: (.*)/) {
43 if (/CMDARGS: (.*)/) {
47 if (/CMDDESC: (.*)/) {
51 if (/CMDFUNC: (.*)/) {
55 if (/CMDPROTO: (.*)/) {
60 if (defined $cn and defined $cl and defined $ca and defined $cd and defined $cf and defined $cp) {
70 print "Warning: found source file $fname without complete tags, skipping...\n";
75 print "No commands found - are you in the right directory?\n";
76 print "Exiting before I destroy something important.\n";
81 open CL
, ">commandlist.c";
83 print CL
"/* Automatically generated by mkcommandlist.pl, do not edit. */\n\n";
84 print CL
"#include \"../chanserv.h\"\n\n";
87 print CL
"/* Prototypes */\n";
92 my @names2 = @cmdnames;
95 print CL
"\nvoid _init() {\n";
97 while (my $cn = shift @cmdnames) {
98 print CL
" chanservaddcommand(\"".$cn."\", ".(shift @cmdlevels).", ".(shift @cmdargs).", ";
99 print CL
(shift @cmdfunc).", \"".(shift @cmddesc)."\");\n";
102 print CL
"}\n\nvoid _fini() {\n";
104 while (my $cn = shift @names2) {
105 print CL
" chanservremovecommand(\"".$cn."\", ".(shift @func2).");\n";
114 print MF
"# Automatically generated Makefile, do not edit.\n\n";
116 print MF
".PHONY: all Makefile\n";
118 print MF
"all: Makefile $modname\n\n";
120 print MF
"Makefile:\n";
121 print MF
"\t../mkcommandlist.pl $modname\n";
123 print MF
"\n$modname: ";
125 push @files,"commandlist.c";
133 print MF
"\t ld -shared -Bdynamic -o \$\@ \$\^ \n";