[BACK]Return to cgi.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/cgi.c between version 1.66 and 1.67

version 1.66, 2014/07/12 17:21:45 version 1.67, 2014/07/12 18:32:47
Line 33 
Line 33 
 #include "main.h"  #include "main.h"
 #include "manpath.h"  #include "manpath.h"
 #include "mansearch.h"  #include "mansearch.h"
   #include "cgi.h"
   
 /*  /*
  * A query as passed to the search function.   * A query as passed to the search function.
Line 78  static void   resp_search(const struct req *,
Line 79  static void   resp_search(const struct req *,
 static  void             resp_searchform(const struct req *);  static  void             resp_searchform(const struct req *);
   
 static  const char       *scriptname; /* CGI script name */  static  const char       *scriptname; /* CGI script name */
 static  const char       *mandir; /* contains all manpath directories */  
 static  const char       *cssdir; /* css directory */  
 static  const char       *httphost; /* hostname used in the URIs */  static  const char       *httphost; /* hostname used in the URIs */
   
 /*  /*
Line 314  resp_begin_html(int code, const char *msg)
Line 313  resp_begin_html(int code, const char *msg)
                " TYPE=\"text/css\" media=\"all\">\n"                 " TYPE=\"text/css\" media=\"all\">\n"
                "<LINK REL=\"stylesheet\" HREF=\"%s/man.css\""                 "<LINK REL=\"stylesheet\" HREF=\"%s/man.css\""
                " TYPE=\"text/css\" media=\"all\">\n"                 " TYPE=\"text/css\" media=\"all\">\n"
                "<TITLE>System Manpage Reference</TITLE>\n"                 "<TITLE>%s</TITLE>\n"
                "</HEAD>\n"                 "</HEAD>\n"
                "<BODY>\n"                 "<BODY>\n"
                "<!-- Begin page content. //-->\n",                 "<!-- Begin page content. //-->\n",
                cssdir, cssdir);                 CSS_DIR, CSS_DIR, CUSTOMIZE_TITLE);
 }  }
   
 static void  static void
Line 334  resp_searchform(const struct req *req)
Line 333  resp_searchform(const struct req *req)
 {  {
         int              i;          int              i;
   
           puts(CUSTOMIZE_BEGIN);
         puts("<!-- Begin search form. //-->");          puts("<!-- Begin search form. //-->");
         printf("<DIV ID=\"mancgi\">\n"          printf("<DIV ID=\"mancgi\">\n"
                "<FORM ACTION=\"%s\" METHOD=\"get\">\n"                 "<FORM ACTION=\"%s\" METHOD=\"get\">\n"
Line 391  resp_index(const struct req *req)
Line 391  resp_index(const struct req *req)
 {  {
   
         resp_begin_html(200, NULL);          resp_begin_html(200, NULL);
         puts("<H1>\n"  
              "Online manuals with "  
              "<A HREF=\"http://mdocml.bsd.lv/\">mandoc</A>\n"  
              "</H1>");  
         resp_searchform(req);          resp_searchform(req);
         printf("<P>\n"          printf("<P>\n"
                "This web interface is documented in the "                 "This web interface is documented in the "
Line 801  main(void)
Line 797  main(void)
   
         /* Scan our run-time environment. */          /* Scan our run-time environment. */
   
         if (NULL == (mandir = getenv("MAN_DIR")))  
                 mandir = "/man";  
   
         if (NULL == (scriptname = getenv("SCRIPT_NAME")))          if (NULL == (scriptname = getenv("SCRIPT_NAME")))
                 scriptname = "";                  scriptname = "";
   
         if (NULL == (cssdir = getenv("CSS_DIR")))  
                 cssdir = "";  
   
         if (NULL == (httphost = getenv("HTTP_HOST")))          if (NULL == (httphost = getenv("HTTP_HOST")))
                 httphost = "localhost";                  httphost = "localhost";
   
         /*          /*
          * First we change directory into the mandir so that           * First we change directory into the MAN_DIR so that
          * subsequent scanning for manpath directories is rooted           * subsequent scanning for manpath directories is rooted
          * relative to the same position.           * relative to the same position.
          */           */
   
         if (-1 == chdir(mandir)) {          if (-1 == chdir(MAN_DIR)) {
                 fprintf(stderr, "MAN_DIR: %s: %s\n",                  fprintf(stderr, "MAN_DIR: %s: %s\n",
                     mandir, strerror(errno));                      MAN_DIR, strerror(errno));
                 resp_error_internal();                  resp_error_internal();
                 return(EXIT_FAILURE);                  return(EXIT_FAILURE);
         }          }

Legend:
Removed from v.1.66  
changed lines
  Added in v.1.67

CVSweb