# ftpsearch.pl - gateway to ftpd's site index feature # # $Id: $ # $map{'ftpsearch'} = '&do_ftpsearch($rest,$query)'; do 'sys/socket.ph'; require 'ftp.pl'; package ftpsearch; sub main'do_ftpsearch { local($args,$query) = @_; local($thathost, $thatport); ($thathost, $thatport) = split(/:/,$args,2); if ($thathost =~ /\d+\.\d+\.\d+\.\d+/) { # $thathost is numerical ip address ($name, $aliases, $type, $len, $thataddr) = gethostbyaddr(pack('C4', split(/\./,$thathost)),&main'AF_INET); $bestname = $name; } else { # $thathost seems to be an FQDN ($name, $aliases, $type, $len, $thataddr) = gethostbyname("$thathost"); $bestname=$thathost; } if ($query eq "") { # query is empty, send an empty query sheet print "