From owner-freebsd-questions@FreeBSD.ORG Wed Jan 18 11:19:56 2006 Return-Path: X-Original-To: freebsd-questions@FreeBSD.org Delivered-To: freebsd-questions@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 65B4716A465 for ; Wed, 18 Jan 2006 11:19:54 +0000 (GMT) (envelope-from rolandromero@gmail.com) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.200]) by mx1.FreeBSD.org (Postfix) with ESMTP id 539EE43DBC for ; Wed, 18 Jan 2006 10:47:45 +0000 (GMT) (envelope-from rolandromero@gmail.com) Received: by wproxy.gmail.com with SMTP id i23so1642272wra for ; Wed, 18 Jan 2006 02:47:44 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type; b=TiSX8/iWyGqFEytg7vVdnwQw441cVD1jitbmCDZtGjIwkdx6zDNsrXDK4MQuhnjPHnLXvGBJO0poCfnpJcnfiTcFDhu1NwjyGeBwvlPwTz/WLYFaOWtxg/suLXt4VeDj29gIXciwTouOMvYxnhjQkqiZGAByFYJbc9VI5H++Dlk= Received: by 10.65.241.13 with SMTP id t13mr4696129qbr; Wed, 18 Jan 2006 02:47:43 -0800 (PST) Received: by 10.65.59.14 with HTTP; Wed, 18 Jan 2006 02:47:43 -0800 (PST) Message-ID: <607306ab0601180247t132f3cc6j@mail.gmail.com> Date: Wed, 18 Jan 2006 11:47:43 +0100 From: Roland Romero To: freebsd-questions@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: Subject: urgent, agir vite X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jan 2006 11:19:57 -0000 on dirait qu'il y a un bug l=E0 : http://www.fr.freebsd.org/cgi/search.cgi?max=3D25&source=3Dwww&words=3DTurb= oGX&submit=3DRechercher =E7a affiche tout le code perl ! de rien. Rol, fan de frib=E9hesd=E9 #!/usr/bin/perl -T # # mail-archive.pl -- a CGI interface to a wais indexed maling list archiv= e. # # Origin: # Tony Sanders , Nov 1993 # # Hacked beyond recognition by: # John Fieber , Nov 1994 # # Format the mail messages a little nicer. # Add code to check database status before searching. # John Fieber , Aug 1996 # # Disclaimer: # This is pretty ugly in places. # # $FreeBSD: www/en/cgi/search.cgi,v 1.26 2005/10/24 20:59:01 wosch Exp $ $server_root =3D '/usr/local/www'; $waisq =3D "/usr/local/www/bin/waisq"; $sourcepath =3D "$server_root/db/index"; $hints =3D "/search/searchhints.html"; $searchpage =3D '/search/search.html'; $myurl =3D $ENV{'SCRIPT_NAME'}; require "open2.pl"; require "./cgi-lib.pl"; require "./cgi-style.pl"; @months =3D ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); sub escape($) { $_ =3D $_[0]; s/&/&/g; s//>/g; $_; } sub do_wais { &ReadParse; @FORM_words =3D split(/ /, escape($in{"words"})); @FORM_source =3D split(/\0/, escape($in{"source"})); $FORM_max =3D $in{"max"}; $FORM_docnum =3D $in{"docnum"}; $FORM_index =3D $in{"index"}; if ($FORM_index =3D~ /^re[sc]ent$/) { =09$sourcepath =3D "$server_root/db/index-recent"; } if ($#FORM_words < 0) { =09print &html_header("Mail Archive Search") . =09 "

No search term given."; =09print "

\nPlease return to the " . =09 "search page and fill out the 'Search for' field!\n"; =09print &html_footer; =09exit 0; } @AVAIL_source =3D &checksource(@FORM_source); if ($#FORM_source !=3D $#AVAIL_source) { =09$j =3D 0; =09$k =3D 0; =09foreach $i (0 .. $#FORM_source) { =09 if ($FORM_source[$i] ne $AVAIL_source[$j]) { =09 =09$badsource[$k] =3D $FORM_source[$i]; =09 =09$k++; =09 } else { =09 =09$j++; =09 } =09} =09$badsource =3D join(", ", @badsource); =09$badsource =3D~ s/,([^,]*)$/ and $1/; =09if ($#FORM_source - $#AVAIL_source > 1) { =09 $availmsg =3D "

[The $badsource archives are currently unavailable.]

"; =09} else { =09 $availmsg =3D "

[The $badsource archive is currently unavailable.]

"; =09} } if ($#AVAIL_source < 0) { =09$i =3D join("
, ", @FORM_source); =09$i =3D~ s/,([^,]*)$/ and $1/; =09print &html_header("Mail Archive Search") . =09 "

None of the archives you requested ($i) are " . =09=09" available at this time.

\n"; =09print "

Please try again later, or return to the " . =09 "search page and select a different archive.

\n"; =09print &html_footer; =09exit 0; } # Now we formulate the question to ask the server foreach $i (@AVAIL_source) { =09$w_sources .=3D "(:source-id\n :filename \"$i.src\"\n ) = "; } $w_question =3D "\n (:question :version 2 :seed-words \"@FORM_words\" :relevant-documents ( ) :sourcepath \"$sourcepath/:\" :sources ( $w_sources ) :maximum-results $FORM_max :result-documents ( ) )\n"; # # First case, no document number so this is a regular search # print &html_header("Search Results"); print $availmsg; if ($#AVAIL_source > 0) { =09$src =3D join("
, ", @AVAIL_source); =09$src =3D~ s/,([^,]*)$/ and $1/; =09print "

