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

Diff for /mandoc/cgi.c between version 1.39 and 1.40

version 1.39, 2011/12/25 17:49:52 version 1.40, 2012/03/23 09:03:07
Line 69  struct query {
Line 69  struct query {
         const char      *sec; /* manual section */          const char      *sec; /* manual section */
         const char      *expr; /* unparsed expression string */          const char      *expr; /* unparsed expression string */
         int              manroot; /* manroot index (or -1)*/          int              manroot; /* manroot index (or -1)*/
         int              whatis; /* whether whatis mode */  
         int              legacy; /* whether legacy mode */          int              legacy; /* whether legacy mode */
 };  };
   
Line 230  http_parse(struct req *req, char *p)
Line 229  http_parse(struct req *req, char *p)
   
         memset(&req->q, 0, sizeof(struct query));          memset(&req->q, 0, sizeof(struct query));
   
         req->q.whatis = 1;  
         legacy = -1;          legacy = -1;
         manroot = NULL;          manroot = NULL;
   
Line 268  http_parse(struct req *req, char *p)
Line 266  http_parse(struct req *req, char *p)
                         manroot = val;                          manroot = val;
                 else if (0 == strcmp(key, "apropos"))                  else if (0 == strcmp(key, "apropos"))
                         legacy = 0 == strcmp(val, "0");                          legacy = 0 == strcmp(val, "0");
                 else if (0 == strcmp(key, "op"))  
                         req->q.whatis = 0 == strcasecmp(val, "whatis");  
         }          }
   
         /* Test for old man.cgi compatibility mode. */          /* Test for old man.cgi compatibility mode. */
   
         if (legacy == 0) {          req->q.legacy = legacy > 0;
                 req->q.whatis = 0;  
                 req->q.legacy = 1;  
         } else if (legacy > 0) {  
                 req->q.legacy = 1;  
                 req->q.whatis = 1;  
         }  
   
         /*          /*
          * Section "0" means no section when in legacy mode.           * Section "0" means no section when in legacy mode.
Line 408  resp_searchform(const struct req *req)
Line 398  resp_searchform(const struct req *req)
                "<FORM ACTION=\"%s/search.html\" METHOD=\"get\">\n"                 "<FORM ACTION=\"%s/search.html\" METHOD=\"get\">\n"
                "<FIELDSET>\n"                 "<FIELDSET>\n"
                "<LEGEND>Search Parameters</LEGEND>\n"                 "<LEGEND>Search Parameters</LEGEND>\n"
                "<INPUT TYPE=\"submit\" NAME=\"op\""                 "<INPUT TYPE=\"submit\" "
                " VALUE=\"Whatis\"> or \n"                 " VALUE=\"Search\"> for manuals satisfying \n"
                "<INPUT TYPE=\"submit\" NAME=\"op\""  
                " VALUE=\"apropos\"> for manuals satisfying \n"  
                "<INPUT TYPE=\"text\" NAME=\"expr\" VALUE=\"",                 "<INPUT TYPE=\"text\" NAME=\"expr\" VALUE=\"",
                progname);                 progname);
         html_print(req->q.expr ? req->q.expr : "");          html_print(req->q.expr ? req->q.expr : "");
Line 538  resp_search(struct res *r, size_t sz, void *arg)
Line 526  resp_search(struct res *r, size_t sz, void *arg)
         puts("<DIV CLASS=\"results\">");          puts("<DIV CLASS=\"results\">");
   
         if (0 == sz) {          if (0 == sz) {
                 printf("<P>\n"                  puts("<P>\n"
                        "No %s results found.\n",                       "No results found.\n"
                        req->q.whatis ? "whatis" : "apropos");                       "</P>\n"
                 if (req->q.whatis) {                       "</DIV>");
                         printf("(Try "  
                                "<A HREF=\"%s/search.html?op=apropos",  
                                progname);  
                         html_printquery(req);  
                         puts("\">apropos</A>?)");  
                 }  
                 puts("</P>");  
                 puts("</DIV>");  
                 resp_end_html();                  resp_end_html();
                 return;                  return;
         }          }
Line 953  pg_search(const struct req *req, char *path)
Line 933  pg_search(const struct req *req, char *path)
          * The resp_search() function is called with the results.           * The resp_search() function is called with the results.
          */           */
   
         expr = req->q.whatis ?          expr = req->q.legacy ?
                 termcomp(sz, cp, &tt) : exprcomp(sz, cp, &tt);                  termcomp(sz, cp, &tt) : exprcomp(sz, cp, &tt);
   
         if (NULL != expr)          if (NULL != expr)

Legend:
Removed from v.1.39  
changed lines
  Added in v.1.40

CVSweb