/* HTMLentities.c
 * $Id$
 */

#include "HTMLentities.h"

#include <string.h>

struct _entity_declaration HTML_entities[] ={
  {"lt", '<'},
  {"gt", '>'},
  {"amp", '&'},
  {"quot", '"'},
  {"apos", '\''},
  {0},
};

int
  HTML_expand_entity(entities, name, val)
VOIDPTR entities;
CONST char* name;
char* val;
{
  struct _entity_declaration *ed;
  for(ed = (struct _entity_declaration*)entities;
      ed->name;
      ed++){
    if(strcmp(name, ed->name) == 0){
      *val = ed->value;
      return sizeof(char);
    }
  }
  return 0; /* error: undefined entity */
}