1 2 /* $Id: elm_globals.h,v 1.5 1997/10/20 20:24:23 wfp5p Exp $ */ 3 4 /******************************************************************************* 5 * The Elm Mail System - $Revision: 1.5 $ $State: Exp $ 6 * 7 * Copyright (c) 1988-1995 USENET Community Trust 8 * Copyright (c) 1986,1987 Dave Taylor 9 ******************************************************************************* 10 * Bug reports, patches, comments, suggestions should be sent to: 11 * 12 * Bill Pemberton, Elm Coordinator 13 * flash@virginia.edu 14 * 15 ******************************************************************************* 16 * $Log: elm_globals.h,v $ 17 * Revision 1.5 1997/10/20 20:24:23 wfp5p 18 * Incomingfolders no longer set Magic mode on for all remaining folders. 19 * 20 * Revision 1.4 1996/08/08 19:49:18 wfp5p 21 * Alpha 11 22 * 23 * Revision 1.3 1996/05/09 15:50:56 wfp5p 24 * Alpha 10 25 * 26 * Revision 1.2 1996/03/14 17:27:22 wfp5p 27 * Alpha 9 28 * 29 * Revision 1.1 1995/09/29 17:40:48 wfp5p 30 * Alpha 8 (Chip's big changes) 31 * 32 * Revision 1.10 1995/09/27 17:57:19 wfp5p 33 * 2.5 Alpha 7 changes 34 * 35 * Revision 1.9 1995/09/11 15:18:47 wfp5p 36 * Alpha 7 37 * 38 * Revision 1.8 1995/07/18 18:59:47 wfp5p 39 * Alpha 6 40 * 41 * Revision 1.7 1995/06/30 14:56:19 wfp5p 42 * Alpha 5 43 * 44 * Revision 1.6 1995/06/21 15:26:36 wfp5p 45 * editflush and confirmtagsave are new in the elmrc (Keith Neufeld) 46 * 47 * Revision 1.5 1995/06/13 16:04:23 wfp5p 48 * No newline on the last line -- choked some compilers. 49 * 50 * Revision 1.4 1995/06/12 20:32:30 wfp5p 51 * Fixed up a couple of multiple declares 52 * 53 * Revision 1.3 1995/05/10 13:34:29 wfp5p 54 * Added mailing list stuff by Paul Close <pdc@sgi.com> 55 * And NetBSD stuff. 56 * 57 * Revision 1.2 1995/04/20 21:01:10 wfp5p 58 * Removed filter 59 * 60 * Revision 1.1.1.1 1995/04/19 20:38:30 wfp5p 61 * Initial import of elm 2.4 PL0 as base for elm 2.5. 62 * 63 ******************************************************************************/ 64 65 66 /* 67 * All source files in the Elm package should include this right 68 * after "elm_defs.h". This header should not be used by the 69 * library or utility files. 70 */ 71 72 #include "elm_curses.h" 73 74 75 /****************************************************************************/ 76 77 78 #define BACKSPACE '\b' /* backspace character */ 79 #define TAB '\t' /* tab character */ 80 #define RETURN '\r' /* carriage return char */ 81 #define LINE_FEED '\n' /* line feed character */ 82 #define FORMFEED '\f' /* form feed (^L) char */ 83 #define ESCAPE '\033' /* the escape */ 84 85 #define NO 0 86 #define YES 1 87 #define NO_TITE 2 /* ti/te or in flag */ 88 #define MAYBE 2 /* a definite define, eh? */ 89 #define FORM 3 /* <nevermind> */ 90 #define PREFORMATTED 4 /* forwarded form... */ 91 92 #define SAME_PAGE 1 /* redraw current only */ 93 #define NEW_PAGE 2 /* redraw message list */ 94 #define ILLEGAL_PAGE 0 /* error in page list, punt */ 95 96 /* special cookies that may appear in the user's message text */ 97 #define MSSG_START_ENCODE "[encode]" 98 #define MSSG_END_ENCODE "[clear]" 99 #define MSSG_DONT_SAVE "[no save]" 100 #define MSSG_DONT_SAVE2 "[nosave]" 101 #define MSSG_INCLUDE "include" 102 #define MSSG_ATTACH "attach" 103 104 /* message sorting selections */ 105 #define REVERSE - /* for reverse sorting */ 106 #define SENT_DATE 1 /* the date message was sent */ 107 #define RECEIVED_DATE 2 /* the date message was received */ 108 #define SENDER 3 /* the name/address of sender */ 109 #define SIZE 4 /* the # of lines of the message */ 110 #define SUBJECT 5 /* the subject of the message */ 111 #define STATUS 6 /* the status (deleted, etc) */ 112 #define MAILBOX_ORDER 7 /* the order it is in the file */ 113 114 /* alias sorting selections */ 115 #define ALIAS_SORT 1 /* the name of the alias */ 116 #define NAME_SORT 2 /* the actual name for the alias */ 117 #define TEXT_SORT 3 /* the order of aliases.text */ 118 #define LAST_ALIAS_SORT TEXT_SORT 119 120 /* options to the copy_message() procedure */ 121 #define CM_REMOVE_HEADER (1<<0) /* skip header of message */ 122 #define CM_REMOTE (1<<1) /* append remote from hostname to */ 123 /* first line */ 124 #define CM_UPDATE_STATUS (1<<2) /* Update Status: Header */ 125 #define CM_MMDF_HEAD (1<<3) /* strip mmdf message seperator */ 126 #define CM_REMAIL (1<<4) /* Add Sender: and Orig-To: headers */ 127 #define CM_DECODE (1<<5) /* prompt for key if message is */ 128 /* encrypted */ 129 #define CM_PREFIX (1<<6) /* Add prefix (">", etc.) to lines */ 130 #define CM_FORWARDING (1<<7) /* text is a message that we are */ 131 /* forwarding */ 132 #define CM_ATTRIBUTION (1<<8) /* add attribution strings that */ 133 /* format this as an included mssg */ 134 135 /* options to the leave() procedure */ 136 #define LEAVE_NORMAL 000 /* normal program termination */ 137 #define LEAVE_ERROR 001 /* exit due to program error */ 138 #define LEAVE_KEEP_EDITTMP 010 /* ...preserve composition file */ 139 #define LEAVE_KEEP_TEMPFOLDER 020 /* ...preserve temp folder */ 140 #define LEAVE_KEEP_LOCK 040 /* ...preserve folder locks */ 141 #define LEAVE_EMERGENCY 071 /* emergency exit */ 142 #define LEAVE_EXIT_STATUS(mode) ((mode) & 07) 143 144 /* options to the lock() procedure */ 145 #define LOCK_OUTGOING 0 146 #define LOCK_INCOMING 1 147 148 /* options to the meta_match() procedure */ 149 #define MATCH_TAG 0 /* tag matching entries */ 150 #define MATCH_DELETE 1 /* delete matching entries */ 151 #define MATCH_UNDELETE 2 /* undelete matching entries */ 152 153 /* options to the system_call() procedure */ 154 #define SY_USER_SHELL (1<<0) /* use user shell instead of /bin/sh */ 155 #define SY_ENV_SHELL (1<<1) /* put SHELL=[shell] into environ */ 156 #define SY_ENAB_SIGHUP (1<<2) /* pgm to exec can handle signals */ 157 #define SY_ENAB_SIGINT (1<<3) /* ...and it can handle SIGINT too */ 158 #define SY_DUMPSTATE (1<<4) /* create folder state dump file */ 159 #define SY_COOKED (1<<5) /* run with tty in cooked mode */ 160 161 162 /****************************************************************************/ 163 164 165 /* map character (e.g. 'A') to its control equivalent (e.g. '^A') */ 166 #define ctrl(c) (((c) + '@') & 0x7f) 167 168 /* calculate next tabstop from position (col) */ 169 /* leftmost col is zero, assumes 8-position tabstops */ 170 #define tabstop(col) (((col) & ~07) + 010) 171 172 #define whitespace(c) ((c) == ' ' || (c) == '\t') 173 174 #define no_ret(s) { register int xyz; /* varname is for lint */ \ 175 for (xyz=strlen(s)-1; xyz >= 0 && \ 176 (s[xyz] == '\r' || s[xyz] == '\n'); ) \ 177 s[xyz--] = '\0'; \ 178 } 179 180 #define onoff(n) ((n) == 0 ? "OFF" : "ON") 181 #define ison(n, mask) (((n) & (mask)) != 0) 182 #define isoff(n, mask) (((n) & (mask)) == 0) 183 #define setit(n, mask) (n) |= (mask) 184 #define clearit(n, mask) (n) &= ~(mask) 185 186 187 /****************************************************************************/ 188 189 190 /* 191 * "opmode" global - current operation mode settings. 192 */ 193 194 #define OPMODE_READ 010 /* running in folder read mode */ 195 #define OPMODE_READ_NONEMPTY 011 /* ...only read if non-empty */ 196 #define OPMODE_SEND 020 /* running in send-only mode */ 197 #define OPMODE_SEND_BATCH 021 /* ...performing batch send */ 198 199 #define OPMODE_IS_READMODE(op) (((op) & OPMODE_READ) != 0) 200 #define OPMODE_IS_SENDMODE(op) (((op) & OPMODE_SEND) != 0) 201 #define OPMODE_IS_INTERACTIVE(op) ((op) != OPMODE_SEND_BATCH) 202 203 /* 204 * FOLDER "flags" settings. 205 */ 206 207 #define FOLDER_IS_SPOOL (1<<0) 208 209 typedef struct mail_folder { 210 int flags; /* special handling flags for folder */ 211 char filename[SLEN]; /* pathname to the current folder */ 212 char tempname[SLEN]; /* pathname to workfile copy of the */ 213 /* folder if IS_SPOOL, otherwise */ 214 /* an empty string */ 215 FILE *fp; /* file stream for folder */ 216 long size; /* size of folder in bytes */ 217 int num_mssgs; /* number of messages in folder */ 218 int curr_mssg; /* selected message (first = 1) */ 219 struct header_rec **headers; /* list of message headers info */ 220 int max_headers; /* allocated size of "headers" list */ 221 } FOLDER; 222 223 224 /* 225 * global information initialized at startup 226 */ 227 228 EXTERN char version_buff[NLEN]; /* version buffer */ 229 EXTERN int userid; /* uid for current user */ 230 EXTERN int groupid; /* groupid for current user */ 231 EXTERN int mailgroupid; /* gid for mail spool files */ 232 EXTERN int original_umask; /* umask at startup */ 233 234 /* 235 * options set by the command line 236 */ 237 238 EXTERN int opmode; /* selected operating mode */ 239 EXTERN int sendmail_verbose; /* enable sendmail debug option */ 240 EXTERN int TreatAsSpooled; /* lock even non-spool folders (-M flag) */ 241 EXTERN char *batch_subject; /* subject for batch transmission */ 242 EXTERN char *included_file; /* message to load in send mode */ 243 244 /* 245 * the current mail folder 246 * 247 * FOO - Eventually I would like to see this deleted, and Elm have 248 * the ability to process multiple folders doing various things. 249 */ 250 251 EXTERN FOLDER curr_folder; 252 253 /* 254 * aliases 255 */ 256 257 EXTERN struct alias_rec **aliases; /* list of defined aliases */ 258 EXTERN int max_aliases INIT(0); /* allocated size of the list */ 259 EXTERN int num_aliases INIT(0); /* number aliases used in list */ 260 EXTERN int curr_alias; /* index of selected alias */ 261 262 263 /* 264 * butt ugly state stuff, most of which should not be global in this fashion 265 */ 266 267 EXTERN int inalias INIT(FALSE); /* TRUE if in the alias menu */ 268 EXTERN int header_page INIT(0); /* current header page */ 269 EXTERN int last_current INIT(-1); /* previous current message */ 270 EXTERN int last_header_page INIT(-1); /* last header page */ 271 EXTERN int headers_per_page INIT(0); /* number of headers/page */ 272 EXTERN int redraw INIT(FALSE); /* need to rewrite the entire screen? */ 273 EXTERN int nucurr INIT(FALSE); /* change list or just curr pointer */ 274 EXTERN int nufoot INIT(FALSE); /* clear lines 16 thru bottom */ 275 EXTERN int selected INIT(FALSE); /* used for select stuff */ 276 277 278 /* 279 * configuration file settings 280 * 281 * In addition to these settings, the following globals from "elm_defs.h" 282 * also may be set by the configuration file: 283 * 284 * - char host_name[SLEN]; 285 * - char host_domain[SLEN]; 286 * - char host_fullname[SLEN]; 287 * - char full_user_name[SLEN]; 288 * - struct addr_rec *alternative_addresses; 289 */ 290 291 EXTERN char temp_dir[SLEN]; /* name of temp directory */ 292 EXTERN char raw_temp_dir[SLEN]; /* unexpanded name of temp directory */ 293 EXTERN char folders[SLEN]; /* folder home directory */ 294 EXTERN char raw_folders[SLEN]; /* unexpanded folder home directory */ 295 EXTERN char recvd_mail[SLEN]; /* folder for storing received mail */ 296 EXTERN char raw_recvdmail[SLEN]; /* unexpanded recvd_mail name */ 297 EXTERN char editor[SLEN]; /* default editor for mail */ 298 EXTERN char raw_editor[SLEN]; /* unexpanded default editor for mail */ 299 EXTERN char alternative_editor[SLEN]; /* the 'other' editor */ 300 EXTERN char printout[SLEN]; /* how to print messages */ 301 EXTERN char raw_printout[SLEN]; /* unexpanded how to print messages */ 302 EXTERN char printhdrs[SLEN]; /* headers to select and weed on printing */ 303 EXTERN char sent_mail[SLEN]; /* name of file to save copies to */ 304 EXTERN char raw_sentmail[SLEN]; /* unexpanded name of file to save to */ 305 EXTERN char calendar_file[SLEN]; /* name of file for clndr */ 306 EXTERN char raw_calendar_file[SLEN]; /* unexpanded name of file for clndr */ 307 EXTERN char attribution[SLEN]; /* attribution string for replies */ 308 EXTERN char fwdattribution[SLEN]; /* attribution string for forwarded mssgs */ 309 EXTERN char prefixchars[SLEN] INIT("> "); /* prefix char(s) for msgs */ 310 EXTERN char shell[SLEN]; /* default system shell */ 311 EXTERN char raw_shell[SLEN]; /* unexpanded default system shell */ 312 EXTERN char pager[SLEN]; /* what pager to use... */ 313 EXTERN char raw_pager[SLEN]; /* unexpanded what pager to use... */ 314 EXTERN char local_signature[SLEN]; /* local msg signature file */ 315 EXTERN char raw_local_signature[SLEN]; /* unexpanded local msg sig file */ 316 EXTERN char remote_signature[SLEN]; /* remote msg signature file */ 317 EXTERN char raw_remote_signature[SLEN]; /* unexpanded remote msg sig file */ 318 EXTERN char e_editor[SLEN]; /* "~e" editor... */ 319 EXTERN char v_editor[SLEN]; /* "~v" editor... */ 320 EXTERN char config_options[SLEN]; /* which options are in o)ptions */ 321 EXTERN char allowed_precedences[SLEN]; /* list of precedences user may specify */ 322 EXTERN char to_chars[SLEN]; /* chars to indicate who mail is to */ 323 EXTERN char charset[SLEN]; /* 8-bit charset for outbound mssgs */ 324 EXTERN char display_charset[SLEN]; /* charset display can handle */ 325 EXTERN char charset_compatlist[SLEN]; /* charsets upward compat to US-ASCII */ 326 327 EXTERN unsigned char escape_char INIT('~'); /* '~' or something else... */ 328 329 EXTERN char *weedlist[MAX_IN_WEEDLIST]; /* header weeding list */ 330 EXTERN int weedcount; /* number of headers to check */ 331 332 EXTERN char *magiclist[MAX_IN_WEEDLIST];/* list of folders to use magic mode */ 333 EXTERN int magiccount; /* number of magic folders */ 334 335 EXTERN int allow_forms INIT(FALSE); /* are AT&T Mail forms okay? */ 336 EXTERN int allow_setuid INIT(FALSE); /* allow execution where uid!=euid */ 337 EXTERN int always_delete INIT(FALSE); /* always delete marked msgs? */ 338 EXTERN int always_keep INIT(TRUE); /* always keep unread msgs? */ 339 EXTERN int always_store INIT(FALSE); /* always store read mail? */ 340 EXTERN int arrow_cursor INIT(FALSE); /* use "->" regardless? */ 341 EXTERN int ask_delete INIT(TRUE); /* confirm delete on resync? */ 342 EXTERN int ask_keep INIT(TRUE); /* ask to keep unread msgs? */ 343 EXTERN int ask_reply_copy INIT(TRUE); /* ask to copy mssg into reply? */ 344 EXTERN int ask_store INIT(TRUE); /* ask to store read mail? */ 345 EXTERN int auto_cc INIT(FALSE); /* mail copy to yourself? */ 346 EXTERN int bounceback INIT(FALSE); /* bounce copy off remote? */ 347 EXTERN int builtin_lines INIT(-3); /* int use builtin pager? */ 348 EXTERN int confirm_append INIT(FALSE); /* confirm append to folder? */ 349 EXTERN int confirm_create INIT(FALSE); /* confirm create new folder? */ 350 EXTERN int confirm_files INIT(FALSE); /* confirm files for append? */ 351 EXTERN int confirm_folders INIT(FALSE); /* confirm folders for create? */ 352 EXTERN int confirm_tag_save INIT(TRUE); /* confirm saving tagged messages if the cursor on untagged message? */ 353 EXTERN int edit_flush INIT(TRUE); /* flush input after extern edit? */ 354 EXTERN int filter INIT(TRUE); /* weed out header lines? */ 355 EXTERN int force_name INIT(FALSE); /* save by name forced? */ 356 EXTERN int hp_softkeys INIT(FALSE); /* are there softkeys? */ 357 EXTERN int keep_empty_files INIT(FALSE);/* keep empty files? */ 358 EXTERN int metoo INIT(FALSE); /* copy me on mail to alias? */ 359 EXTERN int mini_menu INIT(TRUE); /* display menu? */ 360 EXTERN int move_when_paged INIT(FALSE); /* move when '+' or '-' used? */ 361 EXTERN int names_only INIT(TRUE); /* display names but no addrs? */ 362 EXTERN int noheader INIT(TRUE); /* copy + header to file? */ 363 EXTERN int point_to_new INIT(TRUE); /* start pointing at new msgs? */ 364 EXTERN int prompt_after_pager INIT(TRUE);/* prompt after pager exits */ 365 EXTERN int prompt_for_cc INIT(TRUE); /* prompt user for 'cc' value? */ 366 EXTERN int readmsginc INIT(1); /* msg cnt incr during new mbox read */ 367 EXTERN int reply_copy INIT(TRUE); /* copy message into reply? */ 368 EXTERN int resolve_mode INIT(TRUE); /* resolve before moving mode? */ 369 EXTERN int save_by_alias INIT(TRUE); /* save mail by alias of login name? */ 370 EXTERN int save_by_name INIT(TRUE); /* save mail by login name? */ 371 EXTERN int show_mlists INIT(FALSE); /* show mailing list info? */ 372 EXTERN int show_reply INIT(FALSE); /* show 'r' for replied mail */ 373 EXTERN int sig_dashes INIT(TRUE); /* put dashes above signature? */ 374 EXTERN int sleepmsg INIT(2); /* secs pause for transient messages */ 375 EXTERN int title_messages INIT(TRUE); /* title message display? */ 376 EXTERN int use_tite INIT(TRUE); /* use termcap/terminfo ti/te? */ 377 EXTERN int user_level INIT(0); /* numeric user level */ 378 379 EXTERN int sortby INIT(REVERSE SENT_DATE); /* how to sort folders */ 380 EXTERN int alias_sortby INIT(NAME_SORT);/* how to sort aliases */ 381 382 EXTERN int clear_pages INIT(FALSE); /* clear screen w/ builtin pgr? */ 383 384 EXTERN long timeout INIT(600L); /* seconds for main level timeout */ 385 386 387 /* 388 * pre-formatted NLS strings 389 */ 390 391 EXTERN char *def_ans_yes; /* yes answer - single char, lwr case */ 392 EXTERN char *def_ans_no; /* no answer - single char, lwr case */ 393 EXTERN char *nls_deleted; /* [deleted] */ 394 EXTERN char *nls_form; /* Form */ 395 EXTERN char *nls_message; /* Message */ 396 EXTERN char *nls_to; /* To */ 397 EXTERN char *nls_from; /* From */ 398 EXTERN char *nls_page; /* Page */ 399 EXTERN char *nls_item; /* message or alias */ 400 EXTERN char *nls_items; /* messages or aliases */ 401 EXTERN char *nls_Item; /* Message or Alias */ 402 EXTERN char *nls_Items; /* Messages or Aliases */ 403 EXTERN char *nls_Prompt; /* Command or Alias */ 404 405 406 /* 407 * old declarations 408 */ 409 410 char *bounce_off_remote(); 411 char *expand_system(); 412 char *format_long(); 413 char *get_alias_address(); 414 char *get_date(); 415 char *get_token(); 416 char *level_name(); 417 char *strip_commas(); 418 419 420 /* 421 * The files I've been through sorting out the public and private routines 422 * are marked internally as either "PUBLIC" or "static". 423 */ 424 425 #define PUBLIC 426 427 428 /* fbrowser.c */ 429 430 #define FB_EXIST (1<<0) /* file must exist */ 431 #define FB_READ (1<<1) /* file must exist and be readable */ 432 #define FB_WRITE (1<<2) /* if file exists, must be writable */ 433 #define FB_MBOX (1<<3) /* if file exists, must be mbox format */ 434 435 int fbrowser P_((char *, int, const char *, const char *, int, const char *)); 436 int fbrowser_analyze_spec P_((const char *, char *, char *)); 437 438 439 /* file_ops.c */ 440 441 FILE *file_open P_((const char *, const char *)); 442 int file_close P_((FILE *, const char *)); 443 int file_access P_((const char *, int)); 444 int file_seek P_((FILE *, long, int, const char *)); 445 int file_copy P_((FILE *, FILE *, const char *, const char *)); 446 int file_rename P_((const char *, const char *)); 447 448 449 /* sendmsg.c */ 450 451 /* options to send_message() */ 452 #define SM_ORIGINAL 0 /* this is an original message */ 453 #define SM_REPLY 1 /* this is a response to the current mssg */ 454 #define SM_FORWARD 2 /* the current mssg is being forwarded */ 455 #define SM_FWDUNQUOTE 3 /* forward - without quoting or editing */ 456 #define SM_FORMRESP 4 /* this is a response to a fill-out form */ 457 458 int send_message P_((const char *, const char *, const char *, int)); 459 void display_to P_((char *)); 460 int get_to P_((char *, char *, int)); 461 #ifdef MMDF 462 void do_mmdf_addresses P_((FILE *, char *)); 463 #endif 464 char *build_mailer_command P_((char *, const char *, char *, char *, char *)); 465 466