"Fossies" - the Fresh Open Source Software Archive

Member "mod_ftp-0.9.6/modules/ftp/remake_ftp_protocol" (14 Jul 2009, 1301 Bytes) of package /linux/www/apache_httpd_modules/old/mod_ftp-0.9.6-beta.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/perl
    2 #
    3 $TOP_SRCDIR='../..';
    4 
    5 open FHREPLY,"$TOP_SRCDIR/include/mod_ftp.h"
    6     or die "Cannot open FTP its mod_ftp.h: $!";
    7 open FHCOMMAND,"$TOP_SRCDIR/modules/ftp/ftp_commands.c"
    8     or die "Cannot open FTP its ftp_commands.c: $!";
    9 
   10 $t=scalar(gmtime(time));
   11 $nr_of_resp = 0;
   12 $nr_of_req = 0;
   13 
   14 print qq|/* ftp_protocol.h
   15  *
   16  * Dynamicaly generated FTP request types and response types.
   17  *
   18  * Do not edit manually; but delete the file and do
   19  * another gmake (or a make ftp_protocol.h)
   20  *
   21  * Generated from $TOP_SRCDIR on 
   22  * $t
   23  */
   24 |;
   25 
   26 while(<FHREPLY>) {
   27     next unless m/^\#define/;
   28     if (m/^\#define\s+FTP_REPLY_(\w+)\s*(\d+)/) {
   29         $p{ $2 } = $1;
   30         $nr_of_resp++;
   31     };
   32 };
   33 
   34 @resp = ();
   35 
   36 while(<FHCOMMAND>) {
   37     next unless m/\s*ftp_hook_cmd\(\"/;
   38     if (m/\s*ftp_hook_cmd\(\"/) {
   39         $nr_of_req++;
   40         s/\s*ftp_hook_cmd\(\"//g;
   41         s/\"(.+)//g;
   42         chop;
   43         next if index($_, ' ') > 0;
   44         push (@resp, $_);
   45     };
   46 };
   47 
   48 
   49 
   50 print qq|
   51 
   52 #define WWW_MIB_TOTAL_FTP_RESPONSES $nr_of_resp
   53 
   54 const int ftp_response_types[] = {
   55     |;
   56 
   57 map {
   58     print "$_, ";
   59     } sort { $a <=> $b } keys %p;
   60 
   61 print qq|0 }; 
   62 
   63 #define WWW_MIB_TOTAL_FTP_REQUESTS $nr_of_req
   64 
   65 const char *ftp_request_types[] ={
   66     |;
   67 map {
   68     print "\"$_\", ";
   69     } sort { 
   70         $x = length($a) <=> length($b);
   71         return $x ? $x : (uc $a cmp uc $b);
   72         } @resp;
   73 print "NULL };
   74 
   75 ";