//******************************************************************************
// ReadParse.h
// Copyright 1999 by Gottfried Rudorfer
//
// E-Mail: Gottfried.Rudorfer@ai.wu-wien.ac.at
//
// All rights reserved.
//******************************************************************************

// Documentation: ***************************************************************
// VARIABLES:
// in .... map of key/value pairs
//******************************************************************************


#include <iostream>
#include <fstream>
#include <string>
#include <map>
#include <new>

using namespace std;

extern "C"
{
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
}

// characters that we accept (according to CERT)
const char _ok_chars[] = "abcdefghijklmnopqrstuvwxyz\
ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890_-+.@%=&";

typedef map<string,string> StringStringMap;

void CgiNoSpace();

class ReadParse 
{
public:
  ReadParse();
  ~ReadParse();
  void PrintHeader();
  string EvalString(const string);
  string EvalFile(const string);
  void Mygetenv(char*);
  StringStringMap in;
  int strnicmp(const char *s1, const char *s2, const int count);
  int HexToChar(char *strptr, char &thechar);
private:
  void Parse();
  char *_html_string;
  int _has_parsed;
  string Line(const string& text, const string::size_type pos);
  char *_env_string;
  char *CertFix(char*); 
};

