xref: /minix/usr.bin/mail/extern.h (revision 90b80121)
1 /*	$NetBSD: extern.h,v 1.33 2014/12/16 19:30:24 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.33 2014/12/16 19:30:24 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 int	Header(void *);
130 
131 /*
132  * from cmdtab.c
133  */
134 extern const struct cmd cmdtab[];
135 
136 /*
137  * from collect.c
138  */
139 FILE *	collect(struct header *, int);
140 void	savedeadletter(FILE *);
141 
142 /*
143  * from dotlock.c
144  */
145 int	dot_lock(const char *, int, FILE *, const char *);
146 void	dot_unlock(const char *);
147 
148 /*
149  * from edit.c
150  */
151 int	editor(void *);
152 int	visual(void *);
153 FILE *	run_editor(FILE *, off_t, int, int);
154 
155 /*
156  * from fio.c
157  */
158 const char *expand(const char *);
159 off_t	fsize(FILE *);
160 const char *getdeadletter(void);
161 int	getfold(char *, size_t);
162 #ifdef USE_EDITLINE
163 #define readline xreadline	/* readline() is defined in libedit */
164 #endif
165 int	readline(FILE *, char *, int, int);
166 int	putline(FILE *, const char *, int);
167 int	rm(char *);
168 FILE *	setinput(const struct message *);
169 void	setptr(FILE *, off_t);
170 
171 /*
172  * from getname.c
173  */
174 const char *getname(uid_t);
175 int	getuserid(char []);
176 
177 /*
178  * from head.c
179  */
180 int	ishead(const char []);
181 void	parse(const char [], struct headline *, char []);
182 
183 /*
184  * from lex.c
185  */
186 void	announce(void);
187 void	commands(void);
188 enum execute_contxt_e { ec_normal, ec_composing, ec_autoprint };
189 int	execute(char [], enum execute_contxt_e);
190 int	incfile(void);
191 const struct cmd *lex(char []);
192 void	load(const char *);
193 int	newfileinfo(int);
194 int	pversion(void *);
195 int	setfile(const char *);
196 char *	shellpr(char *);
197 char *	get_cmdname(char *);
198 
199 /*
200  * from list.c
201  */
202 int	first(int, int);
203 int	get_Hflag(char **);
204 int	getmsglist(char *, int *, int);
205 int	getrawlist(const char [], char **, int);
206 int	show_headers_and_exit(int) __dead;
207 
208 /*
209  * from main.c
210  */
211 struct name *lexpand(char *, int);
212 void	setscreensize(void);
213 int	main(int, char **);
214 
215 /*
216  * from names.c
217  */
218 struct name *cat(struct name *, struct name *);
219 int	count(struct name *);
220 struct name *delname(struct name *, char []);
221 char *	detract(struct name *, int);
222 struct name * elide(struct name *);
223 struct name * extract(char [], int);
224 struct name * gexpand(struct name *, struct grouphead *, int, int);
225 struct name * nalloc(char [], int);
226 struct name * outof(struct name *, FILE *, struct header *);
227 const char ** unpack(struct name *, struct name *);
228 struct name * usermap(struct name *);
229 #if 0
230 void	prettyprint(struct name *);	/* commented out? */
231 #endif
232 
233 /*
234  * from popen.c
235  */
236 int	Fclose(FILE *);
237 FILE *	Fdopen(int, const char *);
238 FILE *	Fopen(const char *, const char *);
239 int	Pclose(FILE *);
240 FILE *	Popen(const char *, const char *);
241 void	close_all_files(void);
242 void	close_top_files(FILE *);
243 void	free_child(int);
244 void	prepare_child(sigset_t *, int, int);
245 FILE *	last_registered_file(int);
246 void	register_file(FILE *, int, int);
247 int	run_command(const char *, sigset_t *, int, int, ...);
248 void	sigchild(int);
249 int	start_command(const char *, sigset_t *, int, int, ...);
250 int	wait_child(int);
251 #ifdef MIME_SUPPORT
252 void	flush_files(FILE *, int);
253 #endif
254 
255 /*
256  * from quit.c
257  */
258 void	quit(jmp_buf);
259 int	quitcmd(void *);
260 
261 /*
262  * from send.c
263  */
264 #ifndef MIME_SUPPORT
265 # define sendmessage(a,b,c,d,e)	legacy_sendmessage(a,b,c,d)
266 # define mail(a,b,c,d,e,f)	legacy_mail(a,b,c,d,e)
267 #endif
268 int	sendmessage(struct message *, FILE *, struct ignoretab *, const char *, struct mime_info *);
269 int	mail(struct name *, struct name *, struct name *, struct name *, char *, struct attachment *);
270 void	mail1(struct header *, int);
271 void	mail2(FILE *, const char **);
272 int	puthead(struct header *, FILE *, int);
273 int	sendmail(void *);
274 
275 /*
276  * from strings.c
277  */
278 void *	csalloc(size_t, size_t);
279 void *	salloc(size_t);
280 void	sreset(void);
281 void	spreserve(void);
282 
283 /*
284  * from support.c
285  */
286 void	add_ignore(const char *, struct ignoretab *);
287 void	alter(char *);
288 int	argcount(char **);
289 int	blankline(char []);
290 char *	copy(char *, char *);
291 char *	hfield(const char [], const struct message *);
292 int	isdir(const char []);
293 int	isign(const char *, struct ignoretab []);
294 void	istrcpy(char *, const char *);
295 int	member(char *, struct ignoretab *);
296 char *	nameof(struct message *, int);
297 int	sasprintf(char **ret, const char *format, ...) __printflike(2, 3);
298 char *	savestr(const char *);
299 struct message *set_m_flag(int, int, int);
300 char *	skin(char *);
301 int	source(void *);
302 void	touch(struct message *);
303 int	unstack(void);
304 int	upcase(int);
305 void	cathelp(const char *);
306 
307 /*
308  * from temp.c
309  */
310 void	tinit(void);
311 
312 /*
313  * from tty.c
314  */
315 int	grabh(struct header *, int);
316 
317 /*
318  * from vars.c
319  */
320 void	assign(const char [], const char []);
321 struct grouphead * findgroup(const char []);
322 int	hash(const char *);
323 struct var * lookup(const char []);
324 void	printgroup(const char []);
325 void	v_free(char *);
326 char *	value(const char []);
327 char *	vcopy(const char []);
328 
329 /*
330  * from v7.local.c
331  */
332 void	demail(void);
333 void	findmail(const char *, char *, size_t);
334 const char *username(void);
335 
336 /*
337  * from version.c
338  */
339 extern const char *version;
340 
341 
342 #ifndef	THREAD_SUPPORT
343 /*
344  * Specials from fio.c (if THREAD_SUPPORT is not defined).
345  * With THREAD_SUPPORT, they live in thread.c.
346  */
347 struct message *next_message(struct message *);
348 struct message *prev_message(struct message *);
349 struct message *get_message(int);
350 int	get_msgnum(struct message *);
351 int	get_msgCount(void);
352 
353 /* we remap these commands */
354 # define get_abs_msgCount	get_msgCount
355 # define get_abs_message(a)	get_message(a)
356 # define next_abs_message(a)	next_message(a)
357 
358 /* we trash these commands */
359 # define do_recursion()			0
360 # define thread_recursion(mp,fn,args)	fn(mp,args)
361 # define thread_fix_old_links(nmessage,message,omsgCount)
362 # define thread_fix_new_links(message,omsgCount,msgCount)
363 #endif /* THREAD_SUPPORT */
364 
365 #endif /* __EXTERN_H__ */
366