Home | History | Annotate | Line # | Download | only in mail
extern.h revision 1.27
      1 /*	$NetBSD: extern.h,v 1.27 2006/11/28 18:45:32 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.27 2006/11/28 18:45:32 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	 dosh(void *);
     95 int	 echo(void *);
     96 int	 elsecmd(void *);
     97 int	 endifcmd(void *);
     98 int	 file(void *);
     99 int	 group(void *);
    100 int	 help(void *);
    101 int	 ifcmd(void *);
    102 int	 ifdefcmd(void *v);
    103 int	 ifndefcmd(void *v);
    104 int	 markread(void *);
    105 int	 messize(void *);
    106 int	 null(void *);
    107 int	 preserve(void *);
    108 int	 respond(void *);
    109 int	 rexit(void *);
    110 int	 schdir(void *);
    111 int	 set(void *);
    112 int	 shell(void *);
    113 int	 show(void *);
    114 int	 unalias(void *);
    115 int	 unread(void *);
    116 int	 unset(void *);
    117 /* XXX - Should this be elsewhere? */
    118 void	 sort(const char **);
    119 
    120 /*
    121  * from cmd4.c
    122  */
    123 struct smopts_s *findsmopts(const char *, int);
    124 int	smoptscmd(void *);
    125 int	unsmoptscmd(void *);
    126 
    127 /*
    128  * from cmdtab.c
    129  */
    130 extern const struct cmd cmdtab[];
    131 
    132 /*
    133  * from collect.c
    134  */
    135 FILE	*collect(struct header *, int);
    136 void	 savedeadletter(FILE *);
    137 
    138 /*
    139  * from dotlock.c
    140  */
    141 int	 dot_lock(const char *, int, FILE *, const char *);
    142 void	 dot_unlock(const char *);
    143 
    144 /*
    145  * from edit.c
    146  */
    147 int	 editor(void *);
    148 int	 visual(void *);
    149 FILE	*run_editor(FILE *, off_t, int, int);
    150 
    151 /*
    152  * from fio.c
    153  */
    154 const char *expand(const char *);
    155 off_t	 fsize(FILE *);
    156 const char *getdeadletter(void);
    157 int	 getfold(char *, size_t);
    158 void	 holdsigs(void);
    159 int	 mail_readline(FILE *, char *, int);
    160 int	 putline(FILE *, const char *, int);
    161 void	 relsesigs(void);
    162 int	 rm(char *);
    163 FILE	*setinput(const struct message *);
    164 void	 setptr(FILE *, off_t);
    165 
    166 /*
    167  * from getname.c
    168  */
    169 const char *getname(uid_t);
    170 int	 getuserid(char []);
    171 
    172 /*
    173  * from head.c
    174  */
    175 int	 ishead(const char []);
    176 void	 parse(const char [], struct headline *, char []);
    177 
    178 /*
    179  * from lex.c
    180  */
    181 void	 announce(void);
    182 void	 commands(void);
    183 int	 execute(char [], int);
    184 int	 incfile(void);
    185 const struct cmd *lex(char []);
    186 void	 load(const char *);
    187 int	 newfileinfo(int);
    188 int	 pversion(void *);
    189 int	 setfile(const char *);
    190 char	*shellpr(char *);
    191 char	*get_cmdname(char *);
    192 
    193 /*
    194  * from list.c
    195  */
    196 int	 first(int, int);
    197 int	 get_Hflag(char **);
    198 int	 getmsglist(char *, int *, int);
    199 int	 getrawlist(const char [], char **, int);
    200 int	 show_headers_and_exit(int) __attribute__((__noreturn__));
    201 
    202 /*
    203  * from main.c
    204  */
    205 struct name *lexpand(char *, int);
    206 void	 setscreensize(void);
    207 int	 main(int, char **);
    208 
    209 /*
    210  * from names.c
    211  */
    212 struct name *cat(struct name *, struct name *);
    213 int	 count(struct name *);
    214 struct name *delname(struct name *, char []);
    215 char	*detract(struct name *, int);
    216 struct name *elide(struct name *);
    217 struct name *extract(char [], int);
    218 struct name *gexpand(struct name *, struct grouphead *, int, int);
    219 struct name *nalloc(char [], int);
    220 struct name *outof(struct name *, FILE *, struct header *);
    221 const char **unpack(struct name *);
    222 struct name *usermap(struct name *);
    223 #if 0
    224 void	 prettyprint(struct name *);	/* commented out? */
    225 #endif
    226 
    227 /*
    228  * from popen.c
    229  */
    230 int	 Fclose(FILE *);
    231 FILE	*Fdopen(int, const char *);
    232 FILE	*Fopen(const char *, const char *);
    233 int	 Pclose(FILE *);
    234 FILE	*Popen(const char *, const char *);
    235 void	 close_all_files(void);
    236 void	 close_top_files(FILE *);
    237 void	 free_child(int);
    238 void	 prepare_child(sigset_t *, int, int);
    239 FILE	*last_registered_file(int);
    240 void	 register_file(FILE *, int, int);
    241 int	 run_command(const char *, sigset_t *, int, int, ...);
    242 void	 sigchild(int);
    243 int	 start_command(const char *, sigset_t *, int, int, ...);
    244 int	 wait_child(int);
    245 #ifdef MIME_SUPPORT
    246 void	 flush_files(FILE *, int);
    247 #endif
    248 
    249 /*
    250  * from quit.c
    251  */
    252 void	 quit(void);
    253 int	 quitcmd(void *);
    254 
    255 /*
    256  * from send.c
    257  */
    258 #ifndef MIME_SUPPORT
    259 # define sendmessage(a,b,c,d,e)	legacy_sendmessage(a,b,c,d)
    260 # define mail(a,b,c,d,e,f)	legacy_mail(a,b,c,d,e)
    261 #endif
    262 int	 sendmessage(struct message *, FILE *, struct ignoretab *, const char *, struct mime_info *);
    263 int	 mail(struct name *, struct name *, struct name *, struct name *, char *, struct attachment *);
    264 void	 mail1(struct header *, int);
    265 int	 puthead(struct header *, FILE *, int);
    266 int	 sendmail(void *);
    267 
    268 /*
    269  * from strings.c
    270  */
    271 void	*csalloc(size_t, size_t);
    272 void	*salloc(size_t);
    273 void	 sreset(void);
    274 void	 spreserve(void);
    275 
    276 /*
    277  * from support.c
    278  */
    279 void	 alter(char *);
    280 int	 argcount(char **);
    281 int	 blankline(char []);
    282 char	*copy(char *, char *);
    283 char	*hfield(const char [], const struct message *);
    284 int	 isdir(const char []);
    285 int	 isign(const char *, struct ignoretab []);
    286 void	 istrcpy(char *, const char *);
    287 int	 member(char *, struct ignoretab *);
    288 char	*nameof(struct message *, int);
    289 int	 sasprintf(char **ret, const char *format, ...);
    290 char	*savestr(const char *);
    291 struct message *set_m_flag(int, int, int);
    292 char	*skin(char *);
    293 int	 source(void *);
    294 void	 touch(struct message *);
    295 int	 unstack(void);
    296 int	 upcase(int);
    297 
    298 /*
    299  * from temp.c
    300  */
    301 void	 tinit(void);
    302 
    303 /*
    304  * from tty.c
    305  */
    306 int	 grabh(struct header *, int);
    307 
    308 /*
    309  * from vars.c
    310  */
    311 void	 assign(const char [], const char []);
    312 struct grouphead *findgroup(const char []);
    313 int	 hash(const char *);
    314 struct var *lookup(const char []);
    315 void	 printgroup(const char []);
    316 void	 v_free(char *);
    317 char	*value(const char []);
    318 char	*vcopy(const char []);
    319 
    320 /*
    321  * from v7.local.c
    322  */
    323 void	 demail(void);
    324 void	 findmail(const char *, char *, size_t);
    325 const char *username(void);
    326 
    327 /*
    328  * from version.c
    329  */
    330 extern const char *version;
    331 
    332 
    333 #ifndef	THREAD_SUPPORT
    334 /*
    335  * Specials from fio.c (if THREAD_SUPPORT is not defined).
    336  * With THREAD_SUPPORT, they live in thread.c.
    337  */
    338 struct message *next_message(struct message *);
    339 struct message *prev_message(struct message *);
    340 struct message *get_message(int);
    341 int	 get_msgnum(struct message *);
    342 int	 get_msgCount(void);
    343 
    344 /* we remap these commands */
    345 # define get_abs_msgCount	get_msgCount
    346 # define get_abs_message(a)	get_message(a)
    347 # define next_abs_message(a)	next_message(a)
    348 
    349 /* we trash these commands */
    350 # define do_recursion()			0
    351 # define thread_recursion(mp,fn,args)	fn(mp,args)
    352 # define thread_fix_old_links(nmessage,message,omsgCount)
    353 # define thread_fix_new_links(message,omsgCount,msgCount)
    354 #endif /* THREAD_SUPPORT */
    355 
    356 #endif /* __EXTERN_H__ */
    357