]> diplodocus.org Git - nmh/blob - h/prototypes.h
Removed a bunch of unreachable break statements found by
[nmh] / h / prototypes.h
1
2 /*
3 * prototypes.h -- various prototypes
4 *
5 * If you modify functions here, please document their current behavior
6 * as much as practical.
7 */
8
9 /*
10 * missing system prototypes
11 */
12 #if ! defined(HAVE_TERMCAP_H) && ! defined (HAVE_NCURSES_TERMCAP_H)
13 extern int tgetent (char *bp, char *name);
14 extern int tgetnum (char *id);
15 extern int tgetflag (char *id);
16 extern char *tgetstr (char *id, char **area);
17 extern char *tgoto (char *cm, int destcol, int destline);
18 extern int tputs (char *cp, int affcnt, int (*outc) (int));
19 #endif
20
21 /*
22 * prototype from config.h
23 */
24 char *etcpath(char *);
25
26 /*
27 * prototypes from the nmh subroutine library
28 */
29
30 struct msgs_array;
31
32 void add_profile_entry (const char *, const char *);
33 void adios (char *, char *, ...) NORETURN;
34 void admonish (char *, char *, ...);
35 void advertise (char *, char *, char *, va_list);
36 void advise (char *, char *, ...);
37 char **argsplit (char *, char **, int *);
38 void argsplit_msgarg (struct msgs_array *, char *, char **);
39 void argsplit_insert (struct msgs_array *, char *, char **);
40 void arglist_free (char *, char **);
41 void ambigsw (char *, struct swit *);
42 int atooi(char *);
43 char **brkstring (char *, char *, char *);
44 int check_charset (char *, int);
45 int client(char *, char *, char *, int, int);
46 void closefds(int);
47 char *concat (const char *, ...);
48 int context_del (char *);
49 char *context_find (char *);
50 int context_foil (char *);
51 void context_read (void);
52 void context_replace (char *, char *);
53 void context_save (void);
54 char *copy (const char *, char *);
55 char **copyip (char **, char **, int);
56 void cpydata (int, int, char *, char *);
57 void cpydgst (int, int, char *, char *);
58 char *cpytrim (const char *);
59 int decode_rfc2047 (char *, char *, size_t);
60 void discard (FILE *);
61 int default_done (int);
62
63 /*
64 * Encode a message header using RFC 2047 encoding. If the message contains
65 * no non-ASCII characters, then leave the header as-is.
66 *
67 * Arguments include:
68 *
69 * name - Message header name
70 * value - Message header content; must point to allocated memory
71 * (may be changed if encoding is necessary)
72 * encoding - Encoding type. May be one of CE_UNKNOWN (function chooses
73 * the encoding), CE_BASE64 or CE_QUOTED
74 * charset - Charset used for encoding. If NULL, obtain from system
75 * locale.
76 *
77 * Returns 0 on success, any other value on failure.
78 */
79
80 int encode_rfc2047(const char *name, char **value, int encoding,
81 const char *charset);
82
83 void escape_display_name (char *, size_t);
84 void escape_local_part (char *, size_t);
85 int ext_hook(char *, char *, char *);
86 int fdcompare (int, int);
87 int folder_addmsg (struct msgs **, char *, int, int, int, int, char *);
88 int folder_delmsgs (struct msgs *, int, int);
89 void folder_free (struct msgs *);
90 int folder_pack (struct msgs **, int);
91
92 /*
93 * Read a MH folder structure and return an allocated "struct msgs"
94 * corresponding to the contents of the folder.
95 *
96 * Arguments include:
97 *
98 * name - Name of folder
99 * lockflag - If true, write-lock (and keep open) metadata files.
100 * See comments for seq_read() for more information.
101 */
102 struct msgs *folder_read (char *name, int lockflag);
103
104 struct msgs *folder_realloc (struct msgs *, int, int);
105 int gans (char *, struct swit *);
106 char **getans (char *, struct swit *);
107 #ifdef READLINE_SUPPORT
108 char **getans_via_readline (char *, struct swit *);
109 #endif /* READLINE_SUPPORT */
110 int getanswer (char *);
111 char **getarguments (char *, int, char **, int);
112 char *get_charset(void);
113 char *getcpy (const char *);
114 char *get_default_editor(void);
115 char *getfolder(int);
116 /*
117 * Lock open/close routines.
118 *
119 * The lk[f]opendata() functions are designed to open "data" files (anything
120 * not a mail spool file) using the locking mechanism configured for data
121 * files. The lk[f]openspool() functions are for opening the mail spool
122 * file, which will use the locking algorithm configured for the mail
123 * spool.
124 *
125 * Files opened for reading are locked with a read lock (if possible by
126 * the underlying lock mechanism), files opened for writing are locked
127 * using an exclusive lock.
128 */
129 int lkclosedata(int, const char *);
130 int lkclosespool(int, const char *);
131 int lkfclosedata(FILE *, const char *);
132 int lkfclosespool(FILE *, const char *);
133 FILE *lkfopendata(const char *, const char *);
134 int lkopendata(const char *, int, mode_t);
135 FILE *lkfopenspool(const char *, const char *);
136 int lkopenspool(const char *, int, mode_t);
137 int m_atoi (char *);
138 char *m_backup (char *);
139 int m_convert (struct msgs *, char *);
140 char *m_draft (char *, char *, int, int *);
141 void m_eomsbr (m_getfld_state_t, int (*)(int));
142 void m_getfld_state_reset (m_getfld_state_t *);
143 void m_getfld_state_destroy (m_getfld_state_t *);
144 void m_getfld_track_filepos (m_getfld_state_t *, FILE *);
145 int m_getfld (m_getfld_state_t *, char[NAMESZ], char *, int *, FILE *);
146 int m_gmprot (void);
147 char *m_maildir (char *);
148 char *m_mailpath (char *);
149 char *m_name (int);
150 int m_putenv (char *, char *);
151 int m_rand (unsigned char *, size_t);
152 char *m_mktemp(const char *, int *, FILE **);
153 char *m_mktemp2(const char *, const char *, int *, FILE **);
154 void m_unknown(m_getfld_state_t *, FILE *);
155 int makedir (char *);
156 char *message_id (time_t, int);
157 char *nmh_getpass(const char *);
158 char *norm_charmap(char *);
159 char *new_fs (char *, char *, char *);
160 char *path(char *, int);
161 int peekc(FILE *ib);
162 int pidwait (pid_t, int);
163 int pidstatus (int, FILE *, char *);
164 char *pluspath(char *);
165 void print_help (char *, struct swit *, int);
166 void print_sw (char *, struct swit *, char *, FILE *);
167 void print_version (char *);
168 void push (void);
169 char *pwd (void);
170 char *r1bindex(char *, int);
171 void readconfig (struct node **, FILE *, char *, int);
172 int refile (char **, char *);
173 void ruserpass (char *, char **, char **);
174 int remdir (char *);
175 void scan_detect_mbox_style (FILE *);
176 void scan_finished ();
177 void scan_eom_action (int (*)());
178 void scan_reset_m_getfld_state ();
179 int seq_addmsg (struct msgs *, char *, int, int, int);
180 int seq_addsel (struct msgs *, char *, int, int);
181 char *seq_bits (struct msgs *);
182 int seq_delmsg (struct msgs *, char *, int);
183 int seq_delsel (struct msgs *, char *, int, int);
184 int seq_getnum (struct msgs *, char *);
185 char *seq_list (struct msgs *, char *);
186 int seq_nameok (char *);
187 void seq_print (struct msgs *, char *);
188 void seq_printall (struct msgs *);
189
190 /*
191 * Read the sequence files for the folder referenced in the given
192 * struct msgs and populate the sequence entries in the struct msgs.
193 *
194 * Arguments:
195 *
196 * mp - Folder structure to add sequence entries to
197 * lockflag - If true, obtain a write lock on the sequence file.
198 * Additionally, the sequence file will remain open
199 * and a pointer to the filehandle will be stored in
200 * folder structure, where it will later be used by
201 * seq_save().
202 */
203 void seq_read (struct msgs * mp, int lockflag);
204 void seq_save (struct msgs *);
205 void seq_setcur (struct msgs *, int);
206 void seq_setprev (struct msgs *);
207 void seq_setunseen (struct msgs *, int);
208 int showfile (char **, char *);
209 int smatch(char *, struct swit *);
210
211 /*
212 * Convert a set of bit flags to printable format.
213 *
214 * Arguments:
215 *
216 * buffer - Buffer to output string to.
217 * size - Size of buffer in bytes. Buffer is always NUL terminated.
218 * flags - Binary flags to output
219 * bitfield - Textual representation of bits to output. This string
220 * is in the following format:
221 *
222 * Option byte 0x01 STRING1 0x02 STRING2 ....
223 *
224 * The first byte is an option byte to snprintb(). Currently the only option
225 * supported is 0x08, which indicates that the flags should be output in
226 * octal format; if the option byte is any other value, the flags will be
227 * output in hexadecimal.
228 *
229 * After the option bytes are series of text strings, prefixed by the number
230 * of the bit they correspond to. For example, the bitfield string:
231 *
232 * "\020\01FLAG1\02FLAG2\03FLAG3\04FLAG4"
233 *
234 * will output the following string if "flags" is set to 0x09:
235 *
236 * 0x2<FLAG1,FLAG4>
237 *
238 * You don't have to use octal in the bitfield string, that's just the
239 * convention currently used by the nmh code. The order of flags in the
240 * bitfield string is not significant, but again, general convention is
241 * from least significant bit to most significant.
242 */
243 char *snprintb (char *buffer, size_t size, unsigned flags, char *bitfield);
244 int ssequal (char *, char *);
245 int stringdex (char *, char *);
246 char *trimcpy (char *);
247 int unputenv (char *);
248
249 /*
250 * Remove quotes and quoted-pair sequences from RFC-5322 atoms.
251 *
252 * Currently the actual algorithm is simpler than it technically should
253 * be: any quotes are simply eaten, unless they're preceded by the escape
254 * character (\). This seems to be sufficient for our needs for now.
255 *
256 * Arguments:
257 *
258 * input - The input string
259 * output - The output string; is assumed to have at least as much
260 * room as the input string. At worst the output string will
261 * be the same size as the input string; it might be smaller.
262 *
263 */
264 void unquote_string(const char *input, char *output);
265 int uprf (char *, char *);
266 int vfgets (FILE *, char **);
267 char *write_charset_8bit (void);
268
269
270 /*
271 * some prototypes for address parsing system
272 * (others are in addrsbr.h)
273 */
274 char *LocalName(int);
275 char *SystemName(void);
276
277 /*
278 * prototypes for some routines in uip
279 */
280 int annotate (char *, char *, char *, int, int, int, int);
281 void annolist(char *, char *, char *, int);
282 void annopreserve(int);
283 void clear_screen(void);
284 void m_pclose(void);
285 int make_intermediates(char *);
286 int mhl(int, char **);
287 int mhlsbr(int, char **, FILE *(*)(char *));
288 int distout (char *, char *, char *);
289 void replout (FILE *, char *, char *, struct msgs *, int,
290 int, char *, char *, char *, int);
291 int sc_hardcopy(void);
292 int sc_length(void);
293 int sc_width(void);
294 int build_form (char *, char *, int *, char *, char *, char *, char *,
295 char *, char *);
296 int sendsbr (char **, int, char *, char *, struct stat *, int, char *, int);
297 int SOprintf (char *, ...);
298 int what_now (char *, int, int, char *, char *,
299 int, struct msgs *, char *, int, char *, int);
300 int WhatNow(int, char **);
301 int writeBase64aux(FILE *, FILE *);
302 int writeBase64 (unsigned char *, size_t, unsigned char *);
303 int writeBase64raw (unsigned char *, size_t, unsigned char *);
304
305 /*
306 * credentials management
307 */
308 void init_credentials_file ();
309 int nmh_get_credentials (char *, char *, int, nmh_creds_t);