mail.h
8.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
/* GNU mailutils - a suite of utilities for electronic mail
Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifndef _MAIL_H
#define _MAIL_H 1
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifdef DMALLOC
# include <dmalloc.h>
#endif
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/wait.h>
#include <sys/types.h>
#ifdef HAVE_STDARG_H
# include <stdarg.h>
#else
# include <varargs.h>
#endif
#include <signal.h>
#include <ctype.h>
#ifdef HAVE_PATHS_H
# include <paths.h>
#endif
#include <argp.h>
#ifdef HAVE_READLINE_READLINE_H
#include <readline/readline.h>
#include <readline/history.h>
#endif
#include <mailutils/mailbox.h>
#include <mailutils/message.h>
#include <mailutils/header.h>
#include <mailutils/body.h>
#include <mailutils/registrar.h>
#include <mailutils/list.h>
#include <mailutils/iterator.h>
#include <mailutils/address.h>
#include <mailutils/mutil.h>
#include <argcv.h>
#include <getline.h>
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __P
# ifdef __STDC__
# define __P(args) args
# else
# define __P(args) ()
# endif
#endif /*__P */
/* Type definitions */
#ifndef function_t
typedef int function_t ();
#endif
/* Values for mail_command_entry.flags */
#define EF_REG 0x00 /* Regular command */
#define EF_FLOW 0x01 /* Flow control command */
#define EF_SEND 0x02 /* Send command */
struct mail_command_entry {
char *shortname;
char *longname;
int flags;
function_t *func;
char *synopsis;
};
struct mail_env_entry {
char *var;
int set;
char *value;
};
struct send_environ
{
char *to;
char *cc;
char *bcc;
char *subj;
int done;
char *filename;
FILE *file;
FILE *ofile;
char **outfiles;
int nfiles;
};
/* Global variables and constants*/
extern mailbox_t mbox;
extern unsigned int cursor;
extern unsigned int realcursor;
extern unsigned int total;
extern FILE *ofile;
extern int interactive;
extern const struct mail_command_entry mail_command_table[];
extern const struct mail_command_entry mail_escape_table[];
/* Functions */
int mail_alias __P((int argc, char **argv));
int mail_alt __P((int argc, char **argv)); /* command alternates */
int mail_cd __P((int argc, char **argv));
int mail_copy __P((int argc, char **argv));
int mail_decode __P((int argc, char **argv));
int mail_delete __P((int argc, char **argv));
int mail_discard __P((int argc, char **argv));
int mail_dp __P((int argc, char **argv));
int mail_echo __P((int argc, char **argv));
int mail_edit __P((int argc, char **argv));
int mail_else __P((int argc, char **argv));
int mail_endif __P((int argc, char **argv));
int mail_exit __P((int argc, char **argv));
int mail_file __P((int argc, char **argv));
int mail_folders __P((int argc, char **argv));
int mail_followup __P((int argc, char **argv));
int mail_from __P((int argc, char **argv));
int mail_headers __P((int argc, char **argv));
int mail_hold __P((int argc, char **argv));
int mail_help __P((int argc, char **argv));
int mail_if __P((int argc, char **argv));
int mail_inc __P((int argc, char **argv));
int mail_list __P((int argc, char **argv));
int mail_send __P((int argc, char **argv)); /* command mail */
int mail_mbox __P((int argc, char **argv));
int mail_next __P((int argc, char **argv));
int mail_pipe __P((int argc, char **argv));
int mail_previous __P((int argc, char **argv));
int mail_print __P((int argc, char **argv));
int mail_quit __P((int argc, char **argv));
int mail_reply __P((int argc, char **argv));
int mail_retain __P((int argc, char **argv));
int mail_save __P((int argc, char **argv));
int mail_set __P((int argc, char **argv));
int mail_shell __P((int argc, char **argv));
int mail_size __P((int argc, char **argv));
int mail_source __P((int argc, char **argv));
int mail_summary __P((int argc, char **argv));
int mail_top __P((int argc, char **argv));
int mail_touch __P((int argc, char **argv));
int mail_unalias __P((int argc, char **argv));
int mail_undelete __P((int argc, char **argv));
int mail_unset __P((int argc, char **argv));
int mail_version __P((int argc, char **argv));
int mail_visual __P((int argc, char **argv));
int mail_warranty __P((int argc, char **argv));
int mail_write __P((int argc, char **argv));
int mail_z __P((int argc, char **argv));
int mail_eq __P((int argc, char **argv)); /* command = */
int if_cond __P((void));
void mail_mainloop __P((char *(*input) __P((void *, int)), void *closure, int do_history));
int mail_copy0 __P((int argc, char **argv, int mark));
int mail_send0 __P((struct send_environ *env, int save_to));
void free_env_headers __P((struct send_environ *env));
void print_message __P((message_t mesg, char *prefix, int all_headers, FILE *file));
int mail_mbox_commit __P((void));
int mail_is_my_name __P((char *name));
void mail_set_my_name __P((char *name));
char *mail_whoami __P((void));
int mail_header_is_visible __P((char *str));
int mail_mbox_close __P((void));
int var_shell __P((int argc, char **argv, struct send_environ *env));
int var_command __P((int argc, char **argv, struct send_environ *env));
int var_help __P((int argc, char **argv, struct send_environ *env));
int var_sign __P((int argc, char **argv, struct send_environ *env));
int var_bcc __P((int argc, char **argv, struct send_environ *env));
int var_cc __P((int argc, char **argv, struct send_environ *env));
int var_deadletter __P((int argc, char **argv, struct send_environ *env));
int var_editor __P((int argc, char **argv, struct send_environ *env));
int var_print __P((int argc, char **argv, struct send_environ *env));
int var_headers __P((int argc, char **argv, struct send_environ *env));
int var_insert __P((int argc, char **argv, struct send_environ *env));
int var_quote __P((int argc, char **argv, struct send_environ *env));
int var_type_input __P((int argc, char **argv, struct send_environ *env));
int var_read __P((int argc, char **argv, struct send_environ *env));
int var_subj __P((int argc, char **argv, struct send_environ *env));
int var_to __P((int argc, char **argv, struct send_environ *env));
int var_visual __P((int argc, char **argv, struct send_environ *env));
int var_write __P((int argc, char **argv, struct send_environ *env));
int var_exit __P((int argc, char **argv, struct send_environ *env));
int var_pipe __P((int argc, char **argv, struct send_environ *env));
int util_expand_msglist __P((const int argc, char **argv, int **list));
int util_do_command __P((const char *cmd, ...));
int util_msglist_command __P((function_t *func, int argc, char **argv, int set_cursor));
function_t* util_command_get __P((char *cmd));
char *util_stripwhite __P((char *string));
struct mail_command_entry util_find_entry __P((const struct mail_command_entry *table, char *cmd));
int util_getcols __P((void));
int util_getlines __P((void));
int util_screen_lines __P((void));
struct mail_env_entry *util_find_env __P((const char *var));
int util_printenv __P((int set));
int util_setenv __P((const char *name, const char *value, int overwrite));
int util_isdeleted __P((int message));
char *util_get_homedir __P((void));
char *util_fullpath __P((char *inpath));
char *util_get_sender __P((int msgno, int strip));
void util_slist_print __P((list_t list, int nl));
int util_slist_lookup __P((list_t list, char *str));
void util_slist_add __P((list_t *list, char *value));
void util_slist_destroy __P((list_t *list));
char *util_slist_to_string __P((list_t list, char *delim));
void util_strcat __P((char **dest, char *str));
void util_strupper __P((char *str));
void util_escape_percent __P((char **str));
char *util_outfolder_name __P((char *str));
void util_save_outgoing __P((message_t msg, char *savefile));
void util_error __P((const char *format, ...));
int util_help __P((const struct mail_command_entry *table, char *word));
int util_tempfile __P((char **namep));
void *util_malloc __P((size_t size));
void *util_calloc __P((size_t nitems, size_t size));
int ml_got_interrupt __P((void));
void ml_clear_interrupt __P((void));
void ml_readline_init __P((void));
int ml_reread __P((char *prompt, char **text));
char *alias_expand __P((char *name));
void alias_destroy __P((char *name));
#ifndef HAVE_READLINE_READLINE_H
char *readline __P((const char *prompt));
#endif
#ifndef _PATH_SENDMAIL
#define _PATH_SENDMAIL "/usr/lib/sendmail"
#endif
/* Message attributes */
#define MAIL_ATTRIBUTE_MBOXED 0x0001
#define MAIL_ATTRIBUTE_SAVED 0x0002
#ifdef __cplusplus
}
#endif
#endif /* _MAIL_H */