xref: /netbsd-src/usr.bin/mail/extern.h (revision 404fbe5fb94ca1e054339640cabb2801ce52dd30)
1 /*	$NetBSD: extern.h,v 1.30 2007/10/27 15:14:50 christos Exp $	*/
2 
3 /*-
4  * Copyright (c) 1992, 1993
5  *	The Regents of the University of California.  All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. Neither the name of the University nor the names of its contributors
16  *    may be used to endorse or promote products derived from this software
17  *    without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29  * SUCH DAMAGE.
30  *
31  *	@(#)extern.h	8.2 (Berkeley) 4/20/95
32  *	$NetBSD: extern.h,v 1.30 2007/10/27 15:14:50 christos Exp $
33  */
34 
35 #ifndef __EXTERN_H__
36 #define __EXTERN_H__
37 
38 /*
39  * from cmd1.c
40  */
41 int	More(void *);
42 int	Type(void *);
43 int	folders(void *);
44 int	from(void *);
45 int	headers(void *);
46 int	inc(void *);
47 int	mboxit(void *);
48 int	more(void *);
49 int	pcmdlist(void *);
50 int	pdot(void *);
51 int	pipecmd(void *);
52 int	scroll(void *);
53 int	stouch(void *);
54 int	top(void *);
55 int	type(void *);
56 #ifdef MIME_SUPPORT
57 int	page(void *);
58 int	Page(void *);
59 int	print(void *);
60 int	Print(void *);
61 int	view(void *);
62 int	View(void *);
63 #endif
64 /* XXX - should these be elsewhere? */
65 void	printhead(int);
66 char *	sget_msgnum(struct message *, struct message *);
67 void	show_msgnum(FILE *, struct message *, struct message *);
68 
69 /*
70  * from cmd2.c
71  */
72 int	Detach(void *);
73 int	Save(void *);
74 int	clobber(void *);
75 int	copycmd(void *);
76 int	core(void *);
77 int	delete(void *);
78 int	deltype(void *);
79 int	detach(void *);
80 int	igfield(void *);
81 int	next(void *);
82 int	retfield(void *);
83 int	save(void *);
84 int	saveigfield(void *);
85 int	saveretfield(void *);
86 int	swrite(void *);
87 int	undeletecmd(void *);
88 
89 /*
90  * from cmd3.c
91  */
92 int	Respond(void *);
93 int	alternates(void *);
94 int	bounce(void *);
95 int	dosh(void *);
96 int	echo(void *);
97 int	elsecmd(void *);
98 int	endifcmd(void *);
99 int	file(void *);
100 int	bounce(void *);
101 int	forward(void *);
102 int	group(void *);
103 int	help(void *);
104 int	ifcmd(void *);
105 int	ifdefcmd(void *v);
106 int	ifndefcmd(void *v);
107 int	markread(void *);
108 int	messize(void *);
109 int	null(void *);
110 int	preserve(void *);
111 int	respond(void *);
112 int	rexit(void *);
113 int	schdir(void *);
114 int	set(void *);
115 int	shell(void *);
116 int	show(void *);
117 int	unalias(void *);
118 int	unread(void *);
119 int	unset(void *);
120 /* XXX - Should this be elsewhere? */
121 void	sort(const char **);
122 
123 /*
124  * from cmd4.c
125  */
126 struct smopts_s *findsmopts(const char *, int);
127 int	smoptscmd(void *);
128 int	unsmoptscmd(void *);
129 
130 /*
131  * from cmdtab.c
132  */
133 extern const struct cmd cmdtab[];
134 
135 /*
136  * from collect.c
137  */
138 FILE *	collect(struct header *, int);
139 void	savedeadletter(FILE *);
140 
141 /*
142  * from dotlock.c
143  */
144 int	dot_lock(const char *, int, FILE *, const char *);
145 void	dot_unlock(const char *);
146 
147 /*
148  * from edit.c
149  */
150 int	editor(void *);
151 int	visual(void *);
152 FILE *	run_editor(FILE *, off_t, int, int);
153 
154 /*
155  * from fio.c
156  */
157 const char *expand(const char *);
158 off_t	fsize(FILE *);
159 const char *getdeadletter(void);
160 int	getfold(char *, size_t);
161 void	holdsigs(void);
162 int	mail_readline(FILE *, char *, int);
163 int	putline(FILE *, const char *, int);
164 void	relsesigs(void);
165 int	rm(char *);
166 FILE *	setinput(const struct message *);
167 void	setptr(FILE *, off_t);
168 
169 /*
170  * from getname.c
171  */
172 const char *getname(uid_t);
173 int	getuserid(char []);
174 
175 /*
176  * from head.c
177  */
178 int	ishead(const char []);
179 void	parse(const char [], struct headline *, char []);
180 
181 /*
182  * from lex.c
183  */
184 void	announce(void);
185 void	commands(void);
186 enum execute_contxt_e { ec_normal, ec_composing, ec_autoprint };
187 int	execute(char [], enum execute_contxt_e);
188 int	incfile(void);
189 const struct cmd *lex(char []);
190 void	load(const char *);
191 int	newfileinfo(int);
192 int	pversion(void *);
193 int	setfile(const char *);
194 char *	shellpr(char *);
195 char *	get_cmdname(char *);
196 
197 /*
198  * from list.c
199  */
200 int	first(int, int);
201 int	get_Hflag(char **);
202 int	getmsglist(char *, int *, int);
203 int	getrawlist(const char [], char **, int);
204 int	show_headers_and_exit(int) __attribute__((__noreturn__));
205 
206 /*
207  * from main.c
208  */
209 struct name *lexpand(char *, int);
210 void	setscreensize(void);
211 int	main(int, char **);
212 
213 /*
214  * from names.c
215  */
216 struct name *cat(struct name *, struct name *);
217 int	count(struct name *);
218 struct name *delname(struct name *, char []);
219 char *	detract(struct name *, int);
220 struct name * elide(struct name *);
221 struct name * extract(char [], int);
222 struct name * gexpand(struct name *, struct grouphead *, int, int);
223 struct name * nalloc(char [], int);
224 struct name * outof(struct name *, FILE *, struct header *);
225 const char ** unpack(struct name *);
226 struct name * usermap(struct name *);
227 #if 0
228 void	prettyprint(struct name *);	/* commented out? */
229 #endif
230 
231 /*
232  * from popen.c
233  */
234 int	Fclose(FILE *);
235 FILE *	Fdopen(int, const char *);
236 FILE *	Fopen(const char *, const char *);
237 int	Pclose(FILE *);
238 FILE *	Popen(const char *, const char *);
239 void	close_all_files(void);
240 void	close_top_files(FILE *);
241 void	free_child(int);
242 void	prepare_child(sigset_t *, int, int);
243 FILE *	last_registered_file(int);
244 void	register_file(FILE *, int, int);
245 int	run_command(const char *, sigset_t *, int, int, ...);
246 void	sigchild(int);
247 int	start_command(const char *, sigset_t *, int, int, ...);
248 int	wait_child(int);
249 #ifdef MIME_SUPPORT
250 void	flush_files(FILE *, int);
251 #endif
252 
253 /*
254  * from quit.c
255  */
256 void	quit(void);
257 int	quitcmd(void *);
258 
259 /*
260  * from send.c
261  */
262 #ifndef MIME_SUPPORT
263 # define sendmessage(a,b,c,d,e)	legacy_sendmessage(a,b,c,d)
264 # define mail(a,b,c,d,e,f)	legacy_mail(a,b,c,d,e)
265 #endif
266 int	sendmessage(struct message *, FILE *, struct ignoretab *, const char *, struct mime_info *);
267 int	mail(struct name *, struct name *, struct name *, struct name *, char *, struct attachment *);
268 void	mail1(struct header *, int);
269 void	mail2(FILE *, const char **);
270 int	puthead(struct header *, FILE *, int);
271 int	sendmail(void *);
272 
273 /*
274  * from strings.c
275  */
276 void *	csalloc(size_t, size_t);
277 void *	salloc(size_t);
278 void	sreset(void);
279 void	spreserve(void);
280 
281 /*
282  * from support.c
283  */
284 void	add_ignore(const char *, struct ignoretab *);
285 void	alter(char *);
286 int	argcount(char **);
287 int	blankline(char []);
288 char *	copy(char *, char *);
289 char *	hfield(const char [], const struct message *);
290 int	isdir(const char []);
291 int	isign(const char *, struct ignoretab []);
292 void	istrcpy(char *, const char *);
293 int	member(char *, struct ignoretab *);
294 char *	nameof(struct message *, int);
295 int	sasprintf(char **ret, const char *format, ...);
296 char *	savestr(const char *);
297 struct message *set_m_flag(int, int, int);
298 char *	skin(char *);
299 int	source(void *);
300 void	touch(struct message *);
301 int	unstack(void);
302 int	upcase(int);
303 void	cathelp(const char *);
304 
305 /*
306  * from temp.c
307  */
308 void	tinit(void);
309 
310 /*
311  * from tty.c
312  */
313 int	grabh(struct header *, int);
314 
315 /*
316  * from vars.c
317  */
318 void	assign(const char [], const char []);
319 struct grouphead * findgroup(const char []);
320 int	hash(const char *);
321 struct var * lookup(const char []);
322 void	printgroup(const char []);
323 void	v_free(char *);
324 char *	value(const char []);
325 char *	vcopy(const char []);
326 
327 /*
328  * from v7.local.c
329  */
330 void	demail(void);
331 void	findmail(const char *, char *, size_t);
332 const char *username(void);
333 
334 /*
335  * from version.c
336  */
337 extern const char *version;
338 
339 
340 #ifndef	THREAD_SUPPORT
341 /*
342  * Specials from fio.c (if THREAD_SUPPORT is not defined).
343  * With THREAD_SUPPORT, they live in thread.c.
344  */
345 struct message *next_message(struct message *);
346 struct message *prev_message(struct message *);
347 struct message *get_message(int);
348 int	get_msgnum(struct message *);
349 int	get_msgCount(void);
350 
351 /* we remap these commands */
352 # define get_abs_msgCount	get_msgCount
353 # define get_abs_message(a)	get_message(a)
354 # define next_abs_message(a)	next_message(a)
355 
356 /* we trash these commands */
357 # define do_recursion()			0
358 # define thread_recursion(mp,fn,args)	fn(mp,args)
359 # define thread_fix_old_links(nmessage,message,omsgCount)
360 # define thread_fix_new_links(message,omsgCount,msgCount)
361 #endif /* THREAD_SUPPORT */
362 
363 #endif /* __EXTERN_H__ */
364