#!/usr/bin/perl # $TOP_SRCDIR='../..'; open FHREPLY,"$TOP_SRCDIR/include/mod_ftp.h" or die "Cannot open FTP its mod_ftp.h: $!"; open FHCOMMAND,"$TOP_SRCDIR/modules/ftp/ftp_commands.c" or die "Cannot open FTP its ftp_commands.c: $!"; $t=scalar(gmtime(time)); $nr_of_resp = 0; $nr_of_req = 0; print qq|/* ftp_protocol.h * * Dynamicaly generated FTP request types and response types. * * Do not edit manually; but delete the file and do * another gmake (or a make ftp_protocol.h) */ |; while() { next unless m/^\#define/; if (m/^\#define\s+FTP_REPLY_(\w+)\s*(\d+)/) { $p{ $2 } = $1; $nr_of_resp++; }; }; @resp = (); while() { next unless m/\s*ftp_hook_cmd\(\"/; if (m/\s*ftp_hook_cmd\(\"/) { $nr_of_req++; s/\s*ftp_hook_cmd\(\"//g; s/\"(.+)//g; chop; next if index($_, ' ') > 0; push (@resp, $_); }; }; print qq| #define WWW_MIB_TOTAL_FTP_RESPONSES $nr_of_resp const int ftp_response_types[] = { |; map { print "$_, "; } sort { $a <=> $b } keys %p; print qq|0 }; #define WWW_MIB_TOTAL_FTP_REQUESTS $nr_of_req const char *ftp_request_types[] ={ |; map { print "\"$_\", "; } sort { $x = length($a) <=> length($b); return $x ? $x : (uc $a cmp uc $b); } @resp; print "NULL }; ";