make-config.in: complete path (leftover of [807f64e2], 2015-12-26!)
[s-mailx.git] / config.h
blobd0c1e7e9661540d3e6fb02c3bcf4ccc1fa090643
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) 2012 - 2018 Steffen (Daode) Nurpmeso <steffen@sdaoden.eu>.
6 * SPDX-License-Identifier: ISC
8 * Permission to use, copy, modify, and/or distribute this software for any
9 * purpose with or without fee is hereby granted, provided that the above
10 * copyright notice and this permission notice appear in all copies.
12 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
20 #ifndef n_CONFIG_H
21 # define n_CONFIG_H
23 #define ACCOUNT_NULL "null" /* Name of "null" account */
24 /* Protocol version for *on-compose-splice** -- update manual on change! */
25 #define n_DIG_MSG_PLUMBING_VERSION "0 0 1"
26 #define DOTLOCK_TRIES 5 /* Number of open(2) calls for dotlock */
27 #define FILE_LOCK_TRIES 10 /* Maximum tries before n_file_lock() fails */
28 #define FILE_LOCK_MILLIS 200 /* If UIZ_MAX, fall back to that */
29 #define n_ERROR "ERROR" /* Is-error? Also as n_error[] */
30 #define ERRORS_MAX 1000 /* Maximum error ring entries TODO configable*/
31 #define n_ESCAPE "~" /* Default escape for sending (POSIX) */
32 #define FTMP_OPEN_TRIES 10 /* Maximum number of Ftmp() open(2) tries */
33 #define n_FORWARD_INJECT_HEAD "-------- Original Message --------\n" /* DOC! */
34 #define n_FORWARD_INJECT_TAIL NULL /* DOC! */
35 #define HSHSIZE 23 /* Hash prime TODO make dynamic, obsolete */
36 #define n_IMAP_DELIM "/." /* Directory separator ([0] == replacer, too) */
37 #define n_MAILDIR_SEPARATOR ':' /* Flag separator character */
38 #define n_MAXARGC 512 /* Maximum list of raw strings TODO dyn vector! */
39 #define n_ALIAS_MAXEXP 25 /* Maximum expansion of aliases */
40 #define n_PATH_DEVNULL "/dev/null" /* Note: manual uses /dev/null as such */
41 #define n_QUOTE_INJECT_HEAD "%f wrote:\n\n" /* DOC! */
42 #define n_QUOTE_INJECT_TAIL NULL /* DOC! */
43 #define REFERENCES_MAX 20 /* Maximum entries in References: */
44 #define n_SIGSUSPEND_NOT_WAITPID 1 /* Not waitpid(2), but sigsuspend(2) */
45 #define n_UNIREPL "\xEF\xBF\xBD" /* Unicode replacement 0xFFFD in UTF-8 */
46 #define n_VEXPR_REGEX_MAX 16 /* Maximum address. `vexpr' regex(7) matches */
48 /* * */
50 /* Fallback MIME charsets, if *charset-7bit* and *charset-8bit* are not set.
51 * Note: must be lowercase!
52 * (Keep in SYNC: ./nail.1:"Character sets", ./config.h:CHARSET_*!) */
53 #define CHARSET_7BIT "us-ascii"
54 #ifdef HAVE_ICONV
55 # define CHARSET_8BIT "utf-8"
56 # define CHARSET_8BIT_OKEY charset_8bit
57 #else
58 # if defined HAVE_ALWAYS_UNICODE_LOCALE
59 # define CHARSET_8BIT "utf-8"
60 # else
61 # define CHARSET_8BIT "iso-8859-1"
62 # endif
63 # define CHARSET_8BIT_OKEY ttycharset
64 #endif
66 #ifndef HOST_NAME_MAX
67 # ifdef _POSIX_HOST_NAME_MAX
68 # define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
69 # else
70 # define HOST_NAME_MAX 255
71 # endif
72 #endif
74 /* Supported IDNA implementations */
75 #define n_IDNA_IMPL_LIBIDN2 0
76 #define n_IDNA_IMPL_LIBIDN 1
77 #define n_IDNA_IMPL_IDNKIT 2 /* 1 + 2 */
79 /* Max readable line width TODO simply use BUFSIZ? */
80 #if BUFSIZ + 0 > 2560
81 # define LINESIZE BUFSIZ
82 #else
83 # define LINESIZE 2560
84 #endif
85 #define BUFFER_SIZE (BUFSIZ >= (1u << 13) ? BUFSIZ : (1u << 14))
87 /* Auto-reclaimed memory storage: size of the buffers. Maximum auto-reclaimed
88 * storage is that value /2, which is n_CTA()ed to be > 1024 */
89 #define n_MEMORY_AUTOREC_SIZE 0x2000u
90 /* Ugly, but avoid dynamic allocation for the management structure! */
91 #define n_MEMORY_POOL_TYPE_SIZEOF (8 * sizeof(void*))
93 /* Default *mime-encoding* as enum mime_enc */
94 #define MIME_DEFAULT_ENCODING MIMEE_QP
96 /* Maximum allowed line length in a mail before QP folding is necessary), and
97 * the real limit we go for */
98 #define MIME_LINELEN_MAX 998 /* Plus CRLF */
99 #define MIME_LINELEN_LIMIT (MIME_LINELEN_MAX - 48)
101 /* Ditto, SHOULD */
102 #define MIME_LINELEN 78 /* Plus CRLF */
104 /* And in headers which contain an encoded word according to RFC 2047 there is
105 * yet another limit; also RFC 2045: 6.7, (5). */
106 #define MIME_LINELEN_RFC2047 76
108 /* TODO PATH_MAX: fixed-size buffer is always wrong (think NFS) */
109 #ifndef PATH_MAX
110 # ifdef MAXPATHLEN
111 # define PATH_MAX MAXPATHLEN
112 # else
113 # define PATH_MAX 1024 /* _XOPEN_PATH_MAX POSIX 2008/Cor 1-2013 */
114 # endif
115 #endif
117 /* Some environment variables for pipe hooks etc. */
118 #define n_PIPEENV_FILENAME "MAILX_FILENAME"
119 #define n_PIPEENV_FILENAME_GENERATED "MAILX_FILENAME_GENERATED"
120 #define n_PIPEENV_FILENAME_TEMPORARY "MAILX_FILENAME_TEMPORARY"
121 #define n_PIPEENV_CONTENT "MAILX_CONTENT"
122 #define n_PIPEENV_CONTENT_EVIDENCE "MAILX_CONTENT_EVIDENCE"
123 #define n_PIPEENV_EXTERNAL_BODY_URL "MAILX_EXTERNAL_BODY_URL"
125 /* Maximum number of quote characters (not bytes!) that'll be used on
126 * follow lines when compressing leading quote characters */
127 #define n_QUOTE_MAX 42u
129 /* How much spaces should a <tab> count when *quote-fold*ing? (power-of-two!) */
130 #define n_QUOTE_TAB_SPACES 8
132 /* Supported (external) PRG implementations */
133 #define n_RANDOM_IMPL_BUILTIN 0
134 #define n_RANDOM_IMPL_ARC4 1
135 #define n_RANDOM_IMPL_TLS 2
136 #define n_RANDOM_IMPL_GETRANDOM 3 /* (both, syscall + library) */
137 #define n_RANDOM_IMPL_URANDOM 4
139 /* For long iterative output, like `list', tabulator-completion, etc.,
140 * determine the screen width that should be used */
141 #define n_SCRNWIDTH_FOR_LISTS ((size_t)n_scrnwidth - ((size_t)n_scrnwidth >> 3))
143 /* Smells fishy after, or asks for shell expansion, dependent on context */
144 #define n_SHEXP_MAGIC_PATH_CHARS "|&;<>{}()[]*?$`'\"\\"
146 /* Port to native MS-Windows and to ancient UNIX */
147 #if !defined S_ISDIR && defined S_IFDIR && defined S_IFMT
148 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
149 #endif
151 /* Maximum size of a message that is passed through to the spam system */
152 #define SPAM_MAXSIZE 420000
154 #ifndef NAME_MAX
155 # ifdef _POSIX_NAME_MAX
156 # define NAME_MAX _POSIX_NAME_MAX
157 # else
158 # define NAME_MAX 14
159 # endif
160 #endif
161 #if NAME_MAX + 0 < 8
162 # error NAME_MAX is too small
163 #endif
165 #ifndef STDIN_FILENO
166 # define STDIN_FILENO 0
167 #endif
168 #ifndef STDOUT_FILENO
169 # define STDOUT_FILENO 1
170 #endif
171 #ifndef STDERR_FILENO
172 # define STDERR_FILENO 2
173 #endif
175 #ifdef O_CLOEXEC
176 # define _O_CLOEXEC O_CLOEXEC
177 # define _CLOEXEC_SET(FD) do {;} while(0)
178 #else
179 # define _O_CLOEXEC 0
180 # define _CLOEXEC_SET(FD) n_fd_cloexec_set(FD)
181 #endif
183 #ifdef O_NOCTTY
184 # define n_O_NOCTTY O_NOCTTY
185 #else
186 # define n_O_NOCTTY 0
187 #endif
188 #ifdef O_NOFOLLOW
189 # define n_O_NOFOLLOW O_NOFOLLOW
190 #else
191 # define n_O_NOFOLLOW 0
192 #endif
193 #define n_O_NOXY_BITS (n_O_NOCTTY | n_O_NOFOLLOW)
195 #ifdef NSIG_MAX
196 # undef NSIG
197 # define NSIG NSIG_MAX
198 #elif !defined NSIG
199 # define NSIG ((sizeof(sigset_t) * 8) - 1)
200 #endif
202 /* * */
204 /* Switch indicating necessity of terminal access interface (termcap.c) */
205 #if defined HAVE_TERMCAP || defined HAVE_COLOUR || defined HAVE_MLE
206 # define n_HAVE_TCAP
207 #endif
209 /* Whether we shall do our memory debug thing */
210 #if (defined HAVE_DEBUG || defined HAVE_DEVEL) && !defined HAVE_NOMEMDBG
211 # define HAVE_MEMORY_DEBUG
212 #endif
214 /* Number of Not-Yet-Dead calls that are remembered */
215 #if defined HAVE_DEBUG || defined HAVE_DEVEL || defined HAVE_NYD2
216 # ifdef HAVE_NYD2
217 # define NYD_CALLS_MAX (25 * 84)
218 # elif defined HAVE_DEVEL
219 # define NYD_CALLS_MAX (25 * 42)
220 # else
221 # define NYD_CALLS_MAX (25 * 10)
222 # endif
223 #endif
225 #endif /* n_CONFIG_H */
226 /* s-it-mode */