1 /* $NetBSD: extern.h,v 1.30 2007/10/27 15:14:50 christos Exp $ */
4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
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.
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
31 * @(#)extern.h 8.2 (Berkeley) 4/20/95
32 * $NetBSD: extern.h,v 1.30 2007/10/27 15:14:50 christos Exp $
64 /* XXX - should these be elsewhere? */
66 char * sget_msgnum(struct message
*, struct message
*);
67 void show_msgnum(FILE *, struct message
*, struct message
*);
84 int saveigfield(void *);
85 int saveretfield(void *);
87 int undeletecmd(void *);
93 int alternates(void *);
105 int ifdefcmd(void *v
);
106 int ifndefcmd(void *v
);
107 int markread(void *);
110 int preserve(void *);
120 /* XXX - Should this be elsewhere? */
121 void sort(const char **);
126 struct smopts_s
*findsmopts(const char *, int);
127 int smoptscmd(void *);
128 int unsmoptscmd(void *);
134 extern const struct cmd cmdtab
[];
139 FILE * collect(struct header
*, int);
140 void savedeadletter(FILE *);
145 int dot_lock(const char *, int, FILE *, const char *);
146 void dot_unlock(const char *);
153 FILE * run_editor(FILE *, off_t
, int, int);
158 const char *expand(const char *);
160 const char *getdeadletter(void);
161 int getfold(char *, size_t);
163 #define readline xreadline /* readline() is defined in libedit */
165 int readline(FILE *, char *, int, int);
166 int putline(FILE *, const char *, int);
168 FILE * setinput(const struct message
*);
169 void setptr(FILE *, off_t
);
174 const char *getname(uid_t
);
175 int getuserid(char []);
180 int ishead(const char []);
181 void parse(const char [], struct headline
*, char []);
188 enum execute_contxt_e
{ ec_normal
, ec_composing
, ec_autoprint
};
189 int execute(char [], enum execute_contxt_e
);
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 *);
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
;
211 struct name
*lexpand(char *, int);
212 void setscreensize(void);
213 int main(int, char **);
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
*);
228 struct name
* usermap(struct name
*);
230 void prettyprint(struct name
*); /* commented out? */
237 FILE * Fdopen(int, const char *);
238 FILE * Fopen(const char *, const char *);
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, ...);
249 int start_command(const char *, sigset_t
*, int, int, ...);
252 void flush_files(FILE *, int);
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)
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 *);
278 void * csalloc(size_t, size_t);
279 void * salloc(size_t);
281 void spreserve(void);
286 void add_ignore(const char *, struct ignoretab
*);
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
, ...);
298 char * savestr(const char *);
299 struct message
*set_m_flag(int, int, int);
302 void touch(struct message
*);
305 void cathelp(const char *);
315 int grabh(struct header
*, int);
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 []);
326 char * value(const char []);
327 char * vcopy(const char []);
333 void findmail(const char *, char *, size_t);
334 const char *username(void);
339 extern const char *version
;
342 #ifndef THREAD_SUPPORT
344 * Specials from fio.c (if THREAD_SUPPORT is not defined).
345 * With THREAD_SUPPORT, they live in thread.c.
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);
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)
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 */
365 #endif /* __EXTERN_H__ */