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 */
41int	More(void *);
42int	Type(void *);
43int	folders(void *);
44int	from(void *);
45int	headers(void *);
46int	inc(void *);
47int	mboxit(void *);
48int	more(void *);
49int	pcmdlist(void *);
50int	pdot(void *);
51int	pipecmd(void *);
52int	scroll(void *);
53int	stouch(void *);
54int	top(void *);
55int	type(void *);
56#ifdef MIME_SUPPORT
57int	page(void *);
58int	Page(void *);
59int	print(void *);
60int	Print(void *);
61int	view(void *);
62int	View(void *);
63#endif
64/* XXX - should these be elsewhere? */
65void	printhead(int);
66char *	sget_msgnum(struct message *, struct message *);
67void	show_msgnum(FILE *, struct message *, struct message *);
68
69/*
70 * from cmd2.c
71 */
72int	Detach(void *);
73int	Save(void *);
74int	clobber(void *);
75int	copycmd(void *);
76int	core(void *);
77int	delete(void *);
78int	deltype(void *);
79int	detach(void *);
80int	igfield(void *);
81int	next(void *);
82int	retfield(void *);
83int	save(void *);
84int	saveigfield(void *);
85int	saveretfield(void *);
86int	swrite(void *);
87int	undeletecmd(void *);
88
89/*
90 * from cmd3.c
91 */
92int	Respond(void *);
93int	alternates(void *);
94int	bounce(void *);
95int	dosh(void *);
96int	echo(void *);
97int	elsecmd(void *);
98int	endifcmd(void *);
99int	file(void *);
100int	bounce(void *);
101int	forward(void *);
102int	group(void *);
103int	help(void *);
104int	ifcmd(void *);
105int	ifdefcmd(void *v);
106int	ifndefcmd(void *v);
107int	markread(void *);
108int	messize(void *);
109int	null(void *);
110int	preserve(void *);
111int	respond(void *);
112int	rexit(void *);
113int	schdir(void *);
114int	set(void *);
115int	shell(void *);
116int	show(void *);
117int	unalias(void *);
118int	unread(void *);
119int	unset(void *);
120/* XXX - Should this be elsewhere? */
121void	sort(const char **);
122
123/*
124 * from cmd4.c
125 */
126struct smopts_s *findsmopts(const char *, int);
127int	smoptscmd(void *);
128int	unsmoptscmd(void *);
129int	Header(void *);
130
131/*
132 * from cmdtab.c
133 */
134extern const struct cmd cmdtab[];
135
136/*
137 * from collect.c
138 */
139FILE *	collect(struct header *, int);
140void	savedeadletter(FILE *);
141
142/*
143 * from dotlock.c
144 */
145int	dot_lock(const char *, int, FILE *, const char *);
146void	dot_unlock(const char *);
147
148/*
149 * from edit.c
150 */
151int	editor(void *);
152int	visual(void *);
153FILE *	run_editor(FILE *, off_t, int, int);
154
155/*
156 * from fio.c
157 */
158const char *expand(const char *);
159off_t	fsize(FILE *);
160const char *getdeadletter(void);
161int	getfold(char *, size_t);
162#ifdef USE_EDITLINE
163#define readline xreadline	/* readline() is defined in libedit */
164#endif
165int	readline(FILE *, char *, int, int);
166int	putline(FILE *, const char *, int);
167int	rm(char *);
168FILE *	setinput(const struct message *);
169void	setptr(FILE *, off_t);
170
171/*
172 * from getname.c
173 */
174const char *getname(uid_t);
175int	getuserid(char []);
176
177/*
178 * from head.c
179 */
180int	ishead(const char []);
181void	parse(const char [], struct headline *, char []);
182
183/*
184 * from lex.c
185 */
186void	announce(void);
187void	commands(void);
188enum execute_contxt_e { ec_normal, ec_composing, ec_autoprint };
189int	execute(char [], enum execute_contxt_e);
190int	incfile(void);
191const struct cmd *lex(char []);
192void	load(const char *);
193int	newfileinfo(int);
194int	pversion(void *);
195int	setfile(const char *);
196char *	shellpr(char *);
197char *	get_cmdname(char *);
198
199/*
200 * from list.c
201 */
202int	first(int, int);
203int	get_Hflag(char **);
204int	getmsglist(char *, int *, int);
205int	getrawlist(const char [], char **, int);
206int	show_headers_and_exit(int) __dead;
207
208/*
209 * from main.c
210 */
211struct name *lexpand(char *, int);
212void	setscreensize(void);
213int	main(int, char **);
214
215/*
216 * from names.c
217 */
218struct name *cat(struct name *, struct name *);
219int	count(struct name *);
220struct name *delname(struct name *, char []);
221char *	detract(struct name *, int);
222struct name * elide(struct name *);
223struct name * extract(char [], int);
224struct name * gexpand(struct name *, struct grouphead *, int, int);
225struct name * nalloc(char [], int);
226struct name * outof(struct name *, FILE *, struct header *);
227const char ** unpack(struct name *);
228struct name * usermap(struct name *);
229#if 0
230void	prettyprint(struct name *);	/* commented out? */
231#endif
232
233/*
234 * from popen.c
235 */
236int	Fclose(FILE *);
237FILE *	Fdopen(int, const char *);
238FILE *	Fopen(const char *, const char *);
239int	Pclose(FILE *);
240FILE *	Popen(const char *, const char *);
241void	close_all_files(void);
242void	close_top_files(FILE *);
243void	free_child(int);
244void	prepare_child(sigset_t *, int, int);
245FILE *	last_registered_file(int);
246void	register_file(FILE *, int, int);
247int	run_command(const char *, sigset_t *, int, int, ...);
248void	sigchild(int);
249int	start_command(const char *, sigset_t *, int, int, ...);
250int	wait_child(int);
251#ifdef MIME_SUPPORT
252void	flush_files(FILE *, int);
253#endif
254
255/*
256 * from quit.c
257 */
258void	quit(jmp_buf);
259int	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
268int	sendmessage(struct message *, FILE *, struct ignoretab *, const char *, struct mime_info *);
269int	mail(struct name *, struct name *, struct name *, struct name *, char *, struct attachment *);
270void	mail1(struct header *, int);
271void	mail2(FILE *, const char **);
272int	puthead(struct header *, FILE *, int);
273int	sendmail(void *);
274
275/*
276 * from strings.c
277 */
278void *	csalloc(size_t, size_t);
279void *	salloc(size_t);
280void	sreset(void);
281void	spreserve(void);
282
283/*
284 * from support.c
285 */
286void	add_ignore(const char *, struct ignoretab *);
287void	alter(char *);
288int	argcount(char **);
289int	blankline(char []);
290char *	copy(char *, char *);
291char *	hfield(const char [], const struct message *);
292int	isdir(const char []);
293int	isign(const char *, struct ignoretab []);
294void	istrcpy(char *, const char *);
295int	member(char *, struct ignoretab *);
296char *	nameof(struct message *, int);
297int	sasprintf(char **ret, const char *format, ...);
298char *	savestr(const char *);
299struct message *set_m_flag(int, int, int);
300char *	skin(char *);
301int	source(void *);
302void	touch(struct message *);
303int	unstack(void);
304int	upcase(int);
305void	cathelp(const char *);
306
307/*
308 * from temp.c
309 */
310void	tinit(void);
311
312/*
313 * from tty.c
314 */
315int	grabh(struct header *, int);
316
317/*
318 * from vars.c
319 */
320void	assign(const char [], const char []);
321struct grouphead * findgroup(const char []);
322int	hash(const char *);
323struct var * lookup(const char []);
324void	printgroup(const char []);
325void	v_free(char *);
326char *	value(const char []);
327char *	vcopy(const char []);
328
329/*
330 * from v7.local.c
331 */
332void	demail(void);
333void	findmail(const char *, char *, size_t);
334const char *username(void);
335
336/*
337 * from version.c
338 */
339extern 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 */
347struct message *next_message(struct message *);
348struct message *prev_message(struct message *);
349struct message *get_message(int);
350int	get_msgnum(struct message *);
351int	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