aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/cgi.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-12-07 16:08:55 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-12-07 16:08:55 +0000
commit7f93e283aa333cfe306cd3bdccbb59c63a0e832b (patch)
treeff1b6fa1f60c6ec61df5355e5bf3dd03f78ab923 /cgi.c
parent414118265270db74a6b53ec00d909ae7b5953121 (diff)
downloadmandoc-7f93e283aa333cfe306cd3bdccbb59c63a0e832b.tar.gz
mandoc-7f93e283aa333cfe306cd3bdccbb59c63a0e832b.tar.zst
mandoc-7f93e283aa333cfe306cd3bdccbb59c63a0e832b.zip
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.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/cgi.c b/cgi.c
index 7440f9de..1eb73ff0 100644
--- a/cgi.c
+++ b/cgi.c
@@ -1,4 +1,4 @@
-/* $Id: cgi.c,v 1.14 2011/12/07 15:55:06 kristaps Exp $ */
+/* $Id: cgi.c,v 1.15 2011/12/07 16:08:55 kristaps Exp $ */
/*
* Copyright (c) 2011 Kristaps Dzonsons <kristaps@bsd.lv>
*
@@ -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));
+}
+