1 /*
2  * Heirloom mailx - a mail user agent derived from Berkeley Mail.
3  *
4  * Copyright (c) 2000-2004 Gunnar Ritter, Freiburg i. Br., Germany.
5  */
6 /*
7  * Copyright (c) 1980, 1993
8  *	The Regents of the University of California.  All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *	This product includes software developed by the University of
21  *	California, Berkeley and its contributors.
22  * 4. Neither the name of the University nor the names of its contributors
23  *    may be used to endorse or promote products derived from this software
24  *    without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
27  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
30  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
31  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
32  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
33  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
35  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
36  * SUCH DAMAGE.
37  *
38  *	Sccsid @(#)glob.h	2.27 (gritter) 6/16/07
39  */
40 
41 /*
42  * A bunch of global variable declarations lie herein.
43  * def.h must be included first.
44  */
45 
46 #if defined(_MAIL_GLOBS_)
47 #  undef  _E
48 #  define _E
49 #else
50 #  define _E	extern
51 #endif
52 
53 _E int	msgCount;			/* Count of messages read in */
54 _E int	rcvmode;			/* True if receiving mail */
55 _E int	sawcom;				/* Set after first command */
56 _E int	Iflag;				/* -I show Newsgroups: field */
57 _E char	*Tflag;				/* -T temp file for netnews */
58 _E int	senderr;			/* An error while checking */
59 _E int	edit;				/* Indicates editing a file */
60 _E int	noreset;			/* String resets suspended */
61 _E int	sourcing;			/* Currently reading variant file */
62 _E int	loading;			/* Loading user definitions */
63 _E enum condition	cond;		/* Current state of conditional exc. */
64 _E struct mailbox mb;			/* Current mailbox */
65 _E int	image;				/* File descriptor for image of msg */
66 _E FILE	*input;				/* Current command input file */
67 _E char	mailname[PATHSIZE];		/* Name of current file */
68 _E char	mboxname[PATHSIZE];		/* Name of mbox */
69 _E char	prevfile[PATHSIZE];		/* Name of previous file */
70 _E char	*homedir;			/* Path name of home directory */
71 _E char *progname;			/* our name */
72 _E char	*myname;			/* My login name */
73 extern const char *version;		/* version string */
74 _E off_t mailsize;			/* Size of system mailbox */
75 _E struct message *dot;			/* Pointer to current message */
76 _E struct message *prevdot;		/* Previous current message */
77 _E struct message *message;		/* The actual message structure */
78 _E struct message *threadroot;		/* first threaded message */
79 _E int msgspace;			/* Number of allocated struct m */
80 _E struct var *variables[HSHSIZE];	/* Pointer to active var list */
81 _E struct grouphead *groups[HSHSIZE];	/* Pointer to active groups */
82 _E struct ignoretab ignore[2];		/* ignored and retained fields
83 					   0 is ignore, 1 is retain */
84 _E struct ignoretab saveignore[2];	/* ignored and retained fields
85 					   on save to folder */
86 _E struct ignoretab allignore[2];	/* special, ignore all headers */
87 _E struct ignoretab fwdignore[2];	/* fields to ignore for forwarding */
88 _E char	**altnames;			/* List of alternate names for user */
89 _E int	debug;				/* Debug flag set */
90 _E int	scrnwidth;			/* Screen width, or best guess */
91 _E int	scrnheight;			/* Screen height, or best guess,
92 					   for "header" command */
93 _E int	realscreenheight;		/* the real screen height */
94 _E gid_t	effectivegid;		/* Saved from when we started up */
95 _E gid_t	realgid;		/* Saved from when we started up */
96 _E int	exit_status;			/* Exit status */
97 _E int	is_a_tty[2];			/* isatty(0), isatty(1) */
98 _E int	did_print_dot;			/* current message has been printed */
99 _E int	tildeflag;			/* enable tilde escapes */
100 _E char	*uflag;				/* name given with -u option */
101 _E struct shortcut	*shortcuts;	/* list of shortcuts */
102 _E int	mb_cur_max;			/* value of MB_CUR_MAX */
103 _E int	imap_created_mailbox;		/* hack to get feedback from imap */
104 _E int	unset_allow_undefined;		/* allow to unset undefined variables */
105 _E int	inhook;				/* currently executing a hook */
106 _E int	starting;			/* still in startup code */
107 _E char *wantcharset;			/* overrides the "charset" variable */
108 _E int	utf8;				/* UTF-8 encoding in use for locale */
109 _E int	Rflag;				/* open all folders read-only */
110 
111 #ifdef	USE_SSL
112 _E enum ssl_vrfy_level	ssl_vrfy_level;	/* SSL verification level */
113 #endif
114 
115 #ifdef	HAVE_ICONV
116 _E iconv_t iconvd;
117 #endif
118 
119 #ifdef	HAVE_CATGETS
120 _E nl_catd	catd;
121 #endif
122 
123 /*
124  * These are initialized strings.
125  */
126 extern char *us_ascii;			/* "us-ascii" */
127 extern const char *month_names[];
128 
129 #include <setjmp.h>
130 
131 _E sigjmp_buf	srbuf;
132 _E int		interrupts;
133 _E sighandler_type	handlerstacktop;
134 #define	handlerpush(f)	(savedtop = handlerstacktop, handlerstacktop = (f))
135 #define	handlerpop()	(handlerstacktop = savedtop)
136 extern sighandler_type	dflpipe;
137 
138 /*
139  * The pointers for the string allocation routines,
140  * there are NSPACE independent areas.
141  * The first holds STRINGSIZE bytes, the next
142  * twice as much, and so on.
143  */
144 
145 #define	NSPACE	25			/* Total number of string spaces */
146 _E struct strings {
147 	char	*s_topFree;		/* Beginning of this area */
148 	char	*s_nextFree;		/* Next alloctable place here */
149 	unsigned s_nleft;		/* Number of bytes left here */
150 } stringdope[NSPACE];
151 
152 #undef  _E
153