]>
jfr.im git - irc/quakenet/newserv.git/blob - chanserv/mkcommandlist.pl
19 print "Usage: $0 <module name>\n";
26 next if (/commandlist.c/);
29 my ($cn, $cl, $ca, $cd, $cf, $cp, $ch);
32 open INFILE
,"<$fname";
37 if (/CMDNAME: (.*)/) {
41 if (/CMDLEVEL: (.*)/) {
45 if (/CMDARGS: (.*)/) {
49 if (/CMDDESC: (.*)/) {
53 if (/CMDFUNC: (.*)/) {
57 if (/CMDPROTO: (.*)/) {
61 if (/CMDHELP: (.*)/) {
66 if (defined $cn and defined $cl and defined $ca and defined $cd and defined $cf and defined $cp) {
77 print "Warning: found source file $fname without complete tags, skipping...\n";
82 print "No commands found - are you in the right directory?\n";
83 print "Exiting before I destroy something important.\n";
88 open CL
, ">commandlist.c";
90 print CL
"/* Automatically generated by mkcommandlist.pl, do not edit. */\n\n";
91 print CL
"#include \"../chanserv.h\"\n\n";
94 print CL
"/* Prototypes */\n";
99 my @names2 = @cmdnames;
100 my @func2 = @cmdfunc;
102 print CL
"\nvoid _init() {\n";
104 while (my $cn = shift @cmdnames) {
105 print CL
" chanservaddcommand(\"".$cn."\", ".(shift @cmdlevels).", ".(shift @cmdargs).", ";
106 print CL
(shift @cmdfunc).", \"".(shift @cmddesc)."\", \"".(shift @help),"\");\n";
109 print CL
"}\n\nvoid _fini() {\n";
111 while (my $cn = shift @names2) {
112 print CL
" chanservremovecommand(\"".$cn."\", ".(shift @func2).");\n";
121 print MF
"# Automatically generated Makefile, do not edit.\n\n";
123 print MF
".PHONY: all Makefile\n";
125 print MF
"all: Makefile $modname\n\n";
127 print MF
"Makefile:\n";
128 print MF
"\t../mkcommandlist.pl $modname\n";
130 print MF
"\n$modname: ";
132 push @files,"commandlist.c";
140 print MF
"\t ld -shared -Bdynamic -o \$\@ \$\^ \n";