Re: [htdig] patch for boolean keywords


Subject: Re: [htdig] patch for boolean keywords
From: Gilles Detillieux (grdetil@scrc.umanitoba.ca)
Date: Fri May 05 2000 - 08:42:08 PDT


According to Alexey Rodriguez:
> I am releasing a patch for choosing boolean keywords from
> configuration file. The attribute should look like:
>
> boolean_keywords: and or not
>
> If you don't put anything it doesn't matter what is the default
> value. For example i use:
>
> boolean_keywords: y o no
>
> The error messages are still in english. Any suggestions are
> welcome and i expect that i did not break anything. ;)

The only problem I can see is if the user enters more than 3 strings
in the boolean_keywords string list, it will overflow the String array.
You should probably add a test in the loop to avoid this. E.g.:

> + String boolean_keywords[3];
> +
> + void load_boolean_keywords()
> + {
> + String temp=config["boolean_keywords"];
> + char *w=strtok(temp," \t");
> + int i=0;
> + while(w) {
  
          if (i<3) { // don't go out of bounds
  
> + boolean_keywords[i]=w;
> + boolean_keywords[i].lowercase();
  
          }
  
> + w=strtok(NULL," \t");
> + i++;
> + }
> + if(i!=3) {
> + reportError("boolean_keywords is not correctly specified");
> + }
> + }

-- 
Gilles R. Detillieux              E-mail: <grdetil@scrc.umanitoba.ca>
Spinal Cord Research Centre       WWW:    http://www.scrc.umanitoba.ca/~grdetil
Dept. Physiology, U. of Manitoba  Phone:  (204)789-3766
Winnipeg, MB  R3E 3J7  (Canada)   Fax:    (204)789-3930

------------------------------------ To unsubscribe from the htdig mailing list, send a message to htdig-unsubscribe@htdig.org You will receive a message to confirm this.



This archive was generated by hypermail 2b28 : Fri May 05 2000 - 06:29:37 PDT