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

Diff for /mandoc/cgi.c between version 1.59 and 1.62

version 1.59, 2014/07/09 16:23:01 version 1.62, 2014/07/11 22:25:44
Line 314  resp_begin_http(int code, const char *msg)
Line 314  resp_begin_http(int code, const char *msg)
 {  {
   
         if (200 != code)          if (200 != code)
                 printf("Status: %d %s\n", code, msg);                  printf("Status: %d %s\r\n", code, msg);
   
         puts("Content-Type: text/html; charset=utf-8\n"          printf("Content-Type: text/html; charset=utf-8\r\n"
              "Cache-Control: no-cache\n"               "Cache-Control: no-cache\r\n"
              "Pragma: no-cache\n"               "Pragma: no-cache\r\n"
              "");               "\r\n");
   
         fflush(stdout);          fflush(stdout);
 }  }
Line 367  resp_searchform(const struct req *req)
Line 367  resp_searchform(const struct req *req)
                "<FIELDSET>\n"                 "<FIELDSET>\n"
                "<LEGEND>Search Parameters</LEGEND>\n"                 "<LEGEND>Search Parameters</LEGEND>\n"
                "<INPUT TYPE=\"submit\" "                 "<INPUT TYPE=\"submit\" "
                " VALUE=\"Search\"> for manuals satisfying \n"                 " VALUE=\"Search\"> for manuals matching \n"
                "<INPUT TYPE=\"text\" NAME=\"expr\" VALUE=\"",                 "<INPUT TYPE=\"text\" NAME=\"expr\" VALUE=\"",
                scriptname);                 scriptname);
         html_print(req->q.expr ? req->q.expr : "");          html_print(req->q.expr ? req->q.expr : "");
Line 381  resp_searchform(const struct req *req)
Line 381  resp_searchform(const struct req *req)
         html_print(req->q.arch ? req->q.arch : "");          html_print(req->q.arch ? req->q.arch : "");
         printf("\">");          printf("\">");
         if (req->psz > 1) {          if (req->psz > 1) {
                 puts(", <SELECT NAME=\"manpath\">");                  puts(", in <SELECT NAME=\"manpath\">");
                 for (i = 0; i < (int)req->psz; i++) {                  for (i = 0; i < (int)req->psz; i++) {
                         printf("<OPTION ");                          printf("<OPTION ");
                         if (NULL == req->q.manpath ? 0 == i :                          if (NULL == req->q.manpath ? 0 == i :
Line 395  resp_searchform(const struct req *req)
Line 395  resp_searchform(const struct req *req)
                 }                  }
                 puts("</SELECT>");                  puts("</SELECT>");
         }          }
         puts(".\n"          puts("&mdash;\n"
              "<INPUT TYPE=\"reset\" VALUE=\"Reset\">\n"               "<INPUT TYPE=\"reset\" VALUE=\"Reset\">\n"
              "</FIELDSET>\n"               "</FIELDSET>\n"
              "</FORM>\n"               "</FORM>\n"
Line 408  resp_index(const struct req *req)
Line 408  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);
           puts("<P>\n"
                "This web interface is documented in the "
                "<A HREF=\"search?expr=Nm~^man\\.cgi$&amp;sec=8\">"
                "man.cgi</A> manual, and the "
                "<A HREF=\"search?expr=Nm~^apropos$&amp;sec=1\">"
                "apropos</A> manual explains the query syntax.\n"
                "</P>");
         resp_end_html();          resp_end_html();
 }  }
   
Line 473  resp_search(const struct req *req, struct manpage *r, 
Line 484  resp_search(const struct req *req, struct manpage *r, 
                  * If we have just one result, then jump there now                   * If we have just one result, then jump there now
                  * without any delay.                   * without any delay.
                  */                   */
                 puts("Status: 303 See Other");                  printf("Status: 303 See Other\r\n");
                 printf("Location: http://%s%s/show/%s/%s?",                  printf("Location: http://%s%s/show/%s/%s?",
                     httphost, scriptname, req->q.manpath, r[0].file);                      httphost, scriptname, req->q.manpath, r[0].file);
                 http_printquery(req);                  http_printquery(req);
                 puts("\n"                  printf("\r\n"
                      "Content-Type: text/html; charset=utf-8\n");                       "Content-Type: text/html; charset=utf-8\r\n"
                        "\r\n");
                 return;                  return;
         }          }
   

Legend:
Removed from v.1.59  
changed lines
  Added in v.1.62

CVSweb