]> git.cameronkatri.com Git - mandoc.git/blob - mansearch.h
In keep mode, if any text is printed (even in NOSPACE mode),
[mandoc.git] / mansearch.h
1 /* $Id: mansearch.h,v 1.2 2012/06/09 14:11:16 kristaps Exp $ */
2 /*
3 * Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
4 *
5 * Permission to use, copy, modify, and distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17 #ifndef MANSEARCH_H
18 #define MANSEARCH_H
19
20 #define MANDOC_DB "mandocdb.db"
21
22 #define TYPE_An 0x0000000000000001ULL
23 #define TYPE_Ar 0x0000000000000002ULL
24 #define TYPE_At 0x0000000000000004ULL
25 #define TYPE_Bsx 0x0000000000000008ULL
26 #define TYPE_Bx 0x0000000000000010ULL
27 #define TYPE_Cd 0x0000000000000020ULL
28 #define TYPE_Cm 0x0000000000000040ULL
29 #define TYPE_Dv 0x0000000000000080ULL
30 #define TYPE_Dx 0x0000000000000100ULL
31 #define TYPE_Em 0x0000000000000200ULL
32 #define TYPE_Er 0x0000000000000400ULL
33 #define TYPE_Ev 0x0000000000000800ULL
34 #define TYPE_Fa 0x0000000000001000ULL
35 #define TYPE_Fl 0x0000000000002000ULL
36 #define TYPE_Fn 0x0000000000004000ULL
37 #define TYPE_Ft 0x0000000000008000ULL
38 #define TYPE_Fx 0x0000000000010000ULL
39 #define TYPE_Ic 0x0000000000020000ULL
40 #define TYPE_In 0x0000000000040000ULL
41 #define TYPE_Lb 0x0000000000080000ULL
42 #define TYPE_Li 0x0000000000100000ULL
43 #define TYPE_Lk 0x0000000000200000ULL
44 #define TYPE_Ms 0x0000000000400000ULL
45 #define TYPE_Mt 0x0000000000800000ULL
46 #define TYPE_Nd 0x0000000001000000ULL
47 #define TYPE_Nm 0x0000000002000000ULL
48 #define TYPE_Nx 0x0000000004000000ULL
49 #define TYPE_Ox 0x0000000008000000ULL
50 #define TYPE_Pa 0x0000000010000000ULL
51 #define TYPE_Rs 0x0000000020000000ULL
52 #define TYPE_Sh 0x0000000040000000ULL
53 #define TYPE_Ss 0x0000000080000000ULL
54 #define TYPE_St 0x0000000100000000ULL
55 #define TYPE_Sy 0x0000000200000000ULL
56 #define TYPE_Tn 0x0000000400000000ULL
57 #define TYPE_Va 0x0000000800000000ULL
58 #define TYPE_Vt 0x0000001000000000ULL
59 #define TYPE_Xr 0x0000002000000000ULL
60
61 __BEGIN_DECLS
62
63 struct manpage {
64 char file[MAXPATHLEN]; /* prefixed by manpath */
65 char *desc; /* description of manpage */
66 int form; /* 0 == catpage */
67 };
68
69 struct mansearch {
70 const char *arch; /* architecture/NULL */
71 const char *sec; /* mansection/NULL */
72 uint64_t deftype; /* type if no key */
73 int flags;
74 #define MANSEARCH_WHATIS 0x01 /* whatis mode: equality, no key */
75 };
76
77 int mansearch(const struct mansearch *cfg, /* options */
78 const struct manpaths *paths, /* manpaths */
79 int argc, /* size of argv */
80 char *argv[], /* search terms */
81 struct manpage **res, /* results */
82 size_t *ressz); /* results returned */
83
84 __END_DECLS
85
86 #endif /*!MANSEARCH_H*/