+ &::pSReply( &::formListReply(0, $prefix, @pkg) );
+}
+
+####
+# Usage: &searchDesc($query);
+sub searchDesc {
+ my ($dist, $query) = &getDistroFromStr($_[0]);
+ &::DEBUG("deb: searchDesc: dist => '$dist', query => '$query'.") if ($debug);
+ $query =~ s/^\s+|\s+$//g;
+
+ # start of search.
+ my $start_time = &::timeget();
+ &::status("Debian: starting desc search.");
+
+ my $files;
+ my ($bad,$good) = (0,0);
+ my %urls = %urlpackages;
+
+ foreach (keys %urlpackages) {
+ s/##DIST/$dist/g;
+
+ if (! -f "$debian_dir/$_" ) {
+ $bad++;
+ next;
+ }
+
+ $good++;
+ $files .= " $debian_dir/$_";
+ }
+
+ &::DEBUG("deb(2): good = $good, bad = $bad...") if ($debug);
+
+ if ($good == 0 and $bad != 0) {
+ my %urls = &fixDist($dist, %urlpackages);
+ &::DEBUG("deb: download 2c.") if ($debug);
+
+ if (!&DebianDownload($dist, %urls)) {
+ &::ERROR("deb: sD: could not download files.");
+ return;
+ }
+ }
+
+ my $regex = $query;
+ $regex =~ s/\./\\./g;
+ $regex =~ s/\*/\\S*/g;
+ $regex =~ s/\?/./g;
+
+ my (%desc, $package);
+ open(IN,"zegrep -h '^Package|^Description' $files |");
+ while (<IN>) {
+ if (/^Package: (\S+)$/) {
+ $package = $1;
+ } elsif (/^Description: (.*)$/) {
+ my $desc = $1;
+ next unless (eval { $desc =~ /$regex/i });
+ return unless &checkEval($@);
+
+ if ($package eq "") {
+ &::WARN("sD: package == NULL?");
+ next;
+ }
+
+ $desc{$package} = $desc;
+ $package = "";
+
+ } else {
+ &::WARN("debian: invalid line: '$_'. (2)");
+ }
+ }
+ close IN;
+
+ # show how long it took.
+ my $delta_time = &::timedelta($start_time);
+ &::status(sprintf("Debian: %.02f sec to complete query.", $delta_time)) if ($delta_time > 0);
+
+ return keys %desc;