Subject: htdig: Bug in htsearch exclude option
     To: htdig@sdsu.edu
   From: mark@rhino.nlm.nih.gov (Mark Silverman)
   Date: Thu, 26 Jun 1997 16:40:49 -0400


I believe I have uncovered 2 bugs in htsearch.

The first bug, sets the string value "excludeFrom" to an
undefined value of "exclude_these"  when the exclude option
is omitted.  This can be corrected by the following modification
to htsearch.cc:


<     display.setExclude(&exclude_these);
---
>     if (input.exists("exclude"))
>          display.setExclude(&exclude_these);


The second bug, masks the effects of the first, unless you
use the exclude option (in which case only URLs that match
the exclude pattern are displayed).  This problem can be
corrected in Display.cc as follows:


Original Code:

     int
     Display::includeURL(char *url)     
     {
          if (limitTo && limitTo->FindFirst(url) < 0)
          {
               return 0;
          }
          else
          {   
               if (excludeFrom && excludeFrom->FindFirst(url) < 0)
                    return 0;
               else
                    return 1;
          }
     }
     
My suggested correction:


     int
     Display::includeURL(char *url)     
     {
          if (limitTo && limitTo->FindFirst(url) < 0)
          {
               return 0;
          }
          else if (excludeFrom)
          {
               return (excludeFrom->FindFirst(url) < 0);
          }
         return 1;
     }
     


                                Mark Silverman
                                National Library of Medicine
                                mark@nlm.nih.gov
