diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2014-07-24 20:30:45 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2014-07-24 20:30:45 +0000 |
commit | f0ed82f19fa760aaaa0d02bcbbda9f34357649f2 (patch) | |
tree | 09519b3f84b2237ede119005fb5bacd9b9dc9373 /cgi.c | |
parent | 896b390bda7935b1fbc5244e7655b49a2a089bf5 (diff) | |
download | mandoc-f0ed82f19fa760aaaa0d02bcbbda9f34357649f2.tar.gz mandoc-f0ed82f19fa760aaaa0d02bcbbda9f34357649f2.tar.zst mandoc-f0ed82f19fa760aaaa0d02bcbbda9f34357649f2.zip |
Sort result pages first by section number, then by name.
By moving the sort from cgi.c to mansearch.c, we get two advantages:
Easier access to the data needed for sorting, in particular the section
number, and the apropos(1) command line utility profits as well.
Feature requested by deraadt@.
Diffstat (limited to 'cgi.c')
-rw-r--r-- | cgi.c | 13 |
1 files changed, 1 insertions, 12 deletions
@@ -1,4 +1,4 @@ -/* $Id: cgi.c,v 1.81 2014/07/24 08:26:57 schwarze Exp $ */ +/* $Id: cgi.c,v 1.82 2014/07/24 20:30:45 schwarze Exp $ */ /* * Copyright (c) 2011, 2012 Kristaps Dzonsons <kristaps@bsd.lv> * Copyright (c) 2014 Ingo Schwarze <schwarze@usta.de> @@ -53,7 +53,6 @@ struct req { }; static void catman(const struct req *, const char *); -static int cmp(const void *, const void *); static void format(const struct req *, const char *); static void html_print(const char *); static void html_printquery(const struct req *); @@ -593,8 +592,6 @@ pg_searchres(const struct req *req, struct manpage *r, size_t sz) return; } - qsort(r, sz, sizeof(struct manpage), cmp); - resp_begin_html(200, NULL); resp_searchform(req); puts("<DIV CLASS=\"results\">"); @@ -1059,14 +1056,6 @@ main(void) return(EXIT_SUCCESS); } -static int -cmp(const void *p1, const void *p2) -{ - - return(strcasecmp(((const struct manpage *)p1)->names, - ((const struct manpage *)p2)->names)); -} - /* * Scan for indexable paths. */ |