| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | /* $NetBSD: apropos-utils.c,v 1.21 2016/03/24 16:07:13 christos Exp $ */ | | 1 | /* $NetBSD: apropos-utils.c,v 1.22 2016/03/31 20:16:58 christos Exp $ */ |
2 | /*- | | 2 | /*- |
3 | * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com> | | 3 | * Copyright (c) 2011 Abhinav Upadhyay <er.abhinav.upadhyay@gmail.com> |
4 | * All rights reserved. | | 4 | * All rights reserved. |
5 | * | | 5 | * |
6 | * This code was developed as part of Google's Summer of Code 2011 program. | | 6 | * This code was developed as part of Google's Summer of Code 2011 program. |
7 | * | | 7 | * |
8 | * Redistribution and use in source and binary forms, with or without | | 8 | * Redistribution and use in source and binary forms, with or without |
9 | * modification, are permitted provided that the following conditions | | 9 | * modification, are permitted provided that the following conditions |
10 | * are met: | | 10 | * are met: |
11 | * | | 11 | * |
12 | * 1. Redistributions of source code must retain the above copyright | | 12 | * 1. Redistributions of source code must retain the above copyright |
13 | * notice, this list of conditions and the following disclaimer. | | 13 | * notice, this list of conditions and the following disclaimer. |
14 | * 2. Redistributions in binary form must reproduce the above copyright | | 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| @@ -21,47 +21,45 @@ | | | @@ -21,47 +21,45 @@ |
21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS | | 21 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
22 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE | | 22 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
23 | * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | | 23 | * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
24 | * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, | | 24 | * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, |
25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | | 25 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | | 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
27 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | | 27 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | | 28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
29 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | | 29 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
30 | * SUCH DAMAGE. | | 30 | * SUCH DAMAGE. |
31 | */ | | 31 | */ |
32 | | | 32 | |
33 | #include <sys/cdefs.h> | | 33 | #include <sys/cdefs.h> |
34 | __RCSID("$NetBSD: apropos-utils.c,v 1.21 2016/03/24 16:07:13 christos Exp $"); | | 34 | __RCSID("$NetBSD: apropos-utils.c,v 1.22 2016/03/31 20:16:58 christos Exp $"); |
35 | | | 35 | |
36 | #include <sys/queue.h> | | 36 | #include <sys/queue.h> |
37 | #include <sys/stat.h> | | 37 | #include <sys/stat.h> |
38 | | | 38 | |
39 | #include <assert.h> | | 39 | #include <assert.h> |
40 | #include <ctype.h> | | 40 | #include <ctype.h> |
41 | #include <err.h> | | 41 | #include <err.h> |
42 | #include <math.h> | | 42 | #include <math.h> |
43 | #include <stdio.h> | | 43 | #include <stdio.h> |
44 | #include <stdlib.h> | | 44 | #include <stdlib.h> |
45 | #include <string.h> | | 45 | #include <string.h> |
46 | #include <util.h> | | 46 | #include <util.h> |
47 | #include <zlib.h> | | 47 | #include <zlib.h> |
48 | #include <term.h> | | 48 | #include <term.h> |
49 | #undef tab // XXX: manconf.h | | 49 | #undef tab // XXX: manconf.h |
50 | | | 50 | |
51 | #include "apropos-utils.h" | | 51 | #include "apropos-utils.h" |
52 | #include "manconf.h" | | 52 | #include "manconf.h" |
53 | #include "dist/mandoc.h" | | | |
54 | #include "sqlite3.h" | | | |
55 | | | 53 | |
56 | typedef struct orig_callback_data { | | 54 | typedef struct orig_callback_data { |
57 | void *data; | | 55 | void *data; |
58 | int (*callback) (void *, const char *, const char *, const char *, | | 56 | int (*callback) (void *, const char *, const char *, const char *, |
59 | const char *, size_t); | | 57 | const char *, size_t); |
60 | } orig_callback_data; | | 58 | } orig_callback_data; |
61 | | | 59 | |
62 | typedef struct inverse_document_frequency { | | 60 | typedef struct inverse_document_frequency { |
63 | double value; | | 61 | double value; |
64 | int status; | | 62 | int status; |
65 | } inverse_document_frequency; | | 63 | } inverse_document_frequency; |
66 | | | 64 | |
67 | /* weights for individual columns */ | | 65 | /* weights for individual columns */ |