Commit 46c1d554 46c1d5542f40d23f52ac4d2cdb72368b0160d051 by Sergey Poznyakoff

In struct mail_command_entry changed `isflow' field to `flags'. It contains

information about semantics of the command.
1 parent 79aadeff
Showing 1 changed file with 68 additions and 14 deletions
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
21 #ifdef HAVE_CONFIG_H 21 #ifdef HAVE_CONFIG_H
22 #include <config.h> 22 #include <config.h>
23 #endif 23 #endif
24
25 #include <errno.h> 24 #include <errno.h>
26 #include <stdio.h> 25 #include <stdio.h>
27 #include <stdlib.h> 26 #include <stdlib.h>
...@@ -29,11 +28,15 @@ ...@@ -29,11 +28,15 @@
29 #include <string.h> 28 #include <string.h>
30 #include <sys/wait.h> 29 #include <sys/wait.h>
31 #include <sys/types.h> 30 #include <sys/types.h>
32 #include <stdarg.h> 31 #ifdef HAVE_STDARG_H
32 # include <stdarg.h>
33 #else
34 # include <varargs.h>
35 #endif
33 #include <signal.h> 36 #include <signal.h>
34 #include <ctype.h> 37 #include <ctype.h>
35 #ifdef HAVE_PATHS_H 38 #ifdef HAVE_PATHS_H
36 #include <paths.h> 39 # include <paths.h>
37 #endif 40 #endif
38 41
39 #include <argp.h> 42 #include <argp.h>
...@@ -73,10 +76,15 @@ extern "C" { ...@@ -73,10 +76,15 @@ extern "C" {
73 typedef int function_t (); 76 typedef int function_t ();
74 #endif 77 #endif
75 78
79 /* Values for mail_command_entry.flags */
80 #define EF_REG 0x00 /* Regular command */
81 #define EF_FLOW 0x01 /* Flow control command */
82 #define EF_SEND 0x02 /* Send command */
83
76 struct mail_command_entry { 84 struct mail_command_entry {
77 char *shortname; 85 char *shortname;
78 char *longname; 86 char *longname;
79 int isflow; /* 1 if this is a flow-control function */ 87 int flags;
80 function_t *func; 88 function_t *func;
81 char *synopsis; 89 char *synopsis;
82 }; 90 };
...@@ -87,13 +95,27 @@ struct mail_env_entry { ...@@ -87,13 +95,27 @@ struct mail_env_entry {
87 char *value; 95 char *value;
88 }; 96 };
89 97
98 struct send_environ
99 {
100 char *to;
101 char *cc;
102 char *bcc;
103 char *subj;
104 int done;
105 char *filename;
106 FILE *file;
107 FILE *ofile;
108 };
109
90 /* Global variables and constants*/ 110 /* Global variables and constants*/
91 extern mailbox_t mbox; 111 extern mailbox_t mbox;
92 extern unsigned int cursor; 112 extern unsigned int cursor;
93 extern unsigned int realcursor; 113 extern unsigned int realcursor;
94 extern unsigned int total; 114 extern unsigned int total;
95 extern FILE *ofile; 115 extern FILE *ofile;
116 extern int interactive;
96 extern const struct mail_command_entry mail_command_table[]; 117 extern const struct mail_command_entry mail_command_table[];
118 extern const struct mail_command_entry mail_escape_table[];
97 119
98 /* Functions */ 120 /* Functions */
99 int mail_alias __P((int argc, char **argv)); 121 int mail_alias __P((int argc, char **argv));
...@@ -137,31 +159,55 @@ int mail_unalias __P((int argc, char **argv)); ...@@ -137,31 +159,55 @@ int mail_unalias __P((int argc, char **argv));
137 int mail_undelete __P((int argc, char **argv)); 159 int mail_undelete __P((int argc, char **argv));
138 int mail_unset __P((int argc, char **argv)); 160 int mail_unset __P((int argc, char **argv));
139 int mail_visual __P((int argc, char **argv)); 161 int mail_visual __P((int argc, char **argv));
162 int mail_warranty __P((int argc, char **argv));
140 int mail_write __P((int argc, char **argv)); 163 int mail_write __P((int argc, char **argv));
141 int mail_z __P((int argc, char **argv)); 164 int mail_z __P((int argc, char **argv));
165 int mail_eq __P((int argc, char **argv)); /* command = */
166
167 int if_cond __P((void));
142 168
143 void mail_mainloop __P((char *(*input) __P((void *, int)), void *closure, int do_history)); 169 void mail_mainloop __P((char *(*input) __P((void *, int)), void *closure, int do_history));
144 int mail_copy0 __P((int argc, char **argv, int mark)); 170 int mail_copy0 __P((int argc, char **argv, int mark));
145 int mail_send0 __P((char *to, char *cc, char *bcc, char *subj, int save_to)); 171 int mail_send0 __P((struct send_environ *env, int save_to));
172 void free_env_headers __P((struct send_environ *env));
173
174 void print_message __P((message_t mesg, char *prefix, int all_headers, FILE *file));
175
146 int mail_mbox_commit __P((void)); 176 int mail_mbox_commit __P((void));
147 int mail_is_alt_name __P((char *name)); 177 int mail_is_my_name __P((char *name));
178 void mail_set_my_name __P((char *name));
179 char *mail_whoami __P((void));
148 int mail_header_is_visible __P((char *str)); 180 int mail_header_is_visible __P((char *str));
149 int mail_mbox_close __P((void)); 181 int mail_mbox_close __P((void));
150 182
151 int if_cond __P((void)); 183 int var_shell __P((int argc, char **argv, struct send_environ *env));
152 void mail_set_is_terminal __P((int val)); 184 int var_command __P((int argc, char **argv, struct send_environ *env));
153 int mail_is_terminal __P((void)); 185 int var_help __P((int argc, char **argv, struct send_environ *env));
154 186 int var_sign __P((int argc, char **argv, struct send_environ *env));
155 int mail_eq __P((int argc, char **argv)); /* command = */ 187 int var_bcc __P((int argc, char **argv, struct send_environ *env));
188 int var_cc __P((int argc, char **argv, struct send_environ *env));
189 int var_deadletter __P((int argc, char **argv, struct send_environ *env));
190 int var_editor __P((int argc, char **argv, struct send_environ *env));
191 int var_print __P((int argc, char **argv, struct send_environ *env));
192 int var_headers __P((int argc, char **argv, struct send_environ *env));
193 int var_insert __P((int argc, char **argv, struct send_environ *env));
194 int var_quote __P((int argc, char **argv, struct send_environ *env));
195 int var_type_input __P((int argc, char **argv, struct send_environ *env));
196 int var_read __P((int argc, char **argv, struct send_environ *env));
197 int var_subj __P((int argc, char **argv, struct send_environ *env));
198 int var_to __P((int argc, char **argv, struct send_environ *env));
199 int var_visual __P((int argc, char **argv, struct send_environ *env));
200 int var_write __P((int argc, char **argv, struct send_environ *env));
201 int var_exit __P((int argc, char **argv, struct send_environ *env));
202 int var_pipe __P((int argc, char **argv, struct send_environ *env));
156 203
204
157 int util_expand_msglist __P((const int argc, char **argv, int **list)); 205 int util_expand_msglist __P((const int argc, char **argv, int **list));
158 int util_do_command __P((const char *cmd, ...)); 206 int util_do_command __P((const char *cmd, ...));
159 int util_msglist_command __P((function_t *func, int argc, char **argv, int set_cursor)); 207 int util_msglist_command __P((function_t *func, int argc, char **argv, int set_cursor));
160 function_t* util_command_get __P((char *cmd)); 208 function_t* util_command_get __P((char *cmd));
161 char **util_command_completion __P((char *cmd, int start, int end));
162 char *util_command_generator __P((char *text, int state));
163 char *util_stripwhite __P((char *string)); 209 char *util_stripwhite __P((char *string));
164 struct mail_command_entry util_find_entry __P((char *cmd)); 210 struct mail_command_entry util_find_entry __P((const struct mail_command_entry *table, char *cmd));
165 int util_getcols __P((void)); 211 int util_getcols __P((void));
166 int util_getlines __P((void)); 212 int util_getlines __P((void));
167 int util_screen_lines __P((void)); 213 int util_screen_lines __P((void));
...@@ -181,7 +227,15 @@ void util_strcat __P((char **dest, char *str)); ...@@ -181,7 +227,15 @@ void util_strcat __P((char **dest, char *str));
181 void util_escape_percent __P((char **str)); 227 void util_escape_percent __P((char **str));
182 char *util_outfolder_name __P((char *str)); 228 char *util_outfolder_name __P((char *str));
183 void util_save_outgoing __P((message_t msg, char *savefile)); 229 void util_save_outgoing __P((message_t msg, char *savefile));
230 void util_error __P((const char *format, ...));
231 int util_help __P((const struct mail_command_entry *table, char *word));
232 int util_tempfile __P((char **namep));
184 233
234 int ml_got_interrupt __P((void));
235 void ml_clear_interrupt __P((void));
236 void ml_readline_init __P((void));
237 int ml_reread __P((char *prompt, char **text));
238
185 char *alias_expand __P((char *name)); 239 char *alias_expand __P((char *name));
186 void alias_destroy __P((char *name)); 240 void alias_destroy __P((char *name));
187 241
......