diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-12-07 16:08:55 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-12-07 16:08:55 +0000 |
commit | f571e3813bff77e7998070e36b0d639923e7571d (patch) | |
tree | dde929d78653bfeb2d3bd9627a15db405330f75a /cgi.c | |
parent | 910ad63849bea2b09b02b8fd7dbf18f78869967c (diff) | |
download | mandoc-f571e3813bff77e7998070e36b0d639923e7571d.tar.gz |
Apropos and man.cgi should strcasecmp their output sorting.
man.cgi should sort in the first place -- it wasn't before.
Revert uppercasing of man.cgi title.
Diffstat (limited to 'cgi.c')
-rw-r--r-- | cgi.c | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -67,6 +67,7 @@ struct req { static int atou(const char *, unsigned *); static void catman(const char *); +static int cmp(const void *, const void *); static void format(const char *); static void html_print(const char *); static void html_putchar(char); @@ -423,7 +424,6 @@ static void resp_search(struct res *r, size_t sz, void *arg) { int i; - char *cp; if (1 == sz) { /* @@ -438,6 +438,8 @@ resp_search(struct res *r, size_t sz, void *arg) return; } + qsort(r, sz, sizeof(struct res), cmp); + resp_begin_html(200, NULL); resp_searchform((const struct req *)arg); @@ -454,8 +456,7 @@ resp_search(struct res *r, size_t sz, void *arg) printf("<TR><TD CLASS=\"title\"><A HREF=\""); html_print(progname); printf("/show/%u/%u.html\">", r[i].volume, r[i].rec); - for (cp = r[i].title; '\0' != *cp; cp++) - html_putchar(toupper((unsigned char)*cp)); + html_print(r[i].title); putchar('('); html_print(r[i].cat); if (r[i].arch && '\0' != *r[i].arch) { @@ -752,7 +753,7 @@ pg_search(const struct manpaths *ps, const struct req *req, char *path) cp = NULL; ep = NULL; sz = 0; - whatis = 0; + whatis = 1; memset(&opt, 0, sizeof(struct opts)); @@ -917,3 +918,12 @@ main(void) return(EXIT_SUCCESS); } + +static int +cmp(const void *p1, const void *p2) +{ + + return(strcasecmp(((const struct res *)p1)->title, + ((const struct res *)p2)->title)); +} + |