#include <stdio.h>
#include <string.h>
#include <time.h>

#include "global.h"


#include "manhat-lib/shared_util.h"
#include "manhat-lib/shared_cs_util.h"
#include "manhat-lib/shared_server_string.h"



static void
read_parameters (char *class_name)
{
 cs_get_optional_parameter("class", class_name, MAX_FILENAME);   /* shared_cs_util.c */
}




static void
set_basic_login_values()
{

  char server_string[MAX_PATH + 1];
  char form_action[MAX_PATH + 1];
  
    
  get_server_string(server_string, MAX_PATH + 1);   	/* shared_server_string.h */
  snprintf(form_action, MAX_PATH + 1, "%s/%s/%s", 
  					server_string, ALIAS, "login");
  cs_set_value("action", form_action);    		/* shared_cs_util.h */
   
  cs_set_int_value("max_username", MAX_USERNAME);   /* shared_cs_util.h */
  cs_set_int_value("max_password", MAX_PASSWORD);   /* shared_cs_util.h */
  cs_set_value("manhattan_version", VERSION);       /* shared_cs_util.h */
}


int
main ()
{
  char class_name[MAX_FILENAME + 1];	/* optional name of class as passed to program */
  CONFIG_STRUCT conf;

  cs_cgi_init();                        /* shared_cs_util.c */
  read_parameters(class_name);
  
  set_basic_login_values();
    
  if(*class_name)
   {
    read_configuration_file (class_name, &conf);   	/* shared_util.c */
    cs_set_course_info(&conf);  			/* shared_cs_util.c */
    cs_set_value("class", class_name);  		/* shared_cs_util.c */
   }

   cs_cgi_display ("doorstep", 1);    			/* shared_cs_util.c */
  cs_cgi_destroy();        				/* shared_cs_util.c */
  return 0;

}



