Add DOCTYPE and `Status:' header to man2html

diff -ruN -x config.guess -x config.sub man-1.6e-old/man2html/man2html.c man-1.6e/man2html/man2html.c
--- man-1.6e-old/man2html/man2html.c	2007-01-31 01:29:30.000000000 +0100
+++ man-1.6e/man2html/man2html.c	2007-01-31 01:29:30.000000000 +0100
@@ -27,6 +27,8 @@
 #define BD_INDENT   2
 
 #define SIZE(a)	(sizeof(a)/sizeof(*a))
+#define DOCTYPE "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n"
+#define CONTENTTYPE "Content-type: text/html\n\n"
 
 static char NEWLINE[2]="\n";
 static char idxlabel[6] = "ixAAA";
@@ -1848,6 +1850,7 @@
 		    if (!t) t=fname;
 		    fprintf(stderr, "ln -s %s.html %s.html\n", h, t);
 		    s=strrchr(t, '.');if (!s) s=t;
+		    printf(CONTENTTYPE DOCTYPE);
 		    printf("<HTML><HEAD><TITLE> Man page of %s</TITLE>\n"
 			   "</HEAD><BODY>\n"
 			   "See the man page for <A HREF=\"%s.html\">%s</A>.\n"
@@ -2102,6 +2105,7 @@
 		*sl = 0;
 		if (words > 1) {
 		    output_possible=1;
+		    printf(CONTENTTYPE DOCTYPE);
 		    out_html("<HTML><HEAD><TITLE>Man page of ");
 		    out_html(wordlist[0]);
 		    out_html("</TITLE>\n</HEAD><BODY>\n<H1>");
@@ -3001,9 +3005,25 @@
 STRDEF *foundpages=NULL;
 
 static void
-error_page(char *s, char *t, ...) {
+error_page(int status, char *s, char *t, ...) {
      va_list p;
 
+     switch(status) {
+	case 403:
+		printf("Status: 403 Forbidden\n");
+		break;
+	case 404:
+		printf("Status: 404 Not Found\n");
+		break;
+	case 500:
+		printf("Status: 500 Internal Server Error\n");
+		break;
+	case 0:
+	default:
+		break;
+     }
+	     
+     printf(CONTENTTYPE DOCTYPE);
      printf("<HTML><HEAD><TITLE>%s</TITLE></HEAD>\n"
 	    "<BODY>\n<H1>%s</H1>\n", s, s);
      va_start(p, t);
@@ -3017,7 +3037,7 @@
 xstrdup(const char *s) {
      char *p = strdup(s);
      if (p == NULL)
-	  error_page("Out of memory",
+	  error_page(500, "Out of memory",
 			 "Sorry, out of memory, aborting...\n");
      return p;
 }
@@ -3026,7 +3046,7 @@
 xmalloc(size_t size) {
      void *p = malloc(size);
      if (p == NULL)
-	  error_page("Out of memory",
+	  error_page(500, "Out of memory",
 			 "Sorry, out of memory, aborting...\n");
      return p;
 }
@@ -3035,14 +3055,14 @@
 xrealloc(void *ptr, size_t size) {
      void *p = realloc(ptr,size);
      if (p == NULL)
-	  error_page("Out of memory",
+	  error_page(500, "Out of memory",
 			 "Sorry, out of memory, aborting...\n");
      return p;
 }
 
 static void
 usage(void) {
-     error_page("man2html: bad invocation",
+     error_page(500, "man2html: bad invocation",
 	"Call: man2html [-l|-h host.domain:port] [-p|-q] [filename]\n"
 	"or:   man2html -r [filename]\n");
 }
@@ -3095,7 +3115,7 @@
     extern char *optarg;
 #endif
 
-    printf("Content-type: text/html\n\n");
+/*    printf("Content-type: text/html\n\n"); */
 
     opterr = 0;			/* no stderr error messages */
     while ((c = getopt (argc, argv, "D:E:hH:lL:M:pqr?vVf")) != -1) {
@@ -3103,7 +3123,7 @@
 	 case 'D':
 	      goto_dir(optarg, 0, 0); break;
 	 case 'E':
-	      error_page("Error", "%s", optarg); break;
+	      error_page(0, "Error", "%s", optarg); break;
 	 case 'h':
 	      set_cgibase("localhost"); break;
 	 case 'H':
@@ -3122,7 +3142,7 @@
 	      set_relative_html_links(); break;
 	 case 'v':
 	 case 'V':
-	      error_page("Version", "%s from man-%s", argv[0], version);
+	      error_page(0, "Version", "%s from man-%s", argv[0], version);
 	      exit(0);
 	 case '?':
 	 default:
@@ -3154,7 +3174,7 @@
 
 	 f = fopen(fnam, "r");
 	 if (f == NULL)
-	      error_page("File not found", "Could not open %s\n", filename);
+	      error_page(404, "File not found", "Could not open %s\n", filename);
 	 fname = fnam;
     }
 
@@ -3222,14 +3242,14 @@
 	if (!filename)
 	     filename = fname;
 	if (*filename == '/')
-	     error_page("Invalid Man Page",
+	     error_page(403, "Invalid Man Page",
 		   "The requested file %s is not a valid (unformatted) "
 		   "man page.\nIf the file is a formatted man page, "
 		   "you could try to load the\n"
 		   "<A HREF=\"file://localhost%s\">plain file</A>.\n",
 		   filename, filename);
 	else
-	     error_page("Invalid Man Page",
+	     error_page(403, "Invalid Man Page",
 		   "The requested file %s is not a valid (unformatted) "
 		   "man page.", filename);
     }
