1 1.36 mrg /* $NetBSD: extern.h,v 1.36 2023/08/10 20:36:28 mrg Exp $ */ 2 1.4 christos 3 1.1 deraadt /*- 4 1.1 deraadt * Copyright (c) 1992, 1993 5 1.1 deraadt * The Regents of the University of California. All rights reserved. 6 1.1 deraadt * 7 1.1 deraadt * Redistribution and use in source and binary forms, with or without 8 1.1 deraadt * modification, are permitted provided that the following conditions 9 1.1 deraadt * are met: 10 1.1 deraadt * 1. Redistributions of source code must retain the above copyright 11 1.1 deraadt * notice, this list of conditions and the following disclaimer. 12 1.1 deraadt * 2. Redistributions in binary form must reproduce the above copyright 13 1.1 deraadt * notice, this list of conditions and the following disclaimer in the 14 1.1 deraadt * documentation and/or other materials provided with the distribution. 15 1.18 agc * 3. Neither the name of the University nor the names of its contributors 16 1.1 deraadt * may be used to endorse or promote products derived from this software 17 1.1 deraadt * without specific prior written permission. 18 1.1 deraadt * 19 1.1 deraadt * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 20 1.1 deraadt * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 1.1 deraadt * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 22 1.1 deraadt * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 23 1.1 deraadt * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 1.1 deraadt * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 25 1.1 deraadt * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 26 1.1 deraadt * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 27 1.1 deraadt * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 28 1.1 deraadt * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 29 1.1 deraadt * SUCH DAMAGE. 30 1.1 deraadt * 31 1.30 christos * @(#)extern.h 8.2 (Berkeley) 4/20/95 32 1.36 mrg * $NetBSD: extern.h,v 1.36 2023/08/10 20:36:28 mrg Exp $ 33 1.1 deraadt */ 34 1.1 deraadt 35 1.26 christos #ifndef __EXTERN_H__ 36 1.26 christos #define __EXTERN_H__ 37 1.26 christos 38 1.27 christos /* 39 1.27 christos * from cmd1.c 40 1.27 christos */ 41 1.30 christos int More(void *); 42 1.30 christos int Type(void *); 43 1.30 christos int folders(void *); 44 1.30 christos int from(void *); 45 1.30 christos int headers(void *); 46 1.30 christos int inc(void *); 47 1.30 christos int mboxit(void *); 48 1.30 christos int more(void *); 49 1.30 christos int pcmdlist(void *); 50 1.30 christos int pdot(void *); 51 1.30 christos int pipecmd(void *); 52 1.30 christos int scroll(void *); 53 1.30 christos int stouch(void *); 54 1.30 christos int top(void *); 55 1.30 christos int type(void *); 56 1.27 christos #ifdef MIME_SUPPORT 57 1.30 christos int page(void *); 58 1.30 christos int Page(void *); 59 1.30 christos int print(void *); 60 1.30 christos int Print(void *); 61 1.30 christos int view(void *); 62 1.30 christos int View(void *); 63 1.27 christos #endif 64 1.27 christos /* XXX - should these be elsewhere? */ 65 1.30 christos void printhead(int); 66 1.30 christos char * sget_msgnum(struct message *, struct message *); 67 1.30 christos void show_msgnum(FILE *, struct message *, struct message *); 68 1.27 christos 69 1.27 christos /* 70 1.27 christos * from cmd2.c 71 1.27 christos */ 72 1.30 christos int Detach(void *); 73 1.30 christos int Save(void *); 74 1.30 christos int clobber(void *); 75 1.30 christos int copycmd(void *); 76 1.30 christos int core(void *); 77 1.30 christos int delete(void *); 78 1.30 christos int deltype(void *); 79 1.30 christos int detach(void *); 80 1.30 christos int igfield(void *); 81 1.30 christos int next(void *); 82 1.30 christos int retfield(void *); 83 1.30 christos int save(void *); 84 1.30 christos int saveigfield(void *); 85 1.30 christos int saveretfield(void *); 86 1.30 christos int swrite(void *); 87 1.30 christos int undeletecmd(void *); 88 1.27 christos 89 1.27 christos /* 90 1.27 christos * from cmd3.c 91 1.27 christos */ 92 1.30 christos int Respond(void *); 93 1.30 christos int alternates(void *); 94 1.30 christos int bounce(void *); 95 1.30 christos int dosh(void *); 96 1.30 christos int echo(void *); 97 1.30 christos int elsecmd(void *); 98 1.30 christos int endifcmd(void *); 99 1.30 christos int file(void *); 100 1.30 christos int bounce(void *); 101 1.30 christos int forward(void *); 102 1.30 christos int group(void *); 103 1.30 christos int help(void *); 104 1.30 christos int ifcmd(void *); 105 1.30 christos int ifdefcmd(void *v); 106 1.30 christos int ifndefcmd(void *v); 107 1.30 christos int markread(void *); 108 1.30 christos int messize(void *); 109 1.30 christos int null(void *); 110 1.30 christos int preserve(void *); 111 1.30 christos int respond(void *); 112 1.30 christos int rexit(void *); 113 1.30 christos int schdir(void *); 114 1.30 christos int set(void *); 115 1.30 christos int shell(void *); 116 1.30 christos int show(void *); 117 1.30 christos int unalias(void *); 118 1.30 christos int unread(void *); 119 1.30 christos int unset(void *); 120 1.27 christos /* XXX - Should this be elsewhere? */ 121 1.30 christos void sort(const char **); 122 1.27 christos 123 1.27 christos /* 124 1.27 christos * from cmd4.c 125 1.27 christos */ 126 1.27 christos struct smopts_s *findsmopts(const char *, int); 127 1.27 christos int smoptscmd(void *); 128 1.27 christos int unsmoptscmd(void *); 129 1.31 christos int Header(void *); 130 1.27 christos 131 1.27 christos /* 132 1.27 christos * from cmdtab.c 133 1.27 christos */ 134 1.27 christos extern const struct cmd cmdtab[]; 135 1.27 christos 136 1.27 christos /* 137 1.27 christos * from collect.c 138 1.27 christos */ 139 1.30 christos FILE * collect(struct header *, int); 140 1.30 christos void savedeadletter(FILE *); 141 1.27 christos 142 1.27 christos /* 143 1.27 christos * from dotlock.c 144 1.27 christos */ 145 1.30 christos int dot_lock(const char *, int, FILE *, const char *); 146 1.30 christos void dot_unlock(const char *); 147 1.27 christos 148 1.27 christos /* 149 1.27 christos * from edit.c 150 1.27 christos */ 151 1.30 christos int editor(void *); 152 1.30 christos int visual(void *); 153 1.30 christos FILE * run_editor(FILE *, off_t, int, int); 154 1.27 christos 155 1.27 christos /* 156 1.27 christos * from fio.c 157 1.27 christos */ 158 1.27 christos const char *expand(const char *); 159 1.30 christos off_t fsize(FILE *); 160 1.27 christos const char *getdeadletter(void); 161 1.30 christos int getfold(char *, size_t); 162 1.31 christos #ifdef USE_EDITLINE 163 1.31 christos #define readline xreadline /* readline() is defined in libedit */ 164 1.31 christos #endif 165 1.31 christos int readline(FILE *, char *, int, int); 166 1.30 christos int putline(FILE *, const char *, int); 167 1.30 christos int rm(char *); 168 1.30 christos FILE * setinput(const struct message *); 169 1.30 christos void setptr(FILE *, off_t); 170 1.27 christos 171 1.27 christos /* 172 1.27 christos * from getname.c 173 1.27 christos */ 174 1.27 christos const char *getname(uid_t); 175 1.30 christos int getuserid(char []); 176 1.27 christos 177 1.27 christos /* 178 1.27 christos * from head.c 179 1.27 christos */ 180 1.30 christos int ishead(const char []); 181 1.30 christos void parse(const char [], struct headline *, char []); 182 1.27 christos 183 1.27 christos /* 184 1.27 christos * from lex.c 185 1.27 christos */ 186 1.30 christos void announce(void); 187 1.30 christos void commands(void); 188 1.28 christos enum execute_contxt_e { ec_normal, ec_composing, ec_autoprint }; 189 1.30 christos int execute(char [], enum execute_contxt_e); 190 1.30 christos int incfile(void); 191 1.27 christos const struct cmd *lex(char []); 192 1.30 christos void load(const char *); 193 1.30 christos int newfileinfo(int); 194 1.30 christos int pversion(void *); 195 1.30 christos int setfile(const char *); 196 1.30 christos char * shellpr(char *); 197 1.30 christos char * get_cmdname(char *); 198 1.27 christos 199 1.27 christos /* 200 1.27 christos * from list.c 201 1.27 christos */ 202 1.30 christos int first(int, int); 203 1.30 christos int get_Hflag(char **); 204 1.30 christos int getmsglist(char *, int *, int); 205 1.30 christos int getrawlist(const char [], char **, int); 206 1.31 christos int show_headers_and_exit(int) __dead; 207 1.27 christos 208 1.27 christos /* 209 1.27 christos * from main.c 210 1.27 christos */ 211 1.27 christos struct name *lexpand(char *, int); 212 1.30 christos void setscreensize(void); 213 1.27 christos 214 1.27 christos /* 215 1.27 christos * from names.c 216 1.27 christos */ 217 1.27 christos struct name *cat(struct name *, struct name *); 218 1.30 christos int count(struct name *); 219 1.27 christos struct name *delname(struct name *, char []); 220 1.30 christos char * detract(struct name *, int); 221 1.30 christos struct name * elide(struct name *); 222 1.30 christos struct name * extract(char [], int); 223 1.30 christos struct name * gexpand(struct name *, struct grouphead *, int, int); 224 1.30 christos struct name * nalloc(char [], int); 225 1.30 christos struct name * outof(struct name *, FILE *, struct header *); 226 1.33 christos const char ** unpack(struct name *, struct name *); 227 1.30 christos struct name * usermap(struct name *); 228 1.27 christos #if 0 229 1.30 christos void prettyprint(struct name *); /* commented out? */ 230 1.27 christos #endif 231 1.27 christos 232 1.27 christos /* 233 1.27 christos * from popen.c 234 1.27 christos */ 235 1.30 christos int Fclose(FILE *); 236 1.30 christos FILE * Fdopen(int, const char *); 237 1.30 christos FILE * Fopen(const char *, const char *); 238 1.30 christos int Pclose(FILE *); 239 1.30 christos FILE * Popen(const char *, const char *); 240 1.30 christos void close_all_files(void); 241 1.30 christos void close_top_files(FILE *); 242 1.30 christos void free_child(int); 243 1.30 christos void prepare_child(sigset_t *, int, int); 244 1.30 christos FILE * last_registered_file(int); 245 1.30 christos void register_file(FILE *, int, int); 246 1.30 christos int run_command(const char *, sigset_t *, int, int, ...); 247 1.30 christos void sigchild(int); 248 1.30 christos int start_command(const char *, sigset_t *, int, int, ...); 249 1.30 christos int wait_child(int); 250 1.25 christos #ifdef MIME_SUPPORT 251 1.30 christos void flush_files(FILE *, int); 252 1.25 christos #endif 253 1.25 christos 254 1.27 christos /* 255 1.27 christos * from quit.c 256 1.27 christos */ 257 1.31 christos void quit(jmp_buf); 258 1.30 christos int quitcmd(void *); 259 1.27 christos 260 1.27 christos /* 261 1.27 christos * from send.c 262 1.27 christos */ 263 1.27 christos #ifndef MIME_SUPPORT 264 1.27 christos # define sendmessage(a,b,c,d,e) legacy_sendmessage(a,b,c,d) 265 1.27 christos # define mail(a,b,c,d,e,f) legacy_mail(a,b,c,d,e) 266 1.26 christos #endif 267 1.30 christos int sendmessage(struct message *, FILE *, struct ignoretab *, const char *, struct mime_info *); 268 1.30 christos int mail(struct name *, struct name *, struct name *, struct name *, char *, struct attachment *); 269 1.30 christos void mail1(struct header *, int); 270 1.30 christos void mail2(FILE *, const char **); 271 1.30 christos int puthead(struct header *, FILE *, int); 272 1.30 christos int sendmail(void *); 273 1.27 christos 274 1.27 christos /* 275 1.27 christos * from strings.c 276 1.27 christos */ 277 1.30 christos void * csalloc(size_t, size_t); 278 1.30 christos void * salloc(size_t); 279 1.30 christos void sreset(void); 280 1.30 christos void spreserve(void); 281 1.26 christos 282 1.27 christos /* 283 1.27 christos * from support.c 284 1.27 christos */ 285 1.30 christos void add_ignore(const char *, struct ignoretab *); 286 1.30 christos void alter(char *); 287 1.30 christos int argcount(char **); 288 1.30 christos int blankline(char []); 289 1.30 christos char * copy(char *, char *); 290 1.30 christos char * hfield(const char [], const struct message *); 291 1.30 christos int isdir(const char []); 292 1.35 mrg int isign(const char *, struct ignoretab [2]); 293 1.30 christos void istrcpy(char *, const char *); 294 1.30 christos int member(char *, struct ignoretab *); 295 1.30 christos char * nameof(struct message *, int); 296 1.32 joerg int sasprintf(char **ret, const char *format, ...) __printflike(2, 3); 297 1.30 christos char * savestr(const char *); 298 1.27 christos struct message *set_m_flag(int, int, int); 299 1.30 christos char * skin(char *); 300 1.30 christos int source(void *); 301 1.30 christos void touch(struct message *); 302 1.30 christos int unstack(void); 303 1.30 christos int upcase(int); 304 1.30 christos void cathelp(const char *); 305 1.26 christos 306 1.27 christos /* 307 1.27 christos * from temp.c 308 1.27 christos */ 309 1.30 christos void tinit(void); 310 1.27 christos 311 1.27 christos /* 312 1.27 christos * from tty.c 313 1.27 christos */ 314 1.30 christos int grabh(struct header *, int); 315 1.27 christos 316 1.27 christos /* 317 1.27 christos * from vars.c 318 1.27 christos */ 319 1.30 christos void assign(const char [], const char []); 320 1.30 christos struct grouphead * findgroup(const char []); 321 1.30 christos int hash(const char *); 322 1.30 christos struct var * lookup(const char []); 323 1.30 christos void printgroup(const char []); 324 1.30 christos void v_free(char *); 325 1.30 christos char * value(const char []); 326 1.30 christos char * vcopy(const char []); 327 1.27 christos 328 1.27 christos /* 329 1.27 christos * from v7.local.c 330 1.27 christos */ 331 1.30 christos void demail(void); 332 1.30 christos void findmail(const char *, char *, size_t); 333 1.27 christos const char *username(void); 334 1.27 christos 335 1.27 christos /* 336 1.27 christos * from version.c 337 1.27 christos */ 338 1.21 christos extern const char *version; 339 1.27 christos 340 1.27 christos 341 1.27 christos #ifndef THREAD_SUPPORT 342 1.27 christos /* 343 1.27 christos * Specials from fio.c (if THREAD_SUPPORT is not defined). 344 1.27 christos * With THREAD_SUPPORT, they live in thread.c. 345 1.27 christos */ 346 1.27 christos struct message *next_message(struct message *); 347 1.27 christos struct message *prev_message(struct message *); 348 1.27 christos struct message *get_message(int); 349 1.30 christos int get_msgnum(struct message *); 350 1.30 christos int get_msgCount(void); 351 1.27 christos 352 1.27 christos /* we remap these commands */ 353 1.27 christos # define get_abs_msgCount get_msgCount 354 1.27 christos # define get_abs_message(a) get_message(a) 355 1.27 christos # define next_abs_message(a) next_message(a) 356 1.27 christos 357 1.27 christos /* we trash these commands */ 358 1.27 christos # define do_recursion() 0 359 1.27 christos # define thread_recursion(mp,fn,args) fn(mp,args) 360 1.36 mrg # define thread_fix_old_links(nmessage,off,omsgCount) 361 1.27 christos # define thread_fix_new_links(message,omsgCount,msgCount) 362 1.27 christos #endif /* THREAD_SUPPORT */ 363 1.26 christos 364 1.26 christos #endif /* __EXTERN_H__ */ 365