a_nag_elide_qsort(): FIX false sorting (Michael Dressel)..
[s-mailx.git] / config.h
blobc3dbfd76c59c9f907f14dea2b8f25033d91b68f0
1 /*@ S-nail - a mail user agent derived from Berkeley Mail.
2 *@ Some constants etc. for which adjustments may be desired.
3 *@ This is included after all the (system) headers.
5 * Copyright (c) 2000-2004 Gunnar Ritter, Freiburg i. Br., Germany.
6 * Copyright (c) 2012 - 2018 Steffen (Daode) Nurpmeso <steffen@sdaoden.eu>.
7 */
8 /*
9 * Copyright (c) 1980, 1993
10 * The Regents of the University of California. All rights reserved.
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
36 #ifndef n_CONFIG_H
37 # define n_CONFIG_H
39 #define ACCOUNT_NULL "null" /* Name of "null" account */
40 #define DOTLOCK_TRIES 5 /* Number of open(2) calls for dotlock */
41 #define FILE_LOCK_TRIES 10 /* Maximum tries before n_file_lock() fails */
42 #define FILE_LOCK_MILLIS 200 /* If UIZ_MAX, fall back to that */
43 #define n_ERROR "ERROR" /* Is-error? Also as n_error[] */
44 #define ERRORS_MAX 1000 /* Maximum error ring entries TODO configable*/
45 #define n_ESCAPE "~" /* Default escape for sending (POSIX) */
46 #define FTMP_OPEN_TRIES 10 /* Maximum number of Ftmp() open(2) tries */
47 #define HSHSIZE 23 /* Hash prime TODO make dynamic, obsolete */
48 #define n_IMAP_DELIM "/." /* Directory separator ([0] == replacer, too) */
49 #define n_MAILDIR_SEPARATOR ':' /* Flag separator character */
50 #define n_MAXARGC 512 /* Maximum list of raw strings TODO dyn vector! */
51 #define n_ALIAS_MAXEXP 25 /* Maximum expansion of aliases */
52 #define n_PATH_DEVNULL "/dev/null" /* Note: manual uses /dev/null as such */
53 #define REFERENCES_MAX 20 /* Maximum entries in References: */
54 #define n_SIGSUSPEND_NOT_WAITPID 1 /* Not waitpid(2), but sigsuspend(2) */
55 #define n_UNIREPL "\xEF\xBF\xBD" /* Unicode replacement 0xFFFD in UTF-8 */
56 #define n_VEXPR_REGEX_MAX 16 /* Maximum address. `vexpr' regex(7) matches */
58 /* * */
60 /* Fallback MIME charsets, if *charset-7bit* and *charset-8bit* are not set.
61 * Note: must be lowercase!
62 * (Keep in SYNC: ./nail.1:"Character sets", ./config.h:CHARSET_*!) */
63 #define CHARSET_7BIT "us-ascii"
64 #ifdef HAVE_ICONV
65 # define CHARSET_8BIT "utf-8"
66 # define CHARSET_8BIT_OKEY charset_8bit
67 #else
68 # if defined HAVE_ALWAYS_UNICODE_LOCALE
69 # define CHARSET_8BIT "utf-8"
70 # else
71 # define CHARSET_8BIT "iso-8859-1"
72 # endif
73 # define CHARSET_8BIT_OKEY ttycharset
74 #endif
76 #ifndef HOST_NAME_MAX
77 # ifdef _POSIX_HOST_NAME_MAX
78 # define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
79 # else
80 # define HOST_NAME_MAX 255
81 # endif
82 #endif
84 /* Supported IDNA implementations */
85 #define n_IDNA_IMPL_LIBIDN2 0
86 #define n_IDNA_IMPL_LIBIDN 1
87 #define n_IDNA_IMPL_IDNKIT 2
89 /* Max readable line width TODO simply use BUFSIZ? */
90 #if BUFSIZ + 0 > 2560
91 # define LINESIZE BUFSIZ
92 #else
93 # define LINESIZE 2560
94 #endif
95 #define BUFFER_SIZE (BUFSIZ >= (1u << 13) ? BUFSIZ : (1u << 14))
97 /* Auto-reclaimed memory storage: size of the buffers. Maximum auto-reclaimed
98 * storage is that value /2, which is n_CTA()ed to be > 1024 */
99 #define n_MEMORY_AUTOREC_SIZE 0x2000u
100 /* Ugly, but avoid dynamic allocation for the management structure! */
101 #define n_MEMORY_POOL_TYPE_SIZEOF (7 * sizeof(void*))
103 /* Default *mime-encoding* as enum mime_enc */
104 #define MIME_DEFAULT_ENCODING MIMEE_QP
106 /* Maximum allowed line length in a mail before QP folding is necessary), and
107 * the real limit we go for */
108 #define MIME_LINELEN_MAX 998 /* Plus CRLF */
109 #define MIME_LINELEN_LIMIT (MIME_LINELEN_MAX - 48)
111 /* Ditto, SHOULD */
112 #define MIME_LINELEN 78 /* Plus CRLF */
114 /* And in headers which contain an encoded word according to RFC 2047 there is
115 * yet another limit; also RFC 2045: 6.7, (5). */
116 #define MIME_LINELEN_RFC2047 76
118 /* TODO PATH_MAX: fixed-size buffer is always wrong (think NFS) */
119 #ifndef PATH_MAX
120 # ifdef MAXPATHLEN
121 # define PATH_MAX MAXPATHLEN
122 # else
123 # define PATH_MAX 1024 /* _XOPEN_PATH_MAX POSIX 2008/Cor 1-2013 */
124 # endif
125 #endif
127 /* Some environment variables for pipe hooks etc. */
128 #define n_PIPEENV_FILENAME "MAILX_FILENAME"
129 #define n_PIPEENV_FILENAME_GENERATED "MAILX_FILENAME_GENERATED"
130 #define n_PIPEENV_FILENAME_TEMPORARY "MAILX_FILENAME_TEMPORARY"
131 #define n_PIPEENV_CONTENT "MAILX_CONTENT"
132 #define n_PIPEENV_CONTENT_EVIDENCE "MAILX_CONTENT_EVIDENCE"
133 #define n_PIPEENV_EXTERNAL_BODY_URL "MAILX_EXTERNAL_BODY_URL"
135 /* Maximum number of quote characters (not bytes!) that'll be used on
136 * follow lines when compressing leading quote characters */
137 #define n_QUOTE_MAX 42u
139 /* How much spaces should a <tab> count when *quote-fold*ing? (power-of-two!) */
140 #define n_QUOTE_TAB_SPACES 8
142 /* Supported (external) PRG implementations */
143 #define n_RANDOM_IMPL_BUILTIN 0
144 #define n_RANDOM_IMPL_ARC4 1
145 #define n_RANDOM_IMPL_SSL 2
146 #define n_RANDOM_IMPL_GETRANDOM 3 /* (both, syscall + library) */
147 #define n_RANDOM_IMPL_URANDOM 4
149 /* For long iterative output, like `list', tabulator-completion, etc.,
150 * determine the screen width that should be used */
151 #define n_SCRNWIDTH_FOR_LISTS ((size_t)n_scrnwidth - ((size_t)n_scrnwidth >> 3))
153 /* Smells fishy after, or asks for shell expansion, dependent on context */
154 #define n_SHEXP_MAGIC_PATH_CHARS "|&;<>{}()[]*?$`'\"\\"
156 /* Port to native MS-Windows and to ancient UNIX */
157 #if !defined S_ISDIR && defined S_IFDIR && defined S_IFMT
158 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
159 #endif
161 /* Maximum size of a message that is passed through to the spam system */
162 #define SPAM_MAXSIZE 420000
164 #ifndef NAME_MAX
165 # ifdef _POSIX_NAME_MAX
166 # define NAME_MAX _POSIX_NAME_MAX
167 # else
168 # define NAME_MAX 14
169 # endif
170 #endif
171 #if NAME_MAX + 0 < 8
172 # error NAME_MAX is too small
173 #endif
175 #ifndef STDIN_FILENO
176 # define STDIN_FILENO 0
177 #endif
178 #ifndef STDOUT_FILENO
179 # define STDOUT_FILENO 1
180 #endif
181 #ifndef STDERR_FILENO
182 # define STDERR_FILENO 2
183 #endif
185 #ifdef O_CLOEXEC
186 # define _O_CLOEXEC O_CLOEXEC
187 # define _CLOEXEC_SET(FD) do {;} while(0)
188 #else
189 # define _O_CLOEXEC 0
190 # define _CLOEXEC_SET(FD) n_fd_cloexec_set(FD)
191 #endif
193 #ifdef O_NOCTTY
194 # define n_O_NOCTTY O_NOCTTY
195 #else
196 # define n_O_NOCTTY 0
197 #endif
198 #ifdef O_NOFOLLOW
199 # define n_O_NOFOLLOW O_NOFOLLOW
200 #else
201 # define n_O_NOFOLLOW 0
202 #endif
203 #define n_O_NOXY_BITS (n_O_NOCTTY | n_O_NOFOLLOW)
205 #ifdef NSIG_MAX
206 # undef NSIG
207 # define NSIG NSIG_MAX
208 #elif !defined NSIG
209 # define NSIG ((sizeof(sigset_t) * 8) - 1)
210 #endif
212 /* * */
214 /* Switch indicating necessity of terminal access interface (termcap.c) */
215 #if defined HAVE_TERMCAP || defined HAVE_COLOUR || defined HAVE_MLE
216 # define n_HAVE_TCAP
217 #endif
219 /* Whether we shall do our memory debug thing */
220 #if (defined HAVE_DEBUG || defined HAVE_DEVEL) && !defined HAVE_NOMEMDBG
221 # define HAVE_MEMORY_DEBUG
222 #endif
224 /* Number of Not-Yet-Dead calls that are remembered */
225 #if defined HAVE_DEBUG || defined HAVE_DEVEL || defined HAVE_NYD2
226 # ifdef HAVE_NYD2
227 # define NYD_CALLS_MAX (25 * 84)
228 # elif defined HAVE_DEVEL
229 # define NYD_CALLS_MAX (25 * 42)
230 # else
231 # define NYD_CALLS_MAX (25 * 10)
232 # endif
233 #endif
235 #endif /* n_CONFIG_H */
236 /* s-it-mode */