1 /*@ S-nail - a mail user agent derived from Berkeley Mail.
2 *@ Header inclusion, macros, constants, types and the global var declarations.
4 * Copyright (c) 2000-2004 Gunnar Ritter, Freiburg i. Br., Germany.
5 * Copyright (c) 2012 - 2014 Steffen "Daode" Nurpmeso <sdaoden@users.sf.net>.
8 * Copyright (c) 1980, 1993
9 * The Regents of the University of California. All rights reserved.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgement:
21 * This product includes software developed by the University of
22 * California, Berkeley and its contributors.
23 * 4. Neither the name of the University nor the names of its contributors
24 * may be used to endorse or promote products derived from this software
25 * without specific prior written permission.
27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
41 * Mail -- a mail program
43 * Author: Kurt Shoens (UCB) March 25, 1978
49 #include <sys/types.h>
63 #if defined __STDC_VERSION__ && __STDC_VERSION__ + 0 >= 199901L
66 # include <inttypes.h>
80 #ifdef HAVE_OPENSSL_MD5
81 # include <openssl/md5.h>
85 * Constants, some nail-specific macros
88 #if !defined NI_MAXHOST || NI_MAXHOST < 1025
90 # define NI_MAXHOST 1025
95 # define PATH_MAX MAXPATHLEN
97 # define PATH_MAX 1024 /* _XOPEN_PATH_MAX POSIX 2008/Cor 1-2013 */
102 # define STDIN_FILENO 0
104 #ifndef STDOUT_FILENO
105 # define STDOUT_FILENO 1
107 #ifndef STDERR_FILENO
108 # define STDERR_FILENO 2
113 # define NSIG NSIG_MAX
115 # define NSIG ((sizeof(sigset_t) * 8) - 1)
120 #if BUFSIZ > 2560 /* TODO simply use BUFSIZ? */
121 # define LINESIZE BUFSIZ /* max readable line width */
123 # define LINESIZE 2560
125 #define BUFFER_SIZE (BUFSIZ >= (1u << 13) ? BUFSIZ : (1u << 14))
127 #define CBAD (-15555)
128 #define APPEND /* New mail goes to end of mailbox */
129 #define ESCAPE '~' /* Default escape for sending */
130 #define FIO_STACK_SIZE 20 /* Maximum recursion for sourcing */
131 #define HIST_SIZE 242 /* tty.c: history list default size */
132 #define HSHSIZE 23 /* Hash prime (aliases, vars, macros) */
133 #define MAXARGC 1024 /* Maximum list of raw strings */
134 #define MAXEXP 25 /* Maximum expansion of aliases */
135 #define NYD_CALLS_MAX 1000 /* Number of NYD calls that are remembered */
136 #define PROMPT_BUFFER_SIZE 80 /* getprompt() bufsize (> 3!) */
138 #define ACCOUNT_NULL "null" /* Name of "null" account */
139 #define MAILRC "~/.mailrc"
140 #define TMPDIR_FALLBACK "/tmp"
142 #define COLOUR_MSGINFO "fg=green"
143 #define COLOUR_PARTINFO "fg=brown"
144 #define COLOUR_FROM_ "fg=brown"
145 #define COLOUR_HEADER "fg=red"
146 #define COLOUR_UHEADER "ft=bold,fg=red"
147 #define COLOUR_PAGERS "less"
148 #define COLOUR_TERMS \
149 "cons25,linux,rxvt,rxvt-unicode,screen,sun,"\
150 "vt100,vt220,wsvt25,xterm,xterm-color"
151 #define COLOUR_USER_HEADERS "from,subject"
153 #define FROM_DATEBUF 64 /* Size of RFC 4155 From_ line date */
154 #define DATE_DAYSYEAR 365L
155 #define DATE_SECSMIN 60L
156 #define DATE_MINSHOUR 60L
157 #define DATE_HOURSDAY 24L
158 #define DATE_SECSDAY (DATE_SECSMIN * DATE_MINSHOUR * DATE_HOURSDAY)
160 /* Default *encoding* as enum conversion below */
161 #define MIME_DEFAULT_ENCODING CONV_TOQP
163 /* Maximum allowed line length in a mail before QP folding is necessary), and
164 * the real limit we go for */
165 #define MIME_LINELEN_MAX 1000
166 #define MIME_LINELEN_LIMIT (MIME_LINELEN_MAX - 50)
168 /* Locations of mime.types(5) */
169 #define MIME_TYPES_USR "~/.mime.types"
170 #define MIME_TYPES_SYS "/etc/mime.types"
172 /* Fallback MIME charsets, if *charset-7bit* and *charset-8bit* or not set */
173 #define CHARSET_7BIT "US-ASCII"
175 # define CHARSET_8BIT "UTF-8"
176 # define CHARSET_8BIT_OKEY charset_8bit
178 # define CHARSET_8BIT "ISO-8859-1"
179 # define CHARSET_8BIT_OKEY ttycharset
182 /* Is *W* a quoting (ASCII only) character? */
184 ((W) == L'>' || (W) == L'|' || (W) == L'}' || (W) == L':')
186 /* Maximum number of quote characters (not bytes!) that'll be used on
187 * follow lines when compressing leading quote characters */
190 /* How much spaces should a <tab> count when *quote-fold*ing? (power-of-two!) */
191 #define QUOTE_TAB_SPACES 8
193 /* Maximum size of a message that is passed through to the spam system */
194 #define SPAM_MAXSIZE 420000
196 /* String dope: dynamic buffer size, and size of the single builtin one that's
198 #define SBUFFER_SIZE 0x18000u
199 #define SBUFFER_BUILTIN 0x2000u
201 /* These come from the configuration (named Xxy to not clash with sh(1)..) */
203 # define XSHELL "/bin/sh"
206 # define XLISTER "ls"
209 # define XPAGER "more"
213 * CC support, generic macros etc.
217 #if defined __GNUC__ || defined __clang__
218 # define __EXTEN __extension__
220 # define __PREREQ(X,Y) \
221 (__GNUC__ > (X) || (__GNUC__ == (X) && __GNUC_MINOR__ >= (Y)))
223 # define __PREREQ(X,Y) 1
227 # define __PREREQ(X,Y) 0
230 #define EMPTY_FILE(F) typedef int CONCAT(avoid_empty_file__, F);
232 /* Pointer to size_t */
233 #define PTR2SIZE(X) ((size_t)(uintptr_t)(X))
235 /* Pointer comparison (types from below) */
236 #define PTRCMP(A,C,B) ((uintptr_t)(A) C (uintptr_t)(B))
238 /* Ditto, compare (maybe mixed-signed) integers cases to T bits, unsigned;
239 * Note: doesn't sign-extend correctly, that's still up to the caller */
240 #define UICMP(T,A,C,B) ((ui ## T ## _t)(A) C (ui ## T ## _t)(B))
242 /* Members in constant array */
244 # define NELEM(A) (sizeof(A) / sizeof(A[0]))
247 /* sizeof() for member fields */
248 #define SIZEOF_FIELD(T,F) sizeof(((T *)NULL)->F)
250 /* Casts-away (*NOT* cast-away) */
251 #define UNUSED(X) ((void)(X))
252 #define UNCONST(P) ((void*)(uintptr_t)(void const*)(P))
253 #define UNVOLATILE(P) ((void*)(uintptr_t)(void volatile*)(P))
254 #define UNXXX(T,C,P) ((T)(uintptr_t)(C)(P))
256 /* __STDC_VERSION__ is ISO C99, so also use __STDC__, which should work */
257 #if defined __STDC__ || defined __STDC_VERSION__ /*|| defined __cplusplus*/
258 # define STRING(X) #X
259 # define XSTRING(X) STRING(X)
260 # define CONCAT(S1,S2) _CONCAT(S1, S2)
261 # define _CONCAT(S1,S2) S1 ## S2
263 # define STRING(X) "X"
264 # define XSTRING STRING
265 # define CONCAT(S1,S2) S1/**/S2
268 #if defined __STDC_VERSION__ && __STDC_VERSION__ + 0 >= 199901L
269 /* Variable size arrays and structure fields */
270 # define VFIELD_SIZE(X)
271 # define VFIELD_SIZEOF(T,F) (0)
272 /* Inline functions */
274 # define INLINE inline
275 # define SINLINE static inline
277 # define VFIELD_SIZE(X) (X)
278 # define VFIELD_SIZEOF(T,F) SIZEOF_FIELD(T, F)
280 # define INLINE static __inline
281 # define SINLINE static __inline
284 # define SINLINE static
289 #if defined __STDC_VERSION__ && __STDC_VERSION__ + 0 >= 199901L
290 # define __FUN__ __func__
292 # define __FUN__ __FUNCTION__
294 # define __FUN__ uagent /* Something that is not a literal */
297 #if defined __predict_true && defined __predict_false
298 # define LIKELY(X) __predict_true(X)
299 # define UNLIKELY(X) __predict_false(X)
300 #elif __PREREQ(2, 96)
301 # define LIKELY(X) __builtin_expect(X, 1)
302 # define UNLIKELY(X) __builtin_expect(X, 0)
304 # define LIKELY(X) (X)
305 # define UNLIKELY(X) (X)
308 /* Compile-Time-Assert */
309 #define CTA(TEST) _CTA_1(TEST, __LINE__)
310 #define _CTA_1(TEST,L) _CTA_2(TEST, L)
311 #define _CTA_2(TEST,L) \
312 typedef char COMPILE_TIME_ASSERT_failed_at_line_ ## L[(TEST) ? 1 : -1]
315 #define ISPOW2(X) ((((X) - 1) & (X)) == 0)
317 #define MIN(A, B) ((A) < (B) ? (A) : (B))
319 #define MAX(A, B) ((A) < (B) ? (B) : (A))
321 #define ABS(A) ((A) < 0 ? -(A) : (A))
327 # define assert(X) UNUSED(0)
335 /* Translation (init in main.c) */
339 # define tr(c,d) catgets(catd, CATSET, c, d)
348 /* TODO convert all integer types to the new [su]i(8|16|32|64)_t */
349 typedef unsigned long ul_it
;
350 typedef unsigned int ui_it
;
351 typedef unsigned short us_it
;
352 typedef unsigned char uc_it
;
354 typedef signed long sl_it
;
355 typedef signed int si_it
;
356 typedef signed short ss_it
;
357 typedef signed char sc_it
;
360 # define UI8_MAX UINT8_MAX
361 # define SI8_MIN INT8_MIN
362 # define SI8_MAX INT8_MAX
363 typedef uint8_t ui8_t
;
364 typedef int8_t si8_t
;
365 #elif UCHAR_MAX != 255
366 # error UCHAR_MAX must be 255
368 # define UI8_MAX UCHAR_MAX
369 # define SI8_MIN CHAR_MIN
370 # define SI8_MAX CHAR_MAX
371 typedef unsigned char ui8_t
;
372 typedef signed char si8_t
;
376 # define UI16_MAX UINT16_MAX
377 # define SI16_MIN INT16_MIN
378 # define SI16_MAX INT16_MAX
379 typedef uint16_t ui16_t
;
380 typedef int16_t si16_t
;
381 #elif USHRT_MAX != 0xFFFFu
382 # error USHRT_MAX must be 0xFFFF
384 # define UI16_MAX USHRT_MAX
385 # define SI16_MIN SHRT_MIN
386 # define SI16_MAX SHRT_MAX
387 typedef unsigned short ui16_t
;
388 typedef signed short si16_t
;
392 # define UI32_MAX UINT32_MAX
393 # define SI32_MIN INT32_MIN
394 # define SI32_MAX INT32_MAX
395 typedef uint32_t ui32_t
;
396 typedef int32_t si32_t
;
397 #elif ULONG_MAX == 0xFFFFFFFFu
398 # define UI32_MAX ULONG_MAX
399 # define SI32_MIN LONG_MIN
400 # define SI32_MAX LONG_MAX
401 typedef unsigned long int ui32_t
;
402 typedef signed long int si32_t
;
403 #elif UINT_MAX != 0xFFFFFFFFu
404 # error UINT_MAX must be 0xFFFFFFFF
406 # define UI32_MAX UINT_MAX
407 # define SI32_MIN INT_MIN
408 # define SI32_MAX INT_MAX
409 typedef unsigned int ui32_t
;
410 typedef signed int si32_t
;
414 # define UI64_MAX UINT64_MAX
415 # define SI64_MIN INT64_MIN
416 # define SI64_MAX INT64_MAX
417 typedef uint64_t ui64_t
;
418 #elif ULONG_MAX <= 0xFFFFFFFFu
419 # if !defined ULLONG_MAX || ULLONG_MAX != 0xFFFFFFFFFFFFFFFFu
420 # error We need a 64 bit integer
422 # define UI64_MAX ULLONG_MAX
423 # define SI64_MIN LLONG_MIN
424 # define SI64_MAX LLONG_MAX
425 __EXTEN
typedef unsigned long long ui64_t
;
426 __EXTEN
typedef signed long long si64_t
;
429 # define UI64_MAX ULONG_MAX
430 # define SI64_MIN LONG_MIN
431 # define SI64_MAX LONG_MAX
432 typedef unsigned long ui64_t
;
433 typedef signed long si64_t
;
436 /* (So that we can use UICMP() for size_t comparison, too) */
437 typedef size_t uiz_t
;
438 typedef ssize_t siz_t
;
442 # define uintptr_t size_t
443 # define UINTPTR_MAX SIZE_MAX
445 # define uintptr_t unsigned long
446 # define UINTPTR_MAX ULONG_MAX
450 /* XXX Note we don't really deal with that the right way in that we pass size_t
451 * XXX arguments without casting; should do, because above we assert UINT_MAX
452 * XXX is indeed ui32_t */
453 #if defined __STDC_VERSION__ && __STDC_VERSION__ + 0 >= 199901L
455 #elif defined SIZE_MAX && SIZE_MAX == 0xFFFFFFFFu && ULONG_MAX != UINT_MAX
463 typedef si8_t bool_t
;
465 typedef void ( *sighandler_type
)(int);
469 OPT_DEBUG
= 1u<< 0, /* -d / *debug* */
470 OPT_VERBOSE
= 1u<< 1, /* -v / *verbose* */
471 OPT_EXISTONLY
= 1u<< 2, /* -e */
472 OPT_HEADERSONLY
= 1u<< 3, /* -H */
473 OPT_NOSRC
= 1u<< 4, /* -n */
474 OPT_E_FLAG
= 1u<< 5, /* -E / *skipemptybody* */
475 OPT_F_FLAG
= 1u<< 6, /* -F */
476 OPT_N_FLAG
= 1u<< 7, /* -N / *header* */
477 OPT_R_FLAG
= 1u<< 8, /* -R */
478 OPT_r_FLAG
= 1u<< 9, /* -r (plus option_r_arg) */
479 OPT_t_FLAG
= 1u<<10, /* -t */
480 OPT_u_FLAG
= 1u<<11, /* -u given, or USER != getpwnam(3) */
481 OPT_TILDE_FLAG
= 1u<<12, /* -~ */
482 OPT_BATCH_FLAG
= 1u<<13, /* -# */
484 OPT_SENDMODE
= 1u<<14, /* Usage case forces send mode */
485 OPT_INTERACTIVE
= 1u<<15, /* isatty(0) */
486 OPT_TTYIN
= OPT_INTERACTIVE
,
489 #define IS_TTY_SESSION() \
490 ((options & (OPT_TTYIN | OPT_TTYOUT)) == (OPT_TTYIN | OPT_TTYOUT))
493 EXIT_OK
= EXIT_SUCCESS
,
494 EXIT_ERR
= EXIT_FAILURE
,
495 EXIT_COLL_ABORT
= 1<<1, /* Message collection was aborted */
496 EXIT_SEND_ERROR
= 1<<2 /* Unspecified send error occurred */
500 FEXP_FULL
, /* Full expansion */
501 FEXP_LOCAL
= 1<<0, /* Result must be local file/maildir */
502 FEXP_SHELL
= 1<<1, /* No folder %,#,&,+ stuff, yet sh(1) */
503 FEXP_NSHORTCUT
= 1<<2, /* Don't expand shortcuts */
504 FEXP_SILENT
= 1<<3, /* Don't print but only return errors */
505 FEXP_MULTIOK
= 1<<4 /* Expansion to many entries is ok */
508 /* <0 means "stop" unless *prompt* extensions are enabled. */
510 PROMPT_STOP
= -1, /* \c */
511 /* *prompt* extensions: \$, \@ etc. */
531 MIME_NONE
, /* message is not in MIME format */
532 MIME_BIN
, /* message is in binary encoding */
533 MIME_8B
, /* message is in 8bit encoding */
534 MIME_7B
, /* message is in 7bit encoding */
535 MIME_QP
, /* message is quoted-printable */
536 MIME_B64
/* message is in base64 encoding */
540 CONV_NONE
, /* no conversion */
541 CONV_7BIT
, /* no conversion, is 7bit */
542 CONV_FROMQP
, /* convert from quoted-printable */
543 CONV_TOQP
, /* convert to quoted-printable */
544 CONV_8BIT
, /* convert to 8bit (iconv) */
545 CONV_FROMB64
, /* convert from base64 */
546 CONV_FROMB64_T
, /* convert from base64/text */
547 CONV_TOB64
, /* convert to base64 */
548 CONV_FROMHDR
, /* convert from RFC1522 format */
549 CONV_TOHDR
, /* convert to RFC1522 format */
550 CONV_TOHDR_A
/* convert addresses for header */
554 SEND_MBOX
, /* no conversion to perform */
555 SEND_RFC822
, /* no conversion, no From_ line */
556 SEND_TODISP
, /* convert to displayable form */
557 SEND_TODISP_ALL
, /* same, include all MIME parts */
558 SEND_SHOW
, /* convert to 'show' command form */
559 SEND_TOSRCH
, /* convert for IMAP SEARCH */
560 SEND_TOFLTR
, /* convert for spam mail filtering */
561 SEND_TOFILE
, /* convert for saving body to a file */
562 SEND_TOPIPE
, /* convert for pipe-content/subc. */
563 SEND_QUOTE
, /* convert for quoting */
564 SEND_QUOTE_ALL
, /* same, include all MIME parts */
565 SEND_DECRYPT
/* decrypt */
569 MIME_UNKNOWN
, /* unknown content */
570 MIME_SUBHDR
, /* inside a multipart subheader */
571 MIME_822
, /* message/rfc822 content */
572 MIME_MESSAGE
, /* other message/ content */
573 MIME_TEXT_PLAIN
, /* text/plain content */
574 MIME_TEXT_HTML
, /* text/html content */
575 MIME_TEXT
, /* other text/ content */
576 MIME_ALTERNATIVE
, /* multipart/alternative content */
577 MIME_DIGEST
, /* multipart/digest content */
578 MIME_MULTI
, /* other multipart/ content */
579 MIME_PKCS7
, /* PKCS7 content */
580 MIME_DISCARD
/* content is discarded */
592 OF_UNLINK
= 1<<8, /* Only for Ftmp(): unlink(2) after creation */
593 OF_HOLDSIGS
= 1<<9, /* Mutual with OF_UNLINK - await Ftmp_free() */
594 OF_REGISTER
= 1<<10 /* Register file in our file table */
598 TD_NONE
, /* no display conversion */
599 TD_ISPR
= 1<<0, /* use isprint() checks */
600 TD_ICONV
= 1<<1, /* use iconv() */
601 TD_DELCTRL
= 1<<2, /* delete control characters */
604 * NOTE: _TD_EOF and _TD_BUFCOPY may be ORd with enum conversion and
605 * enum sendaction, and may thus NOT clash with their bit range!
607 _TD_EOF
= 1<<14, /* EOF seen, last round! */
608 _TD_BUFCOPY
= 1<<15 /* Buffer may be constant, copy it */
612 PROTO_FILE
, /* refers to a local file */
613 PROTO_POP3
, /* is a pop3 server string */
614 PROTO_IMAP
, /* is an imap server string */
615 PROTO_MAILDIR
, /* refers to a maildir folder */
616 PROTO_UNKNOWN
/* unknown protocol */
620 enum ssl_verify_level
{
628 /* A large enum with all the binary and value options a.k.a their keys.
629 * Only the constant keys are in here, to be looked up via ok_[bv]look(),
630 * ok_[bv]set() and ok_[bv]clear().
631 * Note: see the comments in acmava.c before changing *anything* in here! */
633 /* Option keys for binary options */
634 ok_b_add_file_recipients
,
644 ok_b_attachment_ask_content_description
,
645 ok_b_attachment_ask_content_disposition
,
646 ok_b_attachment_ask_content_id
,
647 ok_b_attachment_ask_content_type
,
652 ok_b_batch_exit_on_error
,
661 ok_b_debug
, /* {special=1} */
669 ok_b_forward_as_attachment
,
671 ok_b_header
, /* {special=1} */
676 ok_b_imap_use_starttls
,
678 ok_b_keep_content_length
,
680 ok_b_line_editor_disable
,
682 ok_b_message_id_disable
,
684 ok_b_mime_allow_text_controls
,
685 ok_b_mime_counter_evidence
,
691 ok_b_pop3_use_starttls
,
692 ok_b_print_all_chars
,
693 ok_b_print_alternatives
,
695 ok_b_quote_as_attachment
,
696 ok_b_recipients_in_cc
,
698 ok_b_reply_in_same_charset
,
700 ok_b_rfc822_body_from_
, /* {name=rfc822-body-from_} */
703 ok_b_sendcharsets_else_ttycharset
,
708 ok_b_skipemptybody
, /* {special=1} */
709 ok_b_smime_force_encryption
,
710 ok_b_smime_no_default_ca
,
712 ok_b_smtp_use_starttls
,
713 ok_b_ssl_no_default_ca
,
715 ok_b_writebackedited
,
716 ok_b_verbose
, /* {special=1} */
718 /* Option keys for values options */
722 /* XXX autoinc is the same as *newmail*, unite!! */
729 ok_v_colour_from_
, /* {name=colour-from_} */
732 ok_v_colour_partinfo
,
735 ok_v_colour_user_headers
,
738 ok_v_datefield_markout_older
,
743 ok_v_folder
, /* {special=1} */
752 ok_v_imap_list_depth
,
754 ok_v_line_editor_cursor_right
, /* {special=1} */
758 ok_v_mimetypes_load_control
,
759 ok_v_NAIL_EXTRA_RC
, /* {name=NAIL_EXTRA_RC} */
760 ok_v_NAIL_HEAD
, /* {name=NAIL_HEAD} */
761 ok_v_NAIL_HISTFILE
, /* {name=NAIL_HISTFILE} */
762 ok_v_NAIL_HISTSIZE
, /* {name=NAIL_HISTSIZE} */
763 ok_v_NAIL_TAIL
, /* {name=NAIL_TAIL} */
778 ok_v_sendmail_progname
,
787 ok_v_smime_sign_cert
,
788 ok_v_smime_sign_include_certs
,
791 ok_v_smtp_auth_password
,
802 ok_v_ssl_cipher_list
,
817 char *s
; /* the string's content */
818 size_t l
; /* the stings's length */
821 struct colour_table
{
822 /* Plus a copy of *colour-user-headers* */
823 struct str ct_csinfo
[COLOURSPEC_RESET
+1 + 1];
826 struct time_current
{
834 FILE *qf_os
; /* Output stream */
836 ui32_t qf_pfix_len
; /* Length of prefix: 0: bypass */
837 ui32_t qf_qfold_min
; /* Simple way: wrote prefix? */
838 #ifdef HAVE_QUOTE_FOLD
839 ui32_t qf_qfold_max
; /* Otherwise: line lengths */
840 ui8_t qf_state
; /* *quote-fold* state machine */
841 bool_t qf_brk_isws
; /* Breakpoint is at WS */
843 ui32_t qf_wscnt
; /* Whitespace count */
844 ui32_t qf_brkl
; /* Breakpoint */
845 ui32_t qf_brkw
; /* Visual width, breakpoint */
846 ui32_t qf_datw
; /* Current visual output line width */
847 struct str qf_dat
; /* Current visual output line */
848 struct str qf_currq
; /* Current quote, compressed */
849 mbstate_t qf_mbps
[2];
855 bool_t ev_is_recursive
; /* Evaluation in evaluation? (collect ~:) */
857 bool_t ev_add_history
; /* Enter (final) command in history? */
858 char const *ev_new_content
; /* History: reenter line, start with this */
861 struct termios_state
{
862 struct termios ts_tios
;
865 bool_t ts_needs_reset
;
868 #define termios_state_reset() \
870 if (termios_state.ts_needs_reset) {\
871 tcsetattr(0, TCSADRAIN, &termios_state.ts_tios);\
872 termios_state.ts_needs_reset = FAL0;\
876 struct sock
{ /* data associated with a socket */
877 int s_fd
; /* file descriptor */
879 int s_use_ssl
; /* SSL is used */
881 void *s_ssl
; /* SSL object */
882 void *s_ctx
; /* SSL context object */
885 char *s_wbuf
; /* for buffered writes */
886 int s_wbufsize
; /* allocated size of s_buf */
887 int s_wbufpos
; /* position of first empty data byte */
888 char *s_rbufptr
; /* read pointer to s_rbuf */
889 int s_rsz
; /* size of last read in s_rbuf */
890 char const *s_desc
; /* description of error messages */
891 void (*s_onclose
)(void); /* execute on close */
892 char s_rbuf
[LINESIZE
+ 1]; /* for buffered reads */
897 MB_NONE
= 000, /* no reply expected */
898 MB_COMD
= 001, /* command reply expected */
899 MB_MULT
= 002, /* multiline reply expected */
900 MB_PREAUTH
= 004, /* not in authenticated state */
901 MB_BYE
= 010 /* may accept a BYE state */
903 FILE *mb_itf
; /* temp file with messages, read open */
904 FILE *mb_otf
; /* same, write open */
905 char *mb_sorted
; /* sort method */
907 MB_VOID
, /* no type (e. g. connection failed) */
908 MB_FILE
, /* local file */
909 MB_POP3
, /* POP3 mailbox */
910 MB_IMAP
, /* IMAP mailbox */
911 MB_MAILDIR
, /* maildir folder */
912 MB_CACHE
/* cached mailbox */
913 } mb_type
; /* type of mailbox */
915 MB_DELE
= 01, /* may delete messages in mailbox */
916 MB_EDIT
= 02 /* may edit messages in mailbox */
918 int mb_compressed
; /* is a compressed mbox file */
919 int mb_threaded
; /* mailbox has been threaded */
923 MB_UIDPLUS
= 001 /* supports IMAP UIDPLUS */
925 unsigned long mb_uidvalidity
; /* IMAP unique identifier validity */
926 char *mb_imap_account
; /* name of current IMAP account */
927 char *mb_imap_mailbox
; /* name of current IMAP mailbox */
928 char *mb_cache_directory
; /* name of cache directory */
930 struct sock mb_sock
; /* socket structure */
934 NEED_UNSPEC
, /* unspecified need, don't fetch */
935 NEED_HEADER
, /* need the header of a message */
936 NEED_BODY
/* need header and body of a message */
940 HAVE_NOTHING
, /* nothing downloaded yet */
941 HAVE_HEADER
= 01, /* header is downloaded */
942 HAVE_BODY
= 02 /* entire message is downloaded */
945 /* flag bits. Attention: Flags that are used in cache.c may not change */
947 MUSED
= (1<< 0), /* entry is used, but this bit isn't */
948 MDELETED
= (1<< 1), /* entry has been deleted */
949 MSAVED
= (1<< 2), /* entry has been saved */
950 MTOUCH
= (1<< 3), /* entry has been noticed */
951 MPRESERVE
= (1<< 4), /* keep entry in sys mailbox */
952 MMARK
= (1<< 5), /* message is marked! */
953 MODIFY
= (1<< 6), /* message has been modified */
954 MNEW
= (1<< 7), /* message has never been seen */
955 MREAD
= (1<< 8), /* message has been read sometime. */
956 MSTATUS
= (1<< 9), /* message status has changed */
957 MBOX
= (1<<10), /* Send this to mbox, regardless */
958 MNOFROM
= (1<<11), /* no From line */
959 MHIDDEN
= (1<<12), /* message is hidden to user */
960 MFULLYCACHED
= (1<<13), /* message is completely cached */
961 MBOXED
= (1<<14), /* message has been sent to mbox */
962 MUNLINKED
= (1<<15), /* message was unlinked from cache */
963 MNEWEST
= (1<<16), /* message is very new (newmail) */
964 MFLAG
= (1<<17), /* message has been flagged recently */
965 MUNFLAG
= (1<<18), /* message has been unflagged */
966 MFLAGGED
= (1<<19), /* message is `flagged' */
967 MANSWER
= (1<<20), /* message has been answered recently */
968 MUNANSWER
= (1<<21), /* message has been unanswered */
969 MANSWERED
= (1<<22), /* message is `answered' */
970 MDRAFT
= (1<<23), /* message has been drafted recently */
971 MUNDRAFT
= (1<<24), /* message has been undrafted */
972 MDRAFTED
= (1<<25), /* message is marked as `draft' */
973 MOLDMARK
= (1<<26), /* messages was marked previously */
974 MSPAM
= (1<<27) /* message is classified as spam */
976 #define MMNORM (MDELETED | MSAVED | MHIDDEN)
977 #define MMNDEL (MDELETED | MHIDDEN)
979 #define visible(mp) (((mp)->m_flag & MMNDEL) == 0)
982 enum mflag m_flag
; /* flags */
983 enum havespec m_have
; /* downloaded parts of the part */
985 ui32_t m_spamscore
; /* Spam score as int, 24:8 bits */
987 int m_block
; /* block number of this part */
988 size_t m_offset
; /* offset in block of part */
989 size_t m_size
; /* Bytes in the part */
990 size_t m_xsize
; /* Bytes in the full part */
991 long m_lines
; /* Lines in the message */
992 long m_xlines
; /* Lines in the full message */
993 time_t m_time
; /* time the message was sent */
994 char const *m_from
; /* message sender */
995 struct mimepart
*m_nextpart
; /* next part at same level */
996 struct mimepart
*m_multipart
; /* parts of multipart */
997 struct mimepart
*m_parent
; /* enclosing multipart part */
998 char *m_ct_type
; /* content-type */
999 char *m_ct_type_plain
; /* content-type without specs */
1000 enum mimecontent m_mimecontent
; /* same in enum */
1001 char const *m_charset
; /* charset */
1002 char *m_ct_transfer_enc
; /* content-transfer-encoding */
1003 enum mimeenc m_mimeenc
; /* same in enum */
1004 char *m_partstring
; /* part level string */
1005 char *m_filename
; /* attachment filename */
1009 enum mflag m_flag
; /* flags */
1010 enum havespec m_have
; /* downloaded parts of the message */
1012 ui32_t m_spamscore
; /* Spam score as int, 24:8 bits */
1014 int m_block
; /* block number of this message */
1015 size_t m_offset
; /* offset in block of message */
1016 size_t m_size
; /* Bytes in the message */
1017 size_t m_xsize
; /* Bytes in the full message */
1018 long m_lines
; /* Lines in the message */
1019 long m_xlines
; /* Lines in the full message */
1020 time_t m_time
; /* time the message was sent */
1021 time_t m_date
; /* time in the 'Date' field */
1022 unsigned m_idhash
; /* hash on Message-ID for threads */
1023 struct message
*m_child
; /* first child of this message */
1024 struct message
*m_younger
; /* younger brother of this message */
1025 struct message
*m_elder
; /* elder brother of this message */
1026 struct message
*m_parent
; /* parent of this message */
1027 unsigned m_level
; /* thread level of message */
1028 long m_threadpos
; /* position in threaded display */
1030 unsigned long m_uid
; /* IMAP unique identifier */
1032 char *m_maildir_file
; /* original maildir file of msg */
1033 ui32_t m_maildir_hash
; /* hash of file name in maildir sub */
1034 int m_collapsed
; /* collapsed thread information */
1037 /* Given a file address, determine the block number it represents */
1038 #define mailx_blockof(off) ((int) ((off) / 4096))
1039 #define mailx_offsetof(off) ((int) ((off) % 4096))
1040 #define mailx_positionof(block, offset) ((off_t)(block) * 4096 + (offset))
1042 /* Argument types */
1044 ARG_MSGLIST
= 0, /* Message list type */
1045 ARG_STRLIST
= 1, /* A pure string */
1046 ARG_RAWLIST
= 2, /* Shell string list */
1047 ARG_NOLIST
= 3, /* Just plain 0 */
1048 ARG_NDMLIST
= 4, /* Message list, no defaults */
1049 ARG_ECHOLIST
= 5, /* Like raw list, but keep quote chars */
1050 ARG_ARGMASK
= 7, /* Mask of the above */
1052 ARG_A
= 1u<< 4, /* Needs an active mailbox */
1053 ARG_F
= 1u<< 5, /* Is a conditional command */
1054 ARG_H
= 1u<< 6, /* Never place in history */
1055 ARG_I
= 1u<< 7, /* Interactive command bit */
1056 ARG_M
= 1u<< 8, /* Legal from send mode bit */
1057 ARG_P
= 1u<< 9, /* Autoprint dot after command */
1058 ARG_R
= 1u<<10, /* Cannot be called from collect / recursion */
1059 ARG_T
= 1u<<11, /* Is a transparent command */
1060 ARG_V
= 1u<<12, /* Places data in temporary_arg_v_store */
1061 ARG_W
= 1u<<13 /* Illegal when read only bit */
1065 GTO
= 1, /* Grab To: line */
1066 GSUBJECT
= 2, /* Likewise, Subject: line */
1067 GCC
= 4, /* And the Cc: line */
1068 GBCC
= 8, /* And also the Bcc: line */
1070 GNL
= 16, /* Print blank line after */
1071 GDEL
= 32, /* Entity removed from list */
1072 GCOMMA
= 64, /* detract puts in commas */
1073 GUA
= 128, /* User-Agent field */
1074 GMIME
= 256, /* MIME 1.0 fields */
1075 GMSGID
= 512, /* a Message-ID */
1077 GIDENT
= 2048, /* From:, Reply-To: and Organization: field */
1078 GREF
= 4096, /* References: field */
1079 GDATE
= 8192, /* Date: field */
1080 GFULL
= 16384, /* include full names */
1081 GSKIN
= 32768, /* skin names */
1082 GEXTRA
= 65536, /* extra fields */
1083 GFILES
= 131072 /* include filename addresses */
1085 #define GMASK (GTO | GSUBJECT | GCC | GBCC)
1087 /* Structure used to pass about the current state of a message (header) */
1089 struct name
*h_to
; /* Dynamic "To:" string */
1090 char *h_subject
; /* Subject string */
1091 struct name
*h_cc
; /* Carbon copies string */
1092 struct name
*h_bcc
; /* Blind carbon copies */
1093 struct name
*h_ref
; /* References */
1094 struct attachment
*h_attach
; /* MIME attachments */
1095 char *h_charset
; /* preferred charset */
1096 struct name
*h_from
; /* overridden "From:" field */
1097 struct name
*h_replyto
; /* overridden "Reply-To:" field */
1098 struct name
*h_sender
; /* overridden "Sender:" field */
1099 char *h_organization
; /* overridden "Organization:" field */
1102 /* Handling of namelist nodes used in processing the recipients of mail and
1103 * aliases, inspection of mail-addresses and all that kind of stuff */
1105 NAME_NAME_SALLOC
= 1<< 0, /* .n_name is doped */
1106 NAME_FULLNAME_SALLOC
= 1<< 1, /* .n_fullname is doped */
1107 NAME_SKINNED
= 1<< 2, /* Is actually skin()ned */
1108 NAME_IDNA
= 1<< 3, /* IDNA was applied */
1109 NAME_ADDRSPEC_CHECKED
= 1<< 4, /* Address has been .. and */
1110 NAME_ADDRSPEC_ISFILE
= 1<< 5, /* ..is a file path */
1111 NAME_ADDRSPEC_ISPIPE
= 1<< 6, /* ..is a command for piping */
1112 NAME_ADDRSPEC_ISFILEORPIPE
= NAME_ADDRSPEC_ISFILE
| NAME_ADDRSPEC_ISPIPE
,
1113 NAME_ADDRSPEC_ERR_EMPTY
= 1<< 7, /* An empty string (or NULL) */
1114 NAME_ADDRSPEC_ERR_ATSEQ
= 1<< 8, /* Weird @ sequence */
1115 NAME_ADDRSPEC_ERR_CHAR
= 1<< 9, /* Invalid character */
1116 NAME_ADDRSPEC_ERR_IDNA
= 1<<10, /* IDNA convertion failed */
1117 NAME_ADDRSPEC_INVALID
= NAME_ADDRSPEC_ERR_EMPTY
|
1118 NAME_ADDRSPEC_ERR_ATSEQ
| NAME_ADDRSPEC_ERR_CHAR
|
1119 NAME_ADDRSPEC_ERR_IDNA
,
1122 _NAME_MAXWC
= 0xFFFFF,
1123 _NAME_MASKWC
= _NAME_MAXWC
<< _NAME_SHIFTWC
1126 /* In the !_ERR_EMPTY case, the failing character can be queried */
1127 #define NAME_ADDRSPEC_ERR_GETWC(F) \
1128 ((((unsigned int)(F) & _NAME_MASKWC) >> _NAME_SHIFTWC) & _NAME_MAXWC)
1129 #define NAME_ADDRSPEC_ERR_SET(F, E, WC) \
1131 (F) = ((F) & ~(NAME_ADDRSPEC_INVALID | _NAME_MASKWC)) |\
1132 (E) | (((unsigned int)(WC) & _NAME_MAXWC) << _NAME_SHIFTWC);\
1136 struct name
*n_flink
; /* Forward link in list. */
1137 struct name
*n_blink
; /* Backward list link */
1138 enum gfield n_type
; /* From which list it came */
1139 enum nameflags n_flags
; /* enum nameflags */
1140 char *n_name
; /* This fella's name */
1141 char *n_fullname
; /* Sometimes, name including comment */
1145 char const *ag_input
; /* Input string as given */
1146 size_t ag_ilen
; /* strlen() of input */
1147 size_t ag_iaddr_start
; /* Start of *addr-spec* in .ag_input */
1148 size_t ag_iaddr_aend
; /* ..and one past its end */
1149 char *ag_skinned
; /* Output (alloced if !=.ag_input) */
1150 size_t ag_slen
; /* strlen() of .ag_skinned */
1151 size_t ag_sdom_start
; /* Start of domain in .ag_skinned, */
1152 enum nameflags ag_n_flags
; /* enum nameflags of .ag_skinned */
1155 /* MIME attachments */
1157 AC_DEFAULT
, /* _get_lc() -> _iter_*() */
1158 AC_FIX_OUTCS
, /* _get_lc() -> "charset=" .a_charset */
1159 AC_FIX_INCS
, /* "charset=".a_input_charset (nocnv) */
1160 AC_TMPFILE
/* attachment.a_tmpf is converted */
1164 struct attachment
*a_flink
; /* Forward link in list. */
1165 struct attachment
*a_blink
; /* Backward list link */
1166 char const *a_name
; /* file name */
1167 char const *a_content_type
; /* content type */
1168 char const *a_content_disposition
; /* content disposition */
1169 char const *a_content_id
; /* content id */
1170 char const *a_content_description
; /* content description */
1171 char const *a_input_charset
; /* Interpretation depends on .a_conv */
1172 char const *a_charset
; /* ... */
1173 FILE *a_tmpf
; /* If AC_TMPFILE */
1174 enum attach_conv a_conv
; /* User chosen conversion */
1175 int a_msgno
; /* message number */
1179 struct group
*ge_link
; /* Next person in this group */
1180 char *ge_name
; /* This person's user name */
1184 struct grouphead
*g_link
; /* Next grouphead in list */
1185 char *g_name
; /* Name of this group */
1186 struct group
*g_list
; /* Users in group. */
1189 /* Structure of the hash table of ignored header fields */
1191 int i_count
; /* Number of entries */
1193 struct ignore
*i_link
; /* Next ignored field in bucket */
1194 char *i_field
; /* This ignored field */
1198 /* Token values returned by the scanner used for argument lists.
1199 * Also, sizes of scanner-related things */
1201 TEOL
= 0, /* End of the command line */
1202 TNUMBER
= 1, /* A message number */
1203 TDASH
= 2, /* A simple dash */
1204 TSTRING
= 3, /* A string (possibly containing -) */
1205 TDOT
= 4, /* A "." */
1206 TUP
= 5, /* An "^" */
1207 TDOLLAR
= 6, /* A "$" */
1208 TSTAR
= 7, /* A "*" */
1209 TOPEN
= 8, /* An '(' */
1210 TCLOSE
= 9, /* A ')' */
1211 TPLUS
= 10, /* A '+' */
1212 TERROR
= 11, /* A lexical error */
1213 TCOMMA
= 12, /* A ',' */
1214 TSEMI
= 13, /* A ';' */
1215 TBACK
= 14 /* A '`' */
1218 #define REGDEP 2 /* Maximum regret depth. */
1220 /* Constants for conditional commands. These describe whether we should be
1221 * executing stuff or not */
1223 COND_ANY
= 0, /* Execute in send or receive mode */
1224 COND_RCV
= 1, /* Execute in receive mode only */
1225 COND_SEND
= 2, /* Execute in send mode only */
1226 COND_TERM
= 3, /* Execute only if stdin is a tty */
1227 COND_NOTERM
= 4, /* Execute only if stdin not tty */
1228 COND_EXEC
= 5, /* Do execute this block */
1229 COND_NOEXEC
= 6 /* Don't execute this block */
1232 /* For the 'shortcut' and 'unshortcut' functionality */
1234 struct shortcut
*sh_next
; /* next shortcut in list */
1235 char *sh_short
; /* shortcut string */
1236 char *sh_long
; /* expanded form */
1239 /* Kludges to handle the change from setexit / reset to setjmp / longjmp */
1240 #define setexit() (void)sigsetjmp(srbuf, 1)
1241 #define reset(x) siglongjmp(srbuf, x)
1243 /* Content-Transfer-Encodings as defined in RFC 2045:
1244 * - Quoted-Printable, section 6.7
1245 * - Base64, section 6.8 */
1247 #define QP_LINESIZE (4 * 19) /* Max. compliant QP linesize */
1249 #define B64_LINESIZE (4 * 19) /* Max. compliant Base64 linesize */
1250 #define B64_ENCODE_INPUT_PER_LINE 57 /* Max. input for Base64 encode/line */
1252 /* xxx QP came later, maybe rewrite all to use mimecte_flags directly? */
1253 enum __mimecte_flags
{
1255 MIMECTE_SALLOC
= 1<<0, /* Use salloc(), not srealloc().. */
1256 /* ..result .s,.l point to user buffer of *_LINESIZE+[+[+]] bytes instead */
1258 MIMECTE_CRLF
= 1<<2, /* (encode) Append "\r\n" to lines */
1259 MIMECTE_LF
= 1<<3, /* (encode) Append "\n" to lines */
1260 /* (encode) If one of _CRLF/_LF is set, honour *_LINESIZE+[+[+]] and
1261 * inject the desired line-ending whenever a linewrap is desired */
1262 MIMECTE_MULTILINE
= 1<<4,
1263 /* (encode) Quote with header rules, do not generate soft NL breaks? */
1264 MIMECTE_ISHEAD
= 1<<5
1268 QP_NONE
= MIMECTE_NONE
,
1269 QP_SALLOC
= MIMECTE_SALLOC
,
1270 QP_BUF
= MIMECTE_BUF
,
1271 QP_ISHEAD
= MIMECTE_ISHEAD
1275 B64_NONE
= MIMECTE_NONE
,
1276 B64_SALLOC
= MIMECTE_SALLOC
,
1277 B64_BUF
= MIMECTE_BUF
,
1278 B64_CRLF
= MIMECTE_CRLF
,
1279 B64_LF
= MIMECTE_LF
,
1280 B64_MULTILINE
= MIMECTE_MULTILINE
1283 /* Locale-independent character classes */
1296 #define __ischarof(C, FLAGS) \
1297 (asciichar(C) && (class_char[(uc_it)(C)] & (FLAGS)) != 0)
1299 #define asciichar(c) ((uc_it)(c) <= 0177)
1300 #define alnumchar(c) __ischarof(c, C_DIGIT | C_OCTAL | C_UPPER | C_LOWER)
1301 #define alphachar(c) __ischarof(c, C_UPPER | C_LOWER)
1302 #define blankchar(c) __ischarof(c, C_BLANK)
1303 #define blankspacechar(c) __ischarof(c, C_BLANK | C_SPACE)
1304 #define cntrlchar(c) __ischarof(c, C_CNTRL)
1305 #define digitchar(c) __ischarof(c, C_DIGIT | C_OCTAL)
1306 #define lowerchar(c) __ischarof(c, C_LOWER)
1307 #define punctchar(c) __ischarof(c, C_PUNCT)
1308 #define spacechar(c) __ischarof(c, C_BLANK | C_SPACE | C_WHITE)
1309 #define upperchar(c) __ischarof(c, C_UPPER)
1310 #define whitechar(c) __ischarof(c, C_BLANK | C_WHITE)
1311 #define octalchar(c) __ischarof(c, C_OCTAL)
1313 #define upperconv(c) (lowerchar(c) ? (char)((uc_it)(c) - 'a' + 'A') : (c))
1314 #define lowerconv(c) (upperchar(c) ? (char)((uc_it)(c) - 'A' + 'a') : (c))
1316 #define fieldnamechar(c) \
1317 (asciichar(c) && (c) > 040 && (c) != 0177 && (c) != ':')
1319 /* Try to use alloca() for some function-local buffers and data, fall back to
1320 * smalloc()/free() if not available */
1322 # define ac_alloc(n) HAVE_ALLOCA(n)
1323 # define ac_free(n) do {UNUSED(n);} while (0)
1325 # define ac_alloc(n) smalloc(n)
1326 # define ac_free(n) free(n)
1329 /* Single-threaded, use unlocked I/O */
1330 #ifdef HAVE_PUTC_UNLOCKED
1332 # define getc(c) getc_unlocked(c)
1334 # define putc(c, f) putc_unlocked(c, f)
1336 # define putchar(c) putc_unlocked((c), stdout)
1339 /* Truncate a file to the last character written. This is useful just before
1340 * closing an old file that was opened for read/write */
1341 #define ftrunc(stream) \
1345 off = ftell(stream);\
1347 ftruncate(fileno(stream), off);\
1350 /* fflush() and rewind() */
1351 #define fflush_rewind(stream) \
1357 /* For saving the current directory and later returning */
1362 char cw_wd
[PATH_MAX
];
1367 * Global variable declarations
1369 * These become instantiated in main.c.
1374 # ifndef HAVE_AMALGAMATION
1383 VL gid_t effectivegid
; /* Saved from when we started up */
1384 VL gid_t realgid
; /* Saved from when we started up */
1386 VL
int mb_cur_max
; /* Value of MB_CUR_MAX */
1387 VL
int realscreenheight
; /* The real screen height */
1388 VL
int scrnwidth
; /* Screen width, or best guess */
1389 VL
int scrnheight
; /* Screen height/guess (4 header) */
1390 VL
int utf8
; /* Locale uses UTF-8 encoding */
1391 VL
int enc_has_state
; /* Encoding has shift states */
1393 VL
char **altnames
; /* List of alternate names of user */
1394 VL
char const *homedir
; /* Path name of home directory */
1395 VL
char const *myname
; /* My login name */
1396 VL
char const *progname
; /* Our name */
1397 VL
char const *tempdir
; /* The temporary directory */
1399 VL
int exit_status
; /* Exit status */
1400 VL
int options
; /* Bits of enum user_options */
1401 VL
char *option_r_arg
; /* Argument to -r option */
1402 VL
char const **smopts
; /* sendmail(1) opts from commline */
1403 VL
size_t smopts_count
; /* Entries in smopts */
1405 /* TODO Join as many of these state machine bits into a single carrier! */
1406 VL
int inhook
; /* Currently executing a hook */
1407 VL bool_t exec_last_comm_error
; /* Last execute() command failed */
1408 VL bool_t edit
; /* Indicates editing a file */
1409 VL bool_t did_print_dot
; /* Current message has been printed */
1410 VL bool_t list_saw_numbers
; /* Last *LIST saw numerics */
1411 VL bool_t msglist_is_single
; /* Last NDMLIST/MSGLIST chose 1 msg */
1412 VL bool_t loading
; /* Loading user definitions */
1413 VL bool_t sourcing
; /* Currently reading variant file */
1414 VL bool_t sawcom
; /* Set after first command */
1415 VL bool_t starting
; /* Still in startup code */
1416 VL bool_t var_clear_allow_undefined
; /* v?ok_[bv]clear(): no complain */
1417 VL
int noreset
; /* String resets suspended */
1419 /* XXX stylish sorting */
1420 VL
int msgCount
; /* Count of messages read in */
1421 VL
enum condition cond_state
; /* State of conditional exc. */
1422 VL
struct mailbox mb
; /* Current mailbox */
1423 VL
int image
; /* File descriptor for msg image */
1424 VL
char mailname
[PATH_MAX
]; /* Name of current file */
1425 VL
char displayname
[80 - 40]; /* Prettyfied for display */
1426 VL
char prevfile
[PATH_MAX
]; /* Name of previous file */
1427 VL
char const *account_name
; /* Current account name or NULL */
1428 VL off_t mailsize
; /* Size of system mailbox */
1429 VL
struct message
*dot
; /* Pointer to current message */
1430 VL
struct message
*prevdot
; /* Previous current message */
1431 VL
struct message
*message
; /* The actual message structure */
1432 VL
struct message
*threadroot
; /* first threaded message */
1433 VL
int imap_created_mailbox
; /* hack to get feedback from imap */
1434 VL
int msgspace
; /* Number of allocated struct m */
1436 VL
struct grouphead
*groups
[HSHSIZE
]; /* Pointer to active groups */
1437 VL
struct ignoretab ignore
[2]; /* ignored and retained fields
1438 * 0 is ignore, 1 is retain */
1439 VL
struct ignoretab saveignore
[2]; /* ignored and retained fields
1440 * on save to folder */
1441 VL
struct ignoretab allignore
[2]; /* special, ignore all headers */
1442 VL
struct ignoretab fwdignore
[2]; /* fields to ignore for forwarding */
1443 VL
struct shortcut
*shortcuts
; /* list of shortcuts */
1445 VL
struct time_current time_current
; /* time(3); send: mail1() XXXcarrier */
1446 VL
struct termios_state termios_state
; /* getpassword(); see commands().. */
1449 VL
struct colour_table
*colour_table
;
1453 VL
enum ssl_verify_level ssl_verify_level
; /* SSL verification level */
1464 VL sigjmp_buf srbuf
;
1466 VL sighandler_type dflpipe
;
1467 VL sighandler_type handlerstacktop
;
1468 #define handlerpush(f) (savedtop = handlerstacktop, handlerstacktop = (f))
1469 #define handlerpop() (handlerstacktop = savedtop)
1471 VL
char *temporary_arg_v_store
;
1473 /* The remaining variables need initialization */
1475 #ifndef HAVE_AMALGAMATION
1476 VL
char const month_names
[12 + 1][4];
1477 VL
char const weekday_names
[7 + 1][4];
1479 VL
char const uagent
[]; /* User agent */
1480 VL
char const version
[]; /* The version string */
1481 VL
char const features
[]; /* The "feature string" */
1483 VL uc_it
const class_char
[];
1487 * Finally, let's include the function prototypes XXX embed
1492 /* vim:set fenc=utf-8:s-it-mode */