1 /*
2 * manconfig.h: definitions and declarations used throughout man-db
3 *
4 * Copyright (C) 1994, 1995 Graeme W. Wilford. (Wilf.)
5 * Copyright (C) 2001-2022 Colin Watson.
6 *
7 * This file is part of man-db.
8 *
9 * man-db is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * man-db is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with man-db; if not, write to the Free Software Foundation,
21 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24 #ifndef MANCONFIG_H
25 #define MANCONFIG_H
26
27 /* STD_SECTIONS must contain all of your man hierarchy subdirectories. The
28 order is important. Manual pages will be displayed in this order. Ie
29 if "1" comes before "2", then a kill(1) will be displayed in preference to
30 kill(2), or if `man --all kill', it will be displayed first. Section names
31 may be multi-character, but this is non-standard and probably best
32 avoided. */
33
34 #define STD_SECTIONS { \
35 "1", "n", "l", "8", "3", "0", "2", "3type", "5", "4", "9", "6", "7", \
36 NULL \
37 }
38
39 /* Some system's man pages require default pre-processing with perhaps tbl
40 or other formatters, DEFAULT_MANROFFSEQ can compensate by adding a list of
41 default pre-processors using the standard syntax of first letter.
42 ie "t" = tbl (the table pre-processor)
43 "te" = tbl, eqn (both the table and equation pre-processors)
44 DEFAULT_MANROFFSEQ can be overridden by command line arguments to man, the
45 environment variable $MANROFFSEQ, and by the manual page being formatted. */
46
47 #if defined (__hpux) || (defined (__alpha) && !defined(__GLIBC__))
48 # define DEFAULT_MANROFFSEQ "te"
49 #elif defined (__ultrix)
50 # define DEFAULT_MANROFFSEQ "t"
51 #endif
52
53 /* the magic cookie to request preprocessing */
54 #define PP_COOKIE "'\\\" "
55
56 /* uncomment the following line if manual pages require tbl by default */
57 #ifndef DEFAULT_MANROFFSEQ
58 #define DEFAULT_MANROFFSEQ "t"
59 #endif
60
61 /* By default, man-db will store a whatis referenced manual page in favour
62 of a stray cat page when they both share identical namespace. If you
63 would like to see a stray cat eg. kill(1) in favour of a kill(1) whatis
64 referenced to bash_builtins(1), uncomment the following line. */
65
66 /* #define FAVOUR_STRAYCATS */
67
68 /* CATMODE is the mode of the formatted cat pages that we create. The man-db
69 package can be run in 4 main modes, 3 of which are relatively secure and
70 allow the cats to be non world writable. The `wide open' mode requires
71 CATMODE to be 0666. Edit if necessary, after reading the man-db manual */
72
73 #define CATMODE 0644 /* u=rw,go=r */
74
75 /* DBMODE is the mode of the created databases. As with CATMODE, secure
76 operation requires that the db's don't have world write access. In the
77 unlikely event that this is required, change to 0666.
78 For increased speed, at the cost of buffer cache, set the sticky bit
79 on databases so that they remain memory resident. To do this, OR the
80 required mode with 1000 and prepend a 0, eg 01644 */
81
82 #define DBMODE 0644 /* u=rw,go=r */
83
84 /*------------------------------------------------------------------*/
85 /* The following definitions are best left alone by the uninitiated */
86 /*------------------------------------------------------------------*/
87
88 /* GNU grep flags (i)gnore case
89 (E)xtended regex
90 (w)hole word matches only */
91
92 #ifndef WHATIS_GREP_FLAGS
93 # define WHATIS_GREP_FLAGS "-i"
94 #endif
95
96 #ifndef APROPOS_GREP_FLAGS
97 # define APROPOS_GREP_FLAGS "-iEw"
98 #endif
99
100 #ifndef APROPOS_REGEX_GREP_FLAGS
101 # define APROPOS_REGEX_GREP_FLAGS "-iE"
102 #endif
103
104 /* GNU less flags (i)gnore case on search
105 * (x8) set tab stops to 8 spaces
106 * (R)aw control chars (but keep track of screen appearance)
107 * (m)ore display style
108 *
109 * If you change this, be sure to match the format with
110 * man.c:make_display_command().
111 */
112
113 #define LESS_OPTS "-ix8RmPm%s$PM%s$"
114
115 /* This is a minimal latin1 special characters to ascii translation table */
116 #if !defined(TR_SET1) || !defined(TR_SET2)
117 # define TR_SET1 " \'\\255\\267\\264\\327\'"
118 # define TR_SET2 " \'\\055\\157\\047\\170\'"
119 #endif
120
121 /*-----------------------------------------------------------------------*/
122 /* The things below here shouldn't really be changed unless you really */
123 /* know what you are doing. */
124 /*-----------------------------------------------------------------------*/
125
126 /* my gcc specs file is hacked to define __profile__ if I compile with
127 the -p or -pg flag, to do this manually (needed if you want to know where
128 gmon.out ended up), uncomment the following line */
129 /* #define __profile__ */
130
131 /* GCC version checking borrowed from glibc. */
132 #if defined(__GNUC__) && defined(__GNUC_MINOR__)
133 # define GNUC_PREREQ(maj,min) \
134 ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
135 #else
136 # define GNUC_PREREQ(maj,min) 0
137 #endif
138
139 #define UNLIKELY(cond) __builtin_expect ((cond), 0)
140
141 /* GNU gettext needs to know when the locale changes. This macro tells it. */
142 #ifdef ENABLE_NLS
143 extern int _nl_msg_cat_cntr;
144 # define locale_changed() \
145 do { \
146 ++_nl_msg_cat_cntr; \
147 } while (0)
148 #else /* !ENABLE_NLS */
149 # define locale_changed()
150 #endif /* ENABLE_NLS */
151
152 extern int quiet; /* be quiet(er) if 1 */
153
154 /*--------------------------*/
155 /* Some general definitions */
156 /*--------------------------*/
157
158 /* exit codes */
159 #define OK 0 /* success */
160 #define FAIL 1 /* usage or syntax error */
161 #define FATAL 2 /* operational error */
162 #define CHILD_FAIL 3 /* child failed */
163 #define NOT_FOUND 16 /* No action was taken */
164
165 /* System or user catpaths? Allow bitwise disjunctions of these. */
166 #define SYSTEM_CAT 1
167 #define USER_CAT 2
168
169 /* string macros */
170 #define STREQ(a,b) (strcmp(a,b) == 0)
171 #define STRNEQ(a,b,d) (strncmp(a,b,d) == 0)
172
173 /* Functions in <ctype.h> require their argument to be either an unsigned
174 * char promoted to int or EOF. This macro helps get that right.
175 */
176 #define CTYPE(func,arg) (func((unsigned char)(arg)))
177
178 /* access(2), but with boolean semantics. */
179 #define CAN_ACCESS(pathname, mode) (access (pathname, mode) == 0)
180
181 /* FSSTND directories */
182 #define CAT_ROOT "/var/catman" /* required by fsstnd() */
183 #define MAN_ROOT "/usr" /* required by fsstnd() */
184 /* FHS directories */
185 #define FHS_CAT_ROOT "/var/cache/man" /* required by fsstnd() */
186 #define FHS_MAN_ROOT "/usr/share" /* required by fsstnd() */
187
188 /* some special database keys used for storing important info */
189 #define VER_KEY "$version$" /* version key */
190 #define VER_ID "2.5.0" /* version content */
191
192 /* Macros for argp option handling. */
193
194 #define OPT(name, key, arg, ...) {name, key, arg, 0, __VA_ARGS__}
195 #define OPT_FULL(name, key, arg, flags, ...) {name, key, arg, flags, __VA_ARGS__}
196 #define OPT_ALIAS(name, key) {name, key, 0, OPTION_ALIAS}
197 #define OPT_HIDDEN(name, key) {name, key, 0, OPTION_HIDDEN}
198 #define OPT_GROUP_HEADER(doc, group) {0, 0, 0, 0, doc, group}
199 /* compatibility for --help */
200 #define OPT_HELP_COMPAT OPT_HIDDEN(0, 'h')
201
202 #endif /* MANCONFIG_H */