#include <stdio.h>
#include <stdlib.h>

void print_help() {
  fprintf(stderr,"%s",
	"webbymain -c <cfg_file> [ -v <vhost_definition> ] * [ -f <filter_definition> ] * [ -s <servlet_definition> ] *\n"
	"\n"
	"Starts webby http server.\n"
	"\n"
	"OPTIONS:\n"
	"\n"
	"-c <cfg_file>\n"
	"  the configuration file. This parameter is mandatory,\n"
	"  it also has to be the first command line option.\n"
	"  for format of file see CONFIGURATION FILE section\n"
	"\n"
	"-v <hostname>[,<port number>]\n"
	"  defines a new virtual host. This parameter is optional\n"
	"  If no virtual hosts are defined, then all values of HTTP header Host are accepted.\n"
	"  If there are virtual hosts, the nonly those values that match a virtual host definition\n"
	"  are accepted.\n"
	"  The first virtual host will be refered to as virtual host Id 0, the second as\n"
	"  virtual host Id 1, etc.\n"
	"\n"
	"-f [<virtual host id>],<shared library name>[,<filter factory function>]\n"
	"  instantiate a filter object from shared library and add it to the processing chain.\n"
	"\n"
	"  <virtual host id>	    - (optional) the virutal host id that the filter will be added to.\n"
	"  <shared library name>     - file name of shared library that hosts this filter.\n"
	"  <filter factory function> - (optional) the exported function name that creates the filter.\n"
	"    If this parameter is ommited then factory function load_filter is assumed.\n"
	"\n"
	"-s <shared library name>[,<servlet factory function>]\n"
	"  instantiate a servlet object from shared library and add it to the processing chain.\n"
	"\n"
	"  <shared library name>     - file name of shared library that hosts this shared library\n"
	"  <filter factory function> - (optional) the exported function name that creates the servlet.\n"
	"\n"
	"  If this parameter is ommited then factory function load_servlet is assumed.\n"
	"\n"
	"\n"
	"CONFIGURATION FILE\n"
	"\n"
	"An example configuration file:\n"
	"\n"
	"-------------------------------------------------------------------\n"
	"\n"
	"#  listening on the following interface (0.0.0.0 on all interfaces)\n"
	"host=0.0.0.0\n"
	"\n"
	"# listening address\n"
	"port=12321\n"
	"\n"
	"# backlog of accepted connections (accept(2) parameter)\n"
	"listen_backlog=30\n"
	"\n"
	"# read and write buffer sizes of connections\n"
	"socket_buffer_size=8192\n"
	"\n"
	"# maximum number of serviced connections.\n"
	"max_connections=300\n"
	"\n"
	"# read / write timeout (in seconds)\n"
	"io_timeout=30\n"
	"\n"
	"# connection idle timeout (in seconds)\n"
	"idle_timeout=300\n"
	"\n"
	"# size of the thread stack in memory pages.\n"
	"stack_pages_per_thread=8\n"
	"\n"
	"\n"
	"\n"
	"\n"
  );
  exit(1);
}  
