Temporarily freeze variables set via -S..
[s-mailx.git] / config.h
blobea301410b9890ecaab98302cca22d8a4dcdb77d0
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 - 2017 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 APPEND /* New mail goes to end of mailbox */
41 #define DOTLOCK_TRIES 5 /* Number of open(2) calls for dotlock */
42 #define FILE_LOCK_TRIES 10 /* Maximum tries before n_file_lock() fails */
43 #define FILE_LOCK_MILLIS 200 /* If UIZ_MAX, fall back to that */
44 #define n_ERROR "ERROR" /* Is-error? Also as n_error[] */
45 #define ERRORS_MAX 1000 /* Maximum error ring entries TODO configable*/
46 #define n_ESCAPE "~" /* Default escape for sending (POSIX) */
47 #define FTMP_OPEN_TRIES 10 /* Maximum number of Ftmp() open(2) tries */
48 #define HSHSIZE 23 /* Hash prime TODO make dynamic, obsolete */
49 #define n_IMAP_DELIM "/." /* Directory separator ([0] == replacer, too) */
50 #define INDENT_DEFAULT "\t" /* *indentprefix* default as of POSIX */
51 #define n_MAILDIR_SEPARATOR ':' /* Flag separator character */
52 #define n_MAXARGC 512 /* Maximum list of raw strings TODO dyn vector! */
53 #define n_ALIAS_MAXEXP 25 /* Maximum expansion of aliases */
54 #define n_PATH_DEVNULL "/dev/null" /* Note: manual uses /dev/null as such */
55 #define REFERENCES_MAX 20 /* Maximum entries in References: */
56 #define n_SIGSUSPEND_NOT_WAITPID 1 /* Not waitpid(2), but sigsuspend(2) */
57 #define n_UNIREPL "\xEF\xBF\xBD" /* Unicode replacement 0xFFFD in UTF-8 */
58 #define n_VEXPR_REGEX_MAX 16 /* Maximum address. `vexpr' regex(7) matches */
60 /* Auto-reclaimed memory storage: size of the buffers. Maximum auto-reclaimed
61 * storage is that value /2, which is n_CTA()ed to be > 1024 */
62 #define n_MEMORY_AUTOREC_SIZE 0x2000u
63 /* Ugly, but avoid dynamic allocation for the management structure! */
64 #define n_MEMORY_POOL_TYPE_SIZEOF (7 * sizeof(void*))
66 /* Default *mime-encoding* as enum mime_enc */
67 #define MIME_DEFAULT_ENCODING MIMEE_B64
69 /* Maximum allowed line length in a mail before QP folding is necessary), and
70 * the real limit we go for */
71 #define MIME_LINELEN_MAX 998 /* Plus CRLF */
72 #define MIME_LINELEN_LIMIT (MIME_LINELEN_MAX - 48)
74 /* Ditto, SHOULD */
75 #define MIME_LINELEN 78 /* Plus CRLF */
77 /* And in headers which contain an encoded word according to RFC 2047 there is
78 * yet another limit; also RFC 2045: 6.7, (5). */
79 #define MIME_LINELEN_RFC2047 76
81 /* Fallback MIME charsets, if *charset-7bit* and *charset-8bit* are not set.
82 * Note: must be lowercase!
83 * (Keep in SYNC: ./nail.1:"Character sets", ./config.h:CHARSET_*!) */
84 #define CHARSET_7BIT "us-ascii"
85 #ifdef HAVE_ICONV
86 # define CHARSET_8BIT "utf-8"
87 # define CHARSET_8BIT_OKEY charset_8bit
88 #else
89 # define CHARSET_8BIT "iso-8859-1"
90 # define CHARSET_8BIT_OKEY ttycharset
91 #endif
93 /* Simply use RAND_bytes(3) for randoms */
94 #ifdef HAVE_XSSL
95 # define n_RANDOM_USE_XSSL 1
96 #else
97 # define n_RANDOM_USE_XSSL 0
98 #endif
100 /* Some environment variables for pipe hooks etc. */
101 #define n_PIPEENV_FILENAME "MAILX_FILENAME"
102 #define n_PIPEENV_FILENAME_GENERATED "MAILX_FILENAME_GENERATED"
103 #define n_PIPEENV_FILENAME_TEMPORARY "MAILX_FILENAME_TEMPORARY"
104 #define n_PIPEENV_CONTENT "MAILX_CONTENT"
105 #define n_PIPEENV_CONTENT_EVIDENCE "MAILX_CONTENT_EVIDENCE"
107 /* Is *W* a quoting (ASCII only) character? */
108 #define n_QUOTE_IS_A(W) \
109 ((W) == n_WC_C('>') || (W) == n_WC_C('|') ||\
110 (W) == n_WC_C('}') || (W) == n_WC_C(':'))
112 /* Maximum number of quote characters (not bytes!) that'll be used on
113 * follow lines when compressing leading quote characters */
114 #define n_QUOTE_MAX 42u
116 /* How much spaces should a <tab> count when *quote-fold*ing? (power-of-two!) */
117 #define n_QUOTE_TAB_SPACES 8
119 /* For long iterative output, like `list', tabulator-completion, etc.,
120 * determine the screen width that should be used */
121 #define n_SCRNWIDTH_FOR_LISTS ((size_t)n_scrnwidth - ((size_t)n_scrnwidth >> 3))
123 /* Smells fishy after, or asks for shell expansion, dependent on context */
124 #define n_SHEXP_MAGIC_PATH_CHARS "|&;<>{}()[]*?$`'\"\\"
126 /* Maximum size of a message that is passed through to the spam system */
127 #define SPAM_MAXSIZE 420000
129 /* Max readable line width TODO simply use BUFSIZ? */
130 #if BUFSIZ + 0 > 2560
131 # define LINESIZE BUFSIZ
132 #else
133 # define LINESIZE 2560
134 #endif
135 #define BUFFER_SIZE (BUFSIZ >= (1u << 13) ? BUFSIZ : (1u << 14))
137 #ifndef NI_MAXHOST
138 # define NI_MAXHOST 1025
139 #endif
141 /* TODO PATH_MAX: fixed-size buffer is always wrong (think NFS) */
142 #ifndef PATH_MAX
143 # ifdef MAXPATHLEN
144 # define PATH_MAX MAXPATHLEN
145 # else
146 # define PATH_MAX 1024 /* _XOPEN_PATH_MAX POSIX 2008/Cor 1-2013 */
147 # endif
148 #endif
150 #ifndef HOST_NAME_MAX
151 # ifdef _POSIX_HOST_NAME_MAX
152 # define HOST_NAME_MAX _POSIX_HOST_NAME_MAX
153 # else
154 # define HOST_NAME_MAX 255
155 # endif
156 #endif
158 #ifndef NAME_MAX
159 # ifdef _POSIX_NAME_MAX
160 # define NAME_MAX _POSIX_NAME_MAX
161 # else
162 # define NAME_MAX 14
163 # endif
164 #endif
165 #if NAME_MAX + 0 < 8
166 # error NAME_MAX is too small
167 #endif
169 #ifndef STDIN_FILENO
170 # define STDIN_FILENO 0
171 #endif
172 #ifndef STDOUT_FILENO
173 # define STDOUT_FILENO 1
174 #endif
175 #ifndef STDERR_FILENO
176 # define STDERR_FILENO 2
177 #endif
179 #ifdef O_CLOEXEC
180 # define _O_CLOEXEC O_CLOEXEC
181 # define _CLOEXEC_SET(FD) do {;} while(0)
182 #else
183 # define _O_CLOEXEC 0
184 # define _CLOEXEC_SET(FD) n_fd_cloexec_set(FD)
185 #endif
187 #ifdef O_NOFOLLOW
188 # define n_O_NOFOLLOW O_NOFOLLOW
189 #else
190 # define n_O_NOFOLLOW 0
191 #endif
193 #ifdef NSIG_MAX
194 # undef NSIG
195 # define NSIG NSIG_MAX
196 #elif !defined NSIG
197 # define NSIG ((sizeof(sigset_t) * 8) - 1)
198 #endif
200 /* Switch indicating necessity of terminal access interface (termcap.c) */
201 #if defined HAVE_TERMCAP || defined HAVE_COLOUR || defined HAVE_MLE
202 # define n_HAVE_TCAP
203 #endif
205 /* Whether we shall do our memory debug thing */
206 #if (defined HAVE_DEBUG || defined HAVE_DEVEL) && !defined HAVE_NOMEMDBG
207 # define HAVE_MEMORY_DEBUG
208 #endif
210 /* Number of Not-Yet-Dead calls that are remembered */
211 #if defined HAVE_DEBUG || defined HAVE_DEVEL || defined HAVE_NYD2
212 # ifdef HAVE_NYD2
213 # define NYD_CALLS_MAX (25 * 84)
214 # elif defined HAVE_DEVEL
215 # define NYD_CALLS_MAX (25 * 42)
216 # else
217 # define NYD_CALLS_MAX (25 * 10)
218 # endif
219 #endif
221 #endif /* n_CONFIG_H */
222 /* s-it-mode */