Deleted Added
full compact
mansearch.h (274880) mansearch.h (275432)
1/* $Id: mansearch.h,v 1.15 2014/07/24 20:30:45 schwarze Exp $ */
1/* $Id: mansearch.h,v 1.21 2014/11/27 01:58:21 schwarze Exp $ */
2/*
3 * Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
4 * Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *

--- 47 unchanged lines hidden (view full) ---

57#define TYPE_Dx 0x0000000400000000ULL
58#define TYPE_Rs 0x0000000800000000ULL
59#define TYPE_Vt 0x0000001000000000ULL
60#define TYPE_Lb 0x0000002000000000ULL
61#define TYPE_Nm 0x0000004000000000ULL
62#define TYPE_Nd 0x0000008000000000ULL
63
64#define NAME_SYN 0x0000004000000001ULL
2/*
3 * Copyright (c) 2012 Kristaps Dzonsons <kristaps@bsd.lv>
4 * Copyright (c) 2013, 2014 Ingo Schwarze <schwarze@openbsd.org>
5 *
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
9 *

--- 47 unchanged lines hidden (view full) ---

57#define TYPE_Dx 0x0000000400000000ULL
58#define TYPE_Rs 0x0000000800000000ULL
59#define TYPE_Vt 0x0000001000000000ULL
60#define TYPE_Lb 0x0000002000000000ULL
61#define TYPE_Nm 0x0000004000000000ULL
62#define TYPE_Nd 0x0000008000000000ULL
63
64#define NAME_SYN 0x0000004000000001ULL
65#define NAME_FILE 0x0000004000000002ULL
66#define NAME_TITLE 0x000000400000000cULL
67#define NAME_FIRST 0x0000004000000008ULL
68#define NAME_HEAD 0x0000004000000010ULL
65#define NAME_FIRST 0x0000004000000004ULL
66#define NAME_TITLE 0x0000004000000006ULL
67#define NAME_HEAD 0x0000004000000008ULL
68#define NAME_FILE 0x0000004000000010ULL
69#define NAME_MASK 0x000000000000001fULL
70
69#define NAME_MASK 0x000000000000001fULL
70
71__BEGIN_DECLS
71#define FORM_CAT 0 /* manual page is preformatted */
72#define FORM_SRC 1 /* format is mdoc(7) or man(7) */
73#define FORM_NONE 4 /* format is unknown */
72
74
75enum argmode {
76 ARG_FILE = 0,
77 ARG_NAME,
78 ARG_WORD,
79 ARG_EXPR
80};
81
73struct manpage {
74 char *file; /* to be prefixed by manpath */
75 char *names; /* a list of names with sections */
76 char *output; /* user-defined additional output */
82struct manpage {
83 char *file; /* to be prefixed by manpath */
84 char *names; /* a list of names with sections */
85 char *output; /* user-defined additional output */
86 size_t ipath; /* number of the manpath */
87 uint64_t bits; /* name type mask */
77 int sec; /* section number, 10 means invalid */
78 int form; /* 0 == catpage */
79};
80
81struct mansearch {
82 const char *arch; /* architecture/NULL */
83 const char *sec; /* mansection/NULL */
88 int sec; /* section number, 10 means invalid */
89 int form; /* 0 == catpage */
90};
91
92struct mansearch {
93 const char *arch; /* architecture/NULL */
94 const char *sec; /* mansection/NULL */
84 uint64_t deftype; /* type if no key */
85 int flags;
86#define MANSEARCH_WHATIS 0x01 /* whatis(1) mode: whole words, no keys */
87#define MANSEARCH_MAN 0x02 /* man(1) mode: string equality, no keys */
95 const char *outkey; /* show content of this macro */
96 enum argmode argmode; /* interpretation of arguments */
97 int firstmatch; /* first matching database only */
88};
89
98};
99
100__BEGIN_DECLS
101
90int mansearch_setup(int);
91int mansearch(const struct mansearch *cfg, /* options */
92 const struct manpaths *paths, /* manpaths */
93 int argc, /* size of argv */
94 char *argv[], /* search terms */
102int mansearch_setup(int);
103int mansearch(const struct mansearch *cfg, /* options */
104 const struct manpaths *paths, /* manpaths */
105 int argc, /* size of argv */
106 char *argv[], /* search terms */
95 const char *outkey, /* name of additional output key */
96 struct manpage **res, /* results */
97 size_t *ressz); /* results returned */
107 struct manpage **res, /* results */
108 size_t *ressz); /* results returned */
109void mansearch_free(struct manpage *, size_t);
98
99__END_DECLS
100
110
111__END_DECLS
112
101#endif /*!MANSEARCH_H*/
113#endif /* MANSEARCH_H */