//-----------------------------------------------------------------------------
// Copyright © 2003 - Philip Howard - All rights reserved
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307	 USA
//-----------------------------------------------------------------------------
// package	libh/cgi
// homepage	http://libh.slashusr.org/
//-----------------------------------------------------------------------------
// author	Philip Howard
// email	libh at ipal dot org
// homepage	http://phil.ipal.org/
//-----------------------------------------------------------------------------
// This file is best viewed using a fixed spaced font such as Courier
// and in a display at least 120 columns wide.
//-----------------------------------------------------------------------------
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

#define EXPORT_COMMON_GLOBAL_DATA

#include "cgi_lib.h"

__PROTO_BEGIN__
//-----------------------------------------------------------------------------
// function	cgi_form_fetch_init
//
// purpose	Initialize use of cgi_form_fetch functions.
//
// arguments	-none-
//
// returns	(int) -1 : error
//		(int)  0 : OK
//-----------------------------------------------------------------------------
int
cgi_form_fetch_init ()
__PROTO_END__
{    
    if ( cgi_form_state != 0 ) return -1;
    cgi_form_state = -1;
    if ( ! ( cgi_form_query_string_map = map_ca_new() ) ) return -1;
    if ( ! ( cgi_form_post_content_map = map_ca_new() ) ) return -1;
    if ( cgi_form_map( cgi_form_query_string_map, cgi_form_post_content_map ) < 0 ) return -1;
    cgi_form_state = 0;
    return 0;
}