The archives $src contain "; } else { =09print "The archive @AVAIL_source contains "; } print " the following items relevant to \`@FORM_words\':\n"; print "

    \n"; &open2(WAISOUT, WAISIN, $waisq, "-g"); print WAISIN $w_question; local(@mylist) =3D (); local($hits, $score, $headline, $lines, $bytes, $docid, $date, $file); while () { =09/:original-local-id.*#\(\s+([^\)]*)/ && =09 ($docid =3D pack("C*", split(/\s+/, $1)), =09 $docid =3D~ s/\s+/+/g); =09/:score\s+(\d+)/ && ($score =3D $1); =09/:filename "(.*)"/ && ($file =3D $1); =09/:number-of-lines\s+(\d+)/ && ($lines =3D $1); =09/:number-of-bytes\s+(\d+)/ && ($bytes =3D $1); =09/:headline "(.*)"/ && ($headline =3D $1, =09=09=09 $headline =3D~ s/[Rr]e://); # XXX =09/:date "(\d+)"/ && $docid !~ /\.src$/ && ($date =3D $1, $hits++, =09=09=09 push(@mylist, join("\t", $date, $headline, $docid, =09=09=09=09=09 $bytes, $lines, $file, $score, $hits))); } if ($in{'sort'} eq "date") { =09foreach (reverse sort {$a <=3D> $b} @mylist) { =09 ($date, $headline, $docid, $bytes, $lines, =09 $file, $score, $hits) =3D split("\t"); =09 &docdone; =09} } elsif ($in{'sort'} eq "subject") { =09local(@a, @c, $b, $d); =09foreach (@mylist) { =09 @a =3D split("\t"); =09 $b =3D $a[0]; =09 # swap date and subject =09 if ($a[1] =3D~ /(^[^:]+)(Re:.*)/) { =09=09$a[0] =3D "$2\t$1"; =09 } else { =09=09$a[0] =3D "$a[1]\t."; =09 } =09 $a[1] =3D $b; =09 push(@c, join("\t", @a)); =09} =09local($subject, $author); =09foreach (sort {$a cmp $b} @c) { =09 ($subject, $author, $date, $docid, $bytes, =09 $lines, $file, $score, $hits) =3D split("\t"); =09 $headline =3D $author . $subject; =09 &docdone; =09} } elsif ($in{'sort'} eq "author") { =09local(@a, @c, $b); =09foreach (@mylist) { =09 @a =3D split("\t"); =09 # swap date and subject =09 $b =3D $a[0]; $a[0] =3D $a[1]; $a[1] =3D $b; =09 push(@c, join("\t", @a)); =09} =09foreach (sort {$a cmp $b} @c) { =09 ($headline, $date, $docid, $bytes, =09 $lines, $file, $score, $hits) =3D split("\t"); =09 &docdone; =09} } else { =09foreach (@mylist) { =09 ($date, $headline, $docid, $bytes, =09 $lines, $file, $score, $hits) =3D split("\t"); =09 &docdone; =09} } #print qq[in: $in{'sort'}\n]; print "
\n"; print "

Didn't get what you expected? "; print "Look here for searching hints.

"; print qq{

Return to the search page

\n= }; if ($hits =3D=3D 0) { =09print "Nothing found.\n"; } print &html_footer; close(WAISOUT); close(WAISIN); }=09=09=09 # Given an array of sources (sans .src extension), this routine # checks to see if they actually exist, and if they do, if they # are currently available (ie, not being updated). It returns # an array of sources that are actually available. sub checksource { local (@sources) =3D @_; $j =3D 0; foreach $i (@sources) { =09if (stat("$sourcepath/$i.src")) { =09 if (!stat("$sourcepath/$i.update.lock")) { =09 =09$goodsources[$j] =3D $i; =09 =09$j++; =09 } =09} } return(@goodsources); } sub docdone { $file =3D~ s/\.src$//; if ($headline =3D~ /Search produced no result/) { =09print "

The archive $file contains no relevant documents.

= " } else { $headline =3D escape($headline); $headline =3D~ s/\\"/\"/g; if ($file eq "www" || $file =3D~ /^www-[a-z][a-z]$/ || $file eq 'pkgdescr' || $file eq "manpages") { print "
  • $headline\n"; } else { print "
  • $headline<= /a>\n"; } print "
    "; #=09print ""; =09print "Score: $score; "; =09$_ =3D $date; =09/(...?)(..)(..)/ && ($yr =3D $1 + 1900, $mo =3D $months[$2 - 1], $dy= =3D $3); =09print "Lines: $lines; "; =09print "${dy}-${mo}-${yr}; "; =09print "Archive: $file"; =09print "

  • \n"; } $score =3D $headline =3D $lines =3D $bytes =3D $docid =3D $date =3D $fi= le =3D ''; $yr =3D $mo =3D $dy =3D ''; } $| =3D 1; open (STDERR,"> /dev/null"); #open (STDERR,">> /tmp/search"); eval '&do_wais';