Home | History | Annotate | Line # | Download | only in mail
extern.h revision 1.28
      1 /*	$NetBSD: extern.h,v 1.28 2006/12/06 17:55:00 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.28 2006/12/06 17:55:00 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 enum execute_contxt_e { ec_normal, ec_composing, ec_autoprint };
    184 int	 execute(char [], enum execute_contxt_e);
    185 int	 incfile(void);
    186 const struct cmd *lex(char []);
    187 void	 load(const char *);
    188 int	 newfileinfo(int);
    189 int	 pversion(void *);
    190 int	 setfile(const char *);
    191 char	*shellpr(char *);
    192 char	*get_cmdname(char *);
    193 
    194 /*
    195  * from list.c
    196  */
    197 int	 first(int, int);
    198 int	 get_Hflag(char **);
    199 int	 getmsglist(char *, int *, int);
    200 int	 getrawlist(const char [], char **, int);
    201 int	 show_headers_and_exit(int) __attribute__((__noreturn__));
    202 
    203 /*
    204  * from main.c
    205  */
    206 struct name *lexpand(char *, int);
    207 void	 setscreensize(void);
    208 int	 main(int, char **);
    209 
    210 /*
    211  * from names.c
    212  */
    213 struct name *cat(struct name *, struct name *);
    214 int	 count(struct name *);
    215 struct name *delname(struct name *, char []);
    216 char	*detract(struct name *, int);
    217 struct name *elide(struct name *);
    218 struct name *extract(char [], int);
    219 struct name *gexpand(struct name *, struct grouphead *, int, int);
    220 struct name *nalloc(char [], int);
    221 struct name *outof(struct name *, FILE *, struct header *);
    222 const char **unpack(struct name *);
    223 struct name *usermap(struct name *);
    224 #if 0
    225 void	 prettyprint(struct name *);	/* commented out? */
    226 #endif
    227 
    228 /*
    229  * from popen.c
    230  */
    231 int	 Fclose(FILE *);
    232 FILE	*Fdopen(int, const char *);
    233 FILE	*Fopen(const char *, const char *);
    234 int	 Pclose(FILE *);
    235 FILE	*Popen(const char *, const char *);
    236 void	 close_all_files(void);
    237 void	 close_top_files(FILE *);
    238 void	 free_child(int);
    239 void	 prepare_child(sigset_t *, int, int);
    240 FILE	*last_registered_file(int);
    241 void	 register_file(FILE *, int, int);
    242 int	 run_command(const char *, sigset_t *, int, int, ...);
    243 void	 sigchild(int);
    244 int	 start_command(const char *, sigset_t *, int, int, ...);
    245 int	 wait_child(int);
    246 #ifdef MIME_SUPPORT
    247 void	 flush_files(FILE *, int);
    248 #endif
    249 
    250 /*
    251  * from quit.c
    252  */
    253 void	 quit(void);
    254 int	 quitcmd(void *);
    255 
    256 /*
    257  * from send.c
    258  */
    259 #ifndef MIME_SUPPORT
    260 # define sendmessage(a,b,c,d,e)	legacy_sendmessage(a,b,c,d)
    261 # define mail(a,b,c,d,e,f)	legacy_mail(a,b,c,d,e)
    262 #endif
    263 int	 sendmessage(struct message *, FILE *, struct ignoretab *, const char *, struct mime_info *);
    264 int	 mail(struct name *, struct name *, struct name *, struct name *, char *, struct attachment *);
    265 void	 mail1(struct header *, int);
    266 int	 puthead(struct header *, FILE *, int);
    267 int	 sendmail(void *);
    268 
    269 /*
    270  * from strings.c
    271  */
    272 void	*csalloc(size_t, size_t);
    273 void	*salloc(size_t);
    274 void	 sreset(void);
    275 void	 spreserve(void);
    276 
    277 /*
    278  * from support.c
    279  */
    280 void	 alter(char *);
    281 int	 argcount(char **);
    282 int	 blankline(char []);
    283 char	*copy(char *, char *);
    284 char	*hfield(const char [], const struct message *);
    285 int	 isdir(const char []);
    286 int	 isign(const char *, struct ignoretab []);
    287 void	 istrcpy(char *, const char *);
    288 int	 member(char *, struct ignoretab *);
    289 char	*nameof(struct message *, int);
    290 int	 sasprintf(char **ret, const char *format, ...);
    291 char	*savestr(const char *);
    292 struct message *set_m_flag(int, int, int);
    293 char	*skin(char *);
    294 int	 source(void *);
    295 void	 touch(struct message *);
    296 int	 unstack(void);
    297 int	 upcase(int);
    298 
    299 /*
    300  * from temp.c
    301  */
    302 void	 tinit(void);
    303 
    304 /*
    305  * from tty.c
    306  */
    307 int	 grabh(struct header *, int);
    308 
    309 /*
    310  * from vars.c
    311  */
    312 void	 assign(const char [], const char []);
    313 struct grouphead *findgroup(const char []);
    314 int	 hash(const char *);
    315 struct var *lookup(const char []);
    316 void	 printgroup(const char []);
    317 void	 v_free(char *);
    318 char	*value(const char []);
    319 char	*vcopy(const char []);
    320 
    321 /*
    322  * from v7.local.c
    323  */
    324 void	 demail(void);
    325 void	 findmail(const char *, char *, size_t);
    326 const char *username(void);
    327 
    328 /*
    329  * from version.c
    330  */
    331 extern const char *version;
    332 
    333 
    334 #ifndef	THREAD_SUPPORT
    335 /*
    336  * Specials from fio.c (if THREAD_SUPPORT is not defined).
    337  * With THREAD_SUPPORT, they live in thread.c.
    338  */
    339 struct message *next_message(struct message *);
    340 struct message *prev_message(struct message *);
    341 struct message *get_message(int);
    342 int	 get_msgnum(struct message *);
    343 int	 get_msgCount(void);
    344 
    345 /* we remap these commands */
    346 # define get_abs_msgCount	get_msgCount
    347 # define get_abs_message(a)	get_message(a)
    348 # define next_abs_message(a)	next_message(a)
    349 
    350 /* we trash these commands */
    351 # define do_recursion()			0
    352 # define thread_recursion(mp,fn,args)	fn(mp,args)
    353 # define thread_fix_old_links(nmessage,message,omsgCount)
    354 # define thread_fix_new_links(message,omsgCount,msgCount)
    355 #endif /* THREAD_SUPPORT */
    356 
    357 #endif /* __EXTERN_H__ */
    358