Greetings,

When called from command line, htsearch defaults to interactive
mode.  If used in a PHP wrapper, one has to call htsearch via
a shell script that sets REQUEST_METHOD and QUERY_STRING (the
putenv() function of PHP does not work with exec()).

The attached patch to htsearch.cc significantly speeds up the
search from within wrappers (such as the PHP wrapper in the
contrib section) by setting REQUEST_METHOD to "GET" and
QUERY_STRING to the value of av[optind] if (optind < ac)
after the options have been processed.


cheers,
  Torsten

--
InWise - Wirtschaftlich-Wissenschaftlicher Internet Service GmbH
Waldhofstra�e 14                            Tel: +49-4101-403605
D-25474 Ellerbek                            Fax: +49-4101-403606
E-Mail: [EMAIL PROTECTED]            Internet: http://www.inwise.de

*** htsearch.cc~        Wed Jun 16 10:36:07 1999
--- htsearch.cc Wed Jun 16 10:53:41 1999
***************
*** 91,96 ****
--- 91,100 ----
                  break;
        }
       }
+      if( optind < ac ) {
+          setenv("REQUEST_METHOD","GET",1);
+          setenv("QUERY_STRING",av[optind],1);
+      }
  
      //
      // The total search can NEVER take more than 5 minutes.
***************
*** 688,694 ****
  //
  void usage()
  {
!   cout << "usage: htsearch [-v][-d][-c configfile]\n";
    cout << "This program is part of ht://Dig " << VERSION << "\n\n";
    cout << "Options:\n";
    cout << "\t-v -d\tVerbose mode.  This increases the verbosity of the\n";
--- 692,698 ----
  //
  void usage()
  {
!   cout << "usage: htsearch [-v][-d][-c configfile][query_string]\n";
    cout << "This program is part of ht://Dig " << VERSION << "\n\n";
    cout << "Options:\n";
    cout << "\t-v -d\tVerbose mode.  This increases the verbosity of the\n";

Reply via email to