void htmlescape(str)
char *str;
{
char tmp[1024],*i,*o;
i=str;
o=tmp;
while(*i){
  switch(*i){
  case '<':
    strcpy(o,"&lt;");
    o += 4;
    break;
  case '&':
    strcpy(o,"&amp;");
    o += 5;
    break;
  case '>':
    strcpy(o,"&gt;");
    o += 4;
    break;
  default:
    *(o++) = *i;
    break;
  };
  i++;
};
*o = 0;
strcpy(str,tmp);
}
