** 1.6 : Added "point" datatype: the nearest point wins. Overrides "default".
**
** 08/28/94: Carlos Varela, cvarela@ncsa.uiuc.edu
**
** 1.7 : Fixed bug: virtual URLs are now understood.
** Better error reporting when not able to open configuration file.
**
** 03/07/95: Carlos Varela, cvarela@ncsa.uiuc.edu
**
** 1.8 : Fixed bug (strcat->sprintf) when reporting error.
** Included getline() function from util.c in NCSA httpd distribution.
**
** 20/10/95: Stewart Brodie, s.n.brodie@ecs.soton.ac.uk
**
** 1.9 : Port to Acorn RISC OS and changes for my own HTTPServer
** It isn't pretty but that's not the point
**
*/
#include <stdio.h>
#include <string.h>
#if !defined(pyr) && !defined(NO_STDLIB_H)
#include <stdlib.h>
#else
#include <sys/types.h>
#include <ctype.h>
char *getenv();
#endif
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#include <arpa/inet.h>
#define RCONF_FILE "<HTTPServer$Dir>.imap_"
#define MAXLINE 500
#define MAXVERTS 100
#define X 0
#define Y 1
#define LF 10
#define CR 13
static int sockid = -1;
static char *myhost = NULL;
struct sockaddr_in osin;
int isname(char);
int getline(char *s, int n, FILE *f);
int pointinpoly(double point[2], double pgon[MAXVERTS][2]);
int pointinrect(double point[2], double coords[MAXVERTS][2]);
int pointincircle(double point[2], double coords[MAXVERTS][2]);
void sendmesg(char *url);
void servererr(char *msg)
{
#define CSTRANDLEN(obj) obj,sizeof(obj)-1
#define STRANDLEN(obj) obj, strlen(obj)
send(sockid, CSTRANDLEN("HTTP/1.0 500 Server Error\nContent-type: text/html\n\n<title>Mapping Server Error</title><h1>Mapping Server Error</h1>This server encountered an error:<p>"), 0);