1*0Sstevel@tonic-gate /* 2*0Sstevel@tonic-gate * CDDL HEADER START 3*0Sstevel@tonic-gate * 4*0Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5*0Sstevel@tonic-gate * Common Development and Distribution License, Version 1.0 only 6*0Sstevel@tonic-gate * (the "License"). You may not use this file except in compliance 7*0Sstevel@tonic-gate * with the License. 8*0Sstevel@tonic-gate * 9*0Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10*0Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 11*0Sstevel@tonic-gate * See the License for the specific language governing permissions 12*0Sstevel@tonic-gate * and limitations under the License. 13*0Sstevel@tonic-gate * 14*0Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 15*0Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16*0Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 17*0Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 18*0Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 19*0Sstevel@tonic-gate * 20*0Sstevel@tonic-gate * CDDL HEADER END 21*0Sstevel@tonic-gate */ 22*0Sstevel@tonic-gate /* 23*0Sstevel@tonic-gate * Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T 24*0Sstevel@tonic-gate * All Rights Reserved 25*0Sstevel@tonic-gate * 26*0Sstevel@tonic-gate * 27*0Sstevel@tonic-gate * Copyright (c) 1985-2001 by Sun Microsystems, Inc. 28*0Sstevel@tonic-gate * All rights reserved. 29*0Sstevel@tonic-gate */ 30*0Sstevel@tonic-gate 31*0Sstevel@tonic-gate /* 32*0Sstevel@tonic-gate * University Copyright- Copyright (c) 1982, 1986, 1988 33*0Sstevel@tonic-gate * The Regents of the University of California 34*0Sstevel@tonic-gate * All Rights Reserved 35*0Sstevel@tonic-gate * 36*0Sstevel@tonic-gate * University Acknowledgment- Portions of this document are derived from 37*0Sstevel@tonic-gate * software developed by the University of California, Berkeley, and its 38*0Sstevel@tonic-gate * contributors. 39*0Sstevel@tonic-gate */ 40*0Sstevel@tonic-gate 41*0Sstevel@tonic-gate #ifndef _MAILX_DEF_H 42*0Sstevel@tonic-gate #define _MAILX_DEF_H 43*0Sstevel@tonic-gate 44*0Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 45*0Sstevel@tonic-gate 46*0Sstevel@tonic-gate #ifdef __cplusplus 47*0Sstevel@tonic-gate extern "C" { 48*0Sstevel@tonic-gate #endif 49*0Sstevel@tonic-gate 50*0Sstevel@tonic-gate #include <sys/types.h> 51*0Sstevel@tonic-gate #include <signal.h> 52*0Sstevel@tonic-gate #include <stdio.h> 53*0Sstevel@tonic-gate #include <fcntl.h> 54*0Sstevel@tonic-gate #include <string.h> 55*0Sstevel@tonic-gate #include <termio.h> 56*0Sstevel@tonic-gate #include <setjmp.h> 57*0Sstevel@tonic-gate #include <time.h> 58*0Sstevel@tonic-gate #include <sys/stat.h> 59*0Sstevel@tonic-gate #include <maillock.h> 60*0Sstevel@tonic-gate #include <ctype.h> 61*0Sstevel@tonic-gate #include <errno.h> 62*0Sstevel@tonic-gate #ifndef preSVr4 63*0Sstevel@tonic-gate # include <unistd.h> 64*0Sstevel@tonic-gate # include <stdlib.h> 65*0Sstevel@tonic-gate # include <ulimit.h> 66*0Sstevel@tonic-gate # include <wait.h> 67*0Sstevel@tonic-gate #endif 68*0Sstevel@tonic-gate #ifdef VMUNIX 69*0Sstevel@tonic-gate #include <sys/wait.h> 70*0Sstevel@tonic-gate #endif 71*0Sstevel@tonic-gate #include "local.h" 72*0Sstevel@tonic-gate #include "uparm.h" 73*0Sstevel@tonic-gate 74*0Sstevel@tonic-gate /* 75*0Sstevel@tonic-gate * mailx -- a modified version of a University of California at Berkeley 76*0Sstevel@tonic-gate * mail program 77*0Sstevel@tonic-gate */ 78*0Sstevel@tonic-gate 79*0Sstevel@tonic-gate #define SENDESC '~' /* Default escape for sending */ 80*0Sstevel@tonic-gate #define NMLSIZE 1024 /* max names in a message list */ 81*0Sstevel@tonic-gate #define PATHSIZE 1024 /* Size of pathnames throughout */ 82*0Sstevel@tonic-gate #define HSHSIZE 59 /* Hash size for aliases and vars */ 83*0Sstevel@tonic-gate #define HDRFIELDS 3 /* Number of header fields */ 84*0Sstevel@tonic-gate #define LINESIZE 5120 /* max readable line width */ 85*0Sstevel@tonic-gate #define STRINGSIZE ((unsigned) 128)/* Dynamic allocation units */ 86*0Sstevel@tonic-gate #define MAXARGC 1024 /* Maximum list of raw strings */ 87*0Sstevel@tonic-gate #define NOSTR ((char *) 0) /* Nill string pointer */ 88*0Sstevel@tonic-gate #define NOSTRPTR ((char **) 0) /* Nill pointer to string pointer */ 89*0Sstevel@tonic-gate #define NOINTPTR ((int *) 0) /* Nill pointer */ 90*0Sstevel@tonic-gate #define MAXEXP 25 /* Maximum expansion of aliases */ 91*0Sstevel@tonic-gate 92*0Sstevel@tonic-gate #define equal(a, b) (strcmp(a,b)==0)/* A nice function to string compare */ 93*0Sstevel@tonic-gate #define fopen(s,t) my_fopen(s,t) /* Keep a list of all opened files */ 94*0Sstevel@tonic-gate #define fclose(s) my_fclose(s) /* delete closed file from the list*/ 95*0Sstevel@tonic-gate 96*0Sstevel@tonic-gate struct message { 97*0Sstevel@tonic-gate off_t m_offset; /* offset in block of message */ 98*0Sstevel@tonic-gate long m_size; /* Bytes in the message */ 99*0Sstevel@tonic-gate long m_lines; /* Lines in the message */ 100*0Sstevel@tonic-gate long m_clen; /* Content-Length of the mesg */ 101*0Sstevel@tonic-gate short m_flag; /* flags, see below */ 102*0Sstevel@tonic-gate char m_text; /* TRUE if the contents is text */ 103*0Sstevel@tonic-gate /* False otherwise */ 104*0Sstevel@tonic-gate }; 105*0Sstevel@tonic-gate 106*0Sstevel@tonic-gate typedef struct fplst { 107*0Sstevel@tonic-gate FILE *fp; 108*0Sstevel@tonic-gate struct fplst *next; 109*0Sstevel@tonic-gate } NODE; 110*0Sstevel@tonic-gate 111*0Sstevel@tonic-gate /* 112*0Sstevel@tonic-gate * flag bits. 113*0Sstevel@tonic-gate */ 114*0Sstevel@tonic-gate 115*0Sstevel@tonic-gate #define MUSED (1<<0) /* entry is used, but this bit isn't */ 116*0Sstevel@tonic-gate #define MDELETED (1<<1) /* entry has been deleted */ 117*0Sstevel@tonic-gate #define MSAVED (1<<2) /* entry has been saved */ 118*0Sstevel@tonic-gate #define MTOUCH (1<<3) /* entry has been noticed */ 119*0Sstevel@tonic-gate #define MPRESERVE (1<<4) /* keep entry in sys mailbox */ 120*0Sstevel@tonic-gate #define MMARK (1<<5) /* message is marked! */ 121*0Sstevel@tonic-gate #define MODIFY (1<<6) /* message has been modified */ 122*0Sstevel@tonic-gate #define MNEW (1<<7) /* message has never been seen */ 123*0Sstevel@tonic-gate #define MREAD (1<<8) /* message has been read sometime. */ 124*0Sstevel@tonic-gate #define MSTATUS (1<<9) /* message status has changed */ 125*0Sstevel@tonic-gate #define MBOX (1<<10) /* Send this to mbox, regardless */ 126*0Sstevel@tonic-gate #define MBOXED (1<<11) /* message has been sent to mbox */ 127*0Sstevel@tonic-gate 128*0Sstevel@tonic-gate #define H_AFWDCNT 1 /* "Auto-Forward-Count:" */ 129*0Sstevel@tonic-gate #define H_AFWDFROM 2 /* "Auto-Forwarded-From:" */ 130*0Sstevel@tonic-gate #define H_CLEN 3 /* "Content-Length:" */ 131*0Sstevel@tonic-gate #define H_CTYPE 4 /* "Content-Type:" */ 132*0Sstevel@tonic-gate #define H_DATE 5 /* "Date:" */ 133*0Sstevel@tonic-gate #define H_DEFOPTS 6 /* "Default-Options:" */ 134*0Sstevel@tonic-gate #define H_EOH 7 /* "End-of-Header:" */ 135*0Sstevel@tonic-gate #define H_FROM 8 /* "From " */ 136*0Sstevel@tonic-gate #define H_FROM1 9 /* ">From " */ 137*0Sstevel@tonic-gate #define H_FROM2 10 /* "From: " */ 138*0Sstevel@tonic-gate #define H_MTSID 11 /* "MTS-Message-ID:" */ 139*0Sstevel@tonic-gate #define H_MTYPE 12 /* "Message-Type:" */ 140*0Sstevel@tonic-gate #define H_MVERS 13 /* "Message-Version:" */ 141*0Sstevel@tonic-gate #define H_MSVC 14 /* "Message-Service:" */ 142*0Sstevel@tonic-gate #define H_RECEIVED 15 /* "Received:" */ 143*0Sstevel@tonic-gate #define H_RVERS 16 /* "Report-Version:" */ 144*0Sstevel@tonic-gate #define H_STATUS 17 /* "Status:" */ 145*0Sstevel@tonic-gate #define H_SUBJ 18 /* "Subject:" */ 146*0Sstevel@tonic-gate #define H_TO 19 /* "To:" */ 147*0Sstevel@tonic-gate #define H_TCOPY 20 /* ">To:" */ 148*0Sstevel@tonic-gate #define H_TROPTS 21 /* "Transport-Options:" */ 149*0Sstevel@tonic-gate #define H_UAID 22 /* "UA-Content-ID:" */ 150*0Sstevel@tonic-gate #define H_DAFWDFROM 23 /* Hold A-F-F when sending Del. Notf. */ 151*0Sstevel@tonic-gate #define H_DTCOPY 24 /* Hold ">To:" when sending Del. Notf.*/ 152*0Sstevel@tonic-gate #define H_DRECEIVED 25 /* Hold Rcvd: when sending Del. Notf.*/ 153*0Sstevel@tonic-gate #define H_CONT 26 /* Continuation of previous line */ 154*0Sstevel@tonic-gate #define H_NAMEVALUE 27 /* unrecognized "name: value" hdr line*/ 155*0Sstevel@tonic-gate 156*0Sstevel@tonic-gate /* 157*0Sstevel@tonic-gate * Format of the command description table. 158*0Sstevel@tonic-gate * The actual table is declared and initialized 159*0Sstevel@tonic-gate * in lex.c 160*0Sstevel@tonic-gate */ 161*0Sstevel@tonic-gate 162*0Sstevel@tonic-gate struct cmd { 163*0Sstevel@tonic-gate char *c_name; /* Name of command */ 164*0Sstevel@tonic-gate int (*c_func)(void *); /* Implementor of the command */ 165*0Sstevel@tonic-gate short c_argtype; /* Type of arglist (see below) */ 166*0Sstevel@tonic-gate short c_msgflag; /* Required flags of messages */ 167*0Sstevel@tonic-gate short c_msgmask; /* Relevant flags of messages */ 168*0Sstevel@tonic-gate }; 169*0Sstevel@tonic-gate 170*0Sstevel@tonic-gate /* can't initialize unions */ 171*0Sstevel@tonic-gate 172*0Sstevel@tonic-gate #define c_minargs c_msgflag /* Minimum argcount for RAWLIST */ 173*0Sstevel@tonic-gate #define c_maxargs c_msgmask /* Max argcount for RAWLIST */ 174*0Sstevel@tonic-gate 175*0Sstevel@tonic-gate /* 176*0Sstevel@tonic-gate * Argument types. 177*0Sstevel@tonic-gate */ 178*0Sstevel@tonic-gate 179*0Sstevel@tonic-gate #define MSGLIST 0 /* Message list type */ 180*0Sstevel@tonic-gate #define STRLIST 1 /* A pure string */ 181*0Sstevel@tonic-gate #define RAWLIST 2 /* Shell string list */ 182*0Sstevel@tonic-gate #define NOLIST 3 /* Just plain 0 */ 183*0Sstevel@tonic-gate #define NDMLIST 4 /* Message list, no defaults */ 184*0Sstevel@tonic-gate 185*0Sstevel@tonic-gate #define P 040 /* Autoprint dot after command */ 186*0Sstevel@tonic-gate #define I 0100 /* Interactive command bit */ 187*0Sstevel@tonic-gate #define M 0200 /* Legal from send mode bit */ 188*0Sstevel@tonic-gate #define W 0400 /* Illegal when read only bit */ 189*0Sstevel@tonic-gate #define F 01000 /* Is a conditional command */ 190*0Sstevel@tonic-gate #define T 02000 /* Is a transparent command */ 191*0Sstevel@tonic-gate #define R 04000 /* Cannot be called from collect */ 192*0Sstevel@tonic-gate 193*0Sstevel@tonic-gate /* 194*0Sstevel@tonic-gate * Oft-used mask values 195*0Sstevel@tonic-gate */ 196*0Sstevel@tonic-gate 197*0Sstevel@tonic-gate #define MMNORM (MDELETED|MSAVED)/* Look at both save and delete bits */ 198*0Sstevel@tonic-gate #define MMNDEL MDELETED /* Look only at deleted bit */ 199*0Sstevel@tonic-gate 200*0Sstevel@tonic-gate /* 201*0Sstevel@tonic-gate * Structure used to return a break down of a head 202*0Sstevel@tonic-gate * line 203*0Sstevel@tonic-gate */ 204*0Sstevel@tonic-gate 205*0Sstevel@tonic-gate struct headline { 206*0Sstevel@tonic-gate char *l_from; /* The name of the sender */ 207*0Sstevel@tonic-gate char *l_tty; /* His tty string (if any) */ 208*0Sstevel@tonic-gate char *l_date; /* The entire date string */ 209*0Sstevel@tonic-gate }; 210*0Sstevel@tonic-gate 211*0Sstevel@tonic-gate #define GTO 1 /* Grab To: line */ 212*0Sstevel@tonic-gate #define GSUBJECT 2 /* Likewise, Subject: line */ 213*0Sstevel@tonic-gate #define GCC 4 /* And the Cc: line */ 214*0Sstevel@tonic-gate #define GBCC 8 /* And also the Bcc: line */ 215*0Sstevel@tonic-gate #define GDEFOPT 16 /* And the Default-Options: lines */ 216*0Sstevel@tonic-gate #define GNL 32 /* Print blank line after */ 217*0Sstevel@tonic-gate #define GOTHER 64 /* Other header lines */ 218*0Sstevel@tonic-gate #define GMASK (GTO|GSUBJECT|GCC|GBCC|GDEFOPT|GNL|GOTHER) 219*0Sstevel@tonic-gate /* Mask of all header lines */ 220*0Sstevel@tonic-gate #define GDEL 128 /* Entity removed from list */ 221*0Sstevel@tonic-gate #define GCLEN 256 /* Include Content-Length header */ 222*0Sstevel@tonic-gate 223*0Sstevel@tonic-gate /* 224*0Sstevel@tonic-gate * Structure used to pass about the current 225*0Sstevel@tonic-gate * state of the user-typed message header. 226*0Sstevel@tonic-gate */ 227*0Sstevel@tonic-gate 228*0Sstevel@tonic-gate struct header { 229*0Sstevel@tonic-gate char *h_to; /* Dynamic "To:" string */ 230*0Sstevel@tonic-gate char *h_subject; /* Subject string */ 231*0Sstevel@tonic-gate char *h_cc; /* Carbon copies string */ 232*0Sstevel@tonic-gate char *h_bcc; /* Blind carbon copies */ 233*0Sstevel@tonic-gate char *h_defopt; /* Default options */ 234*0Sstevel@tonic-gate char **h_others; /* Other header lines */ 235*0Sstevel@tonic-gate int h_seq; /* Sequence for optimization */ 236*0Sstevel@tonic-gate }; 237*0Sstevel@tonic-gate 238*0Sstevel@tonic-gate /* 239*0Sstevel@tonic-gate * Structure of namelist nodes used in processing 240*0Sstevel@tonic-gate * the recipients of mail and aliases and all that 241*0Sstevel@tonic-gate * kind of stuff. 242*0Sstevel@tonic-gate */ 243*0Sstevel@tonic-gate 244*0Sstevel@tonic-gate struct name { 245*0Sstevel@tonic-gate struct name *n_flink; /* Forward link in list. */ 246*0Sstevel@tonic-gate struct name *n_blink; /* Backward list link */ 247*0Sstevel@tonic-gate short n_type; /* From which list it came */ 248*0Sstevel@tonic-gate char *n_name; /* This fella's name */ 249*0Sstevel@tonic-gate char *n_full; /* Full name */ 250*0Sstevel@tonic-gate }; 251*0Sstevel@tonic-gate 252*0Sstevel@tonic-gate /* 253*0Sstevel@tonic-gate * Structure of a variable node. All variables are 254*0Sstevel@tonic-gate * kept on a singly-linked list of these, rooted by 255*0Sstevel@tonic-gate * "variables" 256*0Sstevel@tonic-gate */ 257*0Sstevel@tonic-gate 258*0Sstevel@tonic-gate struct var { 259*0Sstevel@tonic-gate struct var *v_link; /* Forward link to next variable */ 260*0Sstevel@tonic-gate char *v_name; /* The variable's name */ 261*0Sstevel@tonic-gate char *v_value; /* And it's current value */ 262*0Sstevel@tonic-gate }; 263*0Sstevel@tonic-gate 264*0Sstevel@tonic-gate struct mgroup { 265*0Sstevel@tonic-gate struct mgroup *ge_link; /* Next person in this group */ 266*0Sstevel@tonic-gate char *ge_name; /* This person's user name */ 267*0Sstevel@tonic-gate }; 268*0Sstevel@tonic-gate 269*0Sstevel@tonic-gate struct grouphead { 270*0Sstevel@tonic-gate struct grouphead *g_link; /* Next grouphead in list */ 271*0Sstevel@tonic-gate char *g_name; /* Name of this group */ 272*0Sstevel@tonic-gate struct mgroup *g_list; /* Users in group. */ 273*0Sstevel@tonic-gate }; 274*0Sstevel@tonic-gate 275*0Sstevel@tonic-gate #define NIL ((struct name *) 0) /* The nil pointer for namelists */ 276*0Sstevel@tonic-gate #define NONE ((struct cmd *) 0) /* The nil pointer to command tab */ 277*0Sstevel@tonic-gate #define NOVAR ((struct var *) 0) /* The nil pointer to variables */ 278*0Sstevel@tonic-gate #define NOGRP ((struct grouphead *) 0)/* The nil grouphead pointer */ 279*0Sstevel@tonic-gate #define NOGE ((struct mgroup *) 0) /* The nil group pointer */ 280*0Sstevel@tonic-gate #define NOFP ((struct fplst *) 0) /* The nil file pointer */ 281*0Sstevel@tonic-gate 282*0Sstevel@tonic-gate #define TRUE 1 283*0Sstevel@tonic-gate #define FALSE 0 284*0Sstevel@tonic-gate 285*0Sstevel@tonic-gate #define DEADPERM 0600 /* permissions of dead.letter */ 286*0Sstevel@tonic-gate #define TEMPPERM 0600 /* permissions of temp files */ 287*0Sstevel@tonic-gate #define MBOXPERM 0600 /* permissions of ~/mbox */ 288*0Sstevel@tonic-gate 289*0Sstevel@tonic-gate #ifndef MFMODE 290*0Sstevel@tonic-gate # define MFMODE 0600 /* create mode for `/var/mail' files */ 291*0Sstevel@tonic-gate #endif 292*0Sstevel@tonic-gate 293*0Sstevel@tonic-gate /* 294*0Sstevel@tonic-gate * Structure of the hash table of ignored header fields 295*0Sstevel@tonic-gate */ 296*0Sstevel@tonic-gate struct ignore { 297*0Sstevel@tonic-gate struct ignore *i_link; /* Next ignored field in bucket */ 298*0Sstevel@tonic-gate char *i_field; /* This ignored field */ 299*0Sstevel@tonic-gate }; 300*0Sstevel@tonic-gate 301*0Sstevel@tonic-gate #ifdef preSVr4 302*0Sstevel@tonic-gate struct utimbuf { 303*0Sstevel@tonic-gate time_t actime; 304*0Sstevel@tonic-gate time_t modtime; 305*0Sstevel@tonic-gate }; 306*0Sstevel@tonic-gate #else 307*0Sstevel@tonic-gate # include <utime.h> 308*0Sstevel@tonic-gate #endif 309*0Sstevel@tonic-gate 310*0Sstevel@tonic-gate /* 311*0Sstevel@tonic-gate * Token values returned by the scanner used for argument lists. 312*0Sstevel@tonic-gate * Also, sizes of scanner-related things. 313*0Sstevel@tonic-gate */ 314*0Sstevel@tonic-gate 315*0Sstevel@tonic-gate #define TEOL 0 /* End of the command line */ 316*0Sstevel@tonic-gate #define TNUMBER 1 /* A message number */ 317*0Sstevel@tonic-gate #define TDASH 2 /* A simple dash */ 318*0Sstevel@tonic-gate #define TSTRING 3 /* A string (possibly containing -) */ 319*0Sstevel@tonic-gate #define TDOT 4 /* A "." */ 320*0Sstevel@tonic-gate #define TUP 5 /* An "^" */ 321*0Sstevel@tonic-gate #define TDOLLAR 6 /* A "$" */ 322*0Sstevel@tonic-gate #define TSTAR 7 /* A "*" */ 323*0Sstevel@tonic-gate #define TOPEN 8 /* An '(' */ 324*0Sstevel@tonic-gate #define TCLOSE 9 /* A ')' */ 325*0Sstevel@tonic-gate #define TPLUS 10 /* A '+' */ 326*0Sstevel@tonic-gate 327*0Sstevel@tonic-gate #define REGDEP 2 /* Maximum regret depth. */ 328*0Sstevel@tonic-gate #define STRINGLEN 1024 /* Maximum length of string token */ 329*0Sstevel@tonic-gate 330*0Sstevel@tonic-gate /* 331*0Sstevel@tonic-gate * Constants for conditional commands. These describe whether 332*0Sstevel@tonic-gate * we should be executing stuff or not. 333*0Sstevel@tonic-gate */ 334*0Sstevel@tonic-gate 335*0Sstevel@tonic-gate #define CANY 0 /* Execute in send or receive mode */ 336*0Sstevel@tonic-gate #define CRCV 1 /* Execute in receive mode only */ 337*0Sstevel@tonic-gate #define CSEND 2 /* Execute in send mode only */ 338*0Sstevel@tonic-gate #define CTTY 3 /* Execute if attached to a tty only */ 339*0Sstevel@tonic-gate #define CNOTTY 4 /* Execute if not attached to a tty */ 340*0Sstevel@tonic-gate 341*0Sstevel@tonic-gate /* 342*0Sstevel@tonic-gate * Flags for msend(). 343*0Sstevel@tonic-gate */ 344*0Sstevel@tonic-gate 345*0Sstevel@tonic-gate #define M_IGNORE 1 /* Do "ignore/retain" processing */ 346*0Sstevel@tonic-gate #define M_SAVING 2 /* Saving to a file/folder */ 347*0Sstevel@tonic-gate 348*0Sstevel@tonic-gate /* 349*0Sstevel@tonic-gate * VM/UNIX has a vfork system call which is faster than forking. If we 350*0Sstevel@tonic-gate * don't have it, fork(2) will do . . . 351*0Sstevel@tonic-gate */ 352*0Sstevel@tonic-gate 353*0Sstevel@tonic-gate #if !defined(VMUNIX) && defined(preSVr4) 354*0Sstevel@tonic-gate #define vfork() fork() 355*0Sstevel@tonic-gate #endif 356*0Sstevel@tonic-gate #ifndef SIGRETRO 357*0Sstevel@tonic-gate #define sigchild() 358*0Sstevel@tonic-gate #endif 359*0Sstevel@tonic-gate 360*0Sstevel@tonic-gate 361*0Sstevel@tonic-gate /* 362*0Sstevel@tonic-gate * 4.2bsd signal interface help... 363*0Sstevel@tonic-gate */ 364*0Sstevel@tonic-gate #ifdef VMUNIX 365*0Sstevel@tonic-gate #define sigset(s, a) signal(s, a) 366*0Sstevel@tonic-gate #define sigsys(s, a) signal(s, a) 367*0Sstevel@tonic-gate #else 368*0Sstevel@tonic-gate #ifndef preSVr4 369*0Sstevel@tonic-gate /* SVr4 version of sigset() in fio.c */ 370*0Sstevel@tonic-gate #define sigsys(s, a) signal(s, a) 371*0Sstevel@tonic-gate #define setjmp(x) sigsetjmp((x), 1) 372*0Sstevel@tonic-gate #define longjmp siglongjmp 373*0Sstevel@tonic-gate #define jmp_buf sigjmp_buf 374*0Sstevel@tonic-gate #else 375*0Sstevel@tonic-gate #define OLD_BSD_SIGS 376*0Sstevel@tonic-gate #endif 377*0Sstevel@tonic-gate #endif 378*0Sstevel@tonic-gate 379*0Sstevel@tonic-gate /* 380*0Sstevel@tonic-gate * Truncate a file to the last character written. This is 381*0Sstevel@tonic-gate * useful just before closing an old file that was opened 382*0Sstevel@tonic-gate * for read/write. 383*0Sstevel@tonic-gate */ 384*0Sstevel@tonic-gate #define trunc(stream) ftruncate(fileno(stream), (long) ftell(stream)) 385*0Sstevel@tonic-gate 386*0Sstevel@tonic-gate /* 387*0Sstevel@tonic-gate * The pointers for the string allocation routines, 388*0Sstevel@tonic-gate * there are NSPACE independent areas. 389*0Sstevel@tonic-gate * The first holds STRINGSIZE bytes, the next 390*0Sstevel@tonic-gate * twice as much, and so on. 391*0Sstevel@tonic-gate */ 392*0Sstevel@tonic-gate 393*0Sstevel@tonic-gate #define NSPACE 25 /* Total number of string spaces */ 394*0Sstevel@tonic-gate struct strings { 395*0Sstevel@tonic-gate char *s_topFree; /* Beginning of this area */ 396*0Sstevel@tonic-gate char *s_nextFree; /* Next alloctable place here */ 397*0Sstevel@tonic-gate unsigned s_nleft; /* Number of bytes left here */ 398*0Sstevel@tonic-gate }; 399*0Sstevel@tonic-gate 400*0Sstevel@tonic-gate /* The following typedefs must be used in SVR4 */ 401*0Sstevel@tonic-gate #ifdef preSVr4 402*0Sstevel@tonic-gate #ifndef sun 403*0Sstevel@tonic-gate typedef int gid_t; 404*0Sstevel@tonic-gate typedef int uid_t; 405*0Sstevel@tonic-gate typedef int mode_t; 406*0Sstevel@tonic-gate typedef int pid_t; 407*0Sstevel@tonic-gate #endif 408*0Sstevel@tonic-gate #endif 409*0Sstevel@tonic-gate 410*0Sstevel@tonic-gate #define STSIZ 40 411*0Sstevel@tonic-gate #define TMPSIZ 14 412*0Sstevel@tonic-gate /* 413*0Sstevel@tonic-gate * Forward declarations of routine types to keep lint and cc happy. 414*0Sstevel@tonic-gate */ 415*0Sstevel@tonic-gate 416*0Sstevel@tonic-gate extern int Copy(int *msgvec); 417*0Sstevel@tonic-gate extern FILE *Fdopen(int fildes, char *mode); 418*0Sstevel@tonic-gate extern int Followup(int *msgvec); 419*0Sstevel@tonic-gate extern char *Getf(register char *s); 420*0Sstevel@tonic-gate extern int More(int *msgvec); 421*0Sstevel@tonic-gate extern int Respond(int *msgvec); 422*0Sstevel@tonic-gate extern int Save(int *msgvec); 423*0Sstevel@tonic-gate extern int Sendm(char *str); 424*0Sstevel@tonic-gate extern int Sput(char str[]); 425*0Sstevel@tonic-gate extern int Type(int *msgvec); 426*0Sstevel@tonic-gate extern void Verhogen(void); 427*0Sstevel@tonic-gate extern char *addone(char hf[], char news[]); 428*0Sstevel@tonic-gate extern char *addto(char hf[], char news[]); 429*0Sstevel@tonic-gate extern void alter(char name[]); 430*0Sstevel@tonic-gate extern int alternates(char **namelist); 431*0Sstevel@tonic-gate extern void announce(void); 432*0Sstevel@tonic-gate extern int any(int ch, char *str); 433*0Sstevel@tonic-gate extern int anyof(register char *s1, register char *s2); 434*0Sstevel@tonic-gate extern int argcount(char **argv); 435*0Sstevel@tonic-gate extern void assign(char name[], char value[]); 436*0Sstevel@tonic-gate extern int blankline(const char linebuf[]); 437*0Sstevel@tonic-gate extern struct name *cat(struct name *n1, struct name *n2); 438*0Sstevel@tonic-gate extern FILE *collect(struct header *hp); 439*0Sstevel@tonic-gate extern void commands(void); 440*0Sstevel@tonic-gate extern char *copy(char *str1, char *str2); 441*0Sstevel@tonic-gate extern int copycmd(char str[]); 442*0Sstevel@tonic-gate extern int deassign(register char *s); 443*0Sstevel@tonic-gate extern int delm(int *msgvec); 444*0Sstevel@tonic-gate extern struct name *delname(register struct name *np, char name[]); 445*0Sstevel@tonic-gate extern int deltype(int msgvec[]); 446*0Sstevel@tonic-gate extern char *detract(register struct name *np, int ntype); 447*0Sstevel@tonic-gate extern int docomma(char *s); 448*0Sstevel@tonic-gate extern int dopipe(char str[]); 449*0Sstevel@tonic-gate extern int dosh(char *str); 450*0Sstevel@tonic-gate extern int echo(register char **argv); 451*0Sstevel@tonic-gate extern int editor(int *msgvec); 452*0Sstevel@tonic-gate extern int edstop(int noremove); 453*0Sstevel@tonic-gate extern struct name *elide(struct name *names); 454*0Sstevel@tonic-gate extern int elsecmd(void); 455*0Sstevel@tonic-gate extern int endifcmd(void); 456*0Sstevel@tonic-gate extern int execute(char linebuf[], int contxt); 457*0Sstevel@tonic-gate extern char *expand(char *name); 458*0Sstevel@tonic-gate extern struct name *extract(char line[], int arg_ntype); 459*0Sstevel@tonic-gate extern int fferror(FILE *iob); 460*0Sstevel@tonic-gate extern int field(char str[]); 461*0Sstevel@tonic-gate extern int file(char **argv); 462*0Sstevel@tonic-gate extern struct grouphead *findgroup(char name[]); 463*0Sstevel@tonic-gate extern void findmail(char *name); 464*0Sstevel@tonic-gate extern int first(int f, int m); 465*0Sstevel@tonic-gate extern void flush(void); 466*0Sstevel@tonic-gate extern int folders(char **arglist); 467*0Sstevel@tonic-gate extern int followup(int *msgvec); 468*0Sstevel@tonic-gate extern int from(int *msgvec); 469*0Sstevel@tonic-gate extern off_t fsize(FILE *iob); 470*0Sstevel@tonic-gate extern int getfold(char *name); 471*0Sstevel@tonic-gate extern int gethfield(register FILE *f, char linebuf[], register long rem); 472*0Sstevel@tonic-gate extern int getline(char *line, int size, FILE *f, int *hasnulls); 473*0Sstevel@tonic-gate extern int getmsglist(char *buf, int *vector, int flags); 474*0Sstevel@tonic-gate extern int getname(uid_t uid, char namebuf[]); 475*0Sstevel@tonic-gate extern int getrawlist(char line[], char **argv, int argc); 476*0Sstevel@tonic-gate extern void getrecf(char *buf, char *recfile, int useauthor, int sz_recfile); 477*0Sstevel@tonic-gate extern uid_t getuserid(char name[]); 478*0Sstevel@tonic-gate extern int grabh(register struct header *hp, int gflags, int subjtop); 479*0Sstevel@tonic-gate extern int group(char **argv); 480*0Sstevel@tonic-gate extern void hangup(int); 481*0Sstevel@tonic-gate extern int hash(char name[]); 482*0Sstevel@tonic-gate extern char *hcontents(char hfield[]); 483*0Sstevel@tonic-gate extern int headerp(register char *line); 484*0Sstevel@tonic-gate extern int headers(int *msgvec); 485*0Sstevel@tonic-gate extern int help(void); 486*0Sstevel@tonic-gate extern char *helppath(char *file); 487*0Sstevel@tonic-gate extern char *hfield(char field[], struct message *mp, char *(*add)(char *, char *)); 488*0Sstevel@tonic-gate extern void holdsigs(void); 489*0Sstevel@tonic-gate extern int icequal(register char *s1, register char *s2); 490*0Sstevel@tonic-gate extern int ifcmd(char **argv); 491*0Sstevel@tonic-gate extern int igfield(char *list[]); 492*0Sstevel@tonic-gate extern int inc(void); 493*0Sstevel@tonic-gate extern void inithost(void); 494*0Sstevel@tonic-gate extern int isdir(char name[]); 495*0Sstevel@tonic-gate extern int ishead(char linebuf[]); 496*0Sstevel@tonic-gate extern int ishfield(char linebuf[], char field[]); 497*0Sstevel@tonic-gate extern int ishost(char *sys, char *rest); 498*0Sstevel@tonic-gate extern int isign(char *field, int saving); 499*0Sstevel@tonic-gate extern void istrcpy(char *dest, int dstsize, char *src); 500*0Sstevel@tonic-gate extern void lcwrite(char *fn, FILE *fi, FILE *fo, int addnl); 501*0Sstevel@tonic-gate extern void load(char *name); 502*0Sstevel@tonic-gate extern int loadmsg(char str[]); 503*0Sstevel@tonic-gate extern int lock(FILE *fp, char *mode, int blk); 504*0Sstevel@tonic-gate extern void lockmail(void); 505*0Sstevel@tonic-gate extern int mail(char **people); 506*0Sstevel@tonic-gate extern void mail1(struct header *hp, int use_to, char *orig_to); 507*0Sstevel@tonic-gate extern void mapf(register struct name *np, char *from); 508*0Sstevel@tonic-gate extern int mboxit(int msgvec[]); 509*0Sstevel@tonic-gate extern void mechk(struct name *names); 510*0Sstevel@tonic-gate extern int member(register char *realfield, register struct ignore **table); 511*0Sstevel@tonic-gate extern int messize(int *msgvec); 512*0Sstevel@tonic-gate extern void minit(void); 513*0Sstevel@tonic-gate extern int more(int *msgvec); 514*0Sstevel@tonic-gate extern long msend(struct message *mailp, FILE *obuf, int flag, int (*fp)(const char *, FILE *)); 515*0Sstevel@tonic-gate extern int my_fclose(register FILE *iop); 516*0Sstevel@tonic-gate extern FILE *my_fopen(char *file, char *mode); 517*0Sstevel@tonic-gate extern char *nameof(register struct message *mp); 518*0Sstevel@tonic-gate extern char *netmap(char name[], char from[]); 519*0Sstevel@tonic-gate extern int newfileinfo(int start); 520*0Sstevel@tonic-gate extern int next(int *msgvec); 521*0Sstevel@tonic-gate extern int npclose(FILE *ptr); 522*0Sstevel@tonic-gate extern FILE *npopen(char *cmd, char *mode); 523*0Sstevel@tonic-gate extern char *nstrcpy(char *dst, int dstsize, char *src); 524*0Sstevel@tonic-gate extern char *nstrcat(char *dst, int dstsize, char *src); 525*0Sstevel@tonic-gate extern int null(char *e); 526*0Sstevel@tonic-gate extern int outof(struct name *names, FILE *fo); 527*0Sstevel@tonic-gate extern struct name *outpre(struct name *to); 528*0Sstevel@tonic-gate extern void panic(char *str); 529*0Sstevel@tonic-gate extern void parse(char line[], struct headline *hl, char pbuf[]); 530*0Sstevel@tonic-gate extern int pcmdlist(void); 531*0Sstevel@tonic-gate extern int pdot(void); 532*0Sstevel@tonic-gate extern int preserve(int *msgvec); 533*0Sstevel@tonic-gate extern void printgroup(char name[]); 534*0Sstevel@tonic-gate extern void printhead(int mesg); 535*0Sstevel@tonic-gate extern int puthead(struct header *hp, FILE *fo, int w, long clen); 536*0Sstevel@tonic-gate extern int pversion(char *e); 537*0Sstevel@tonic-gate extern void quit(int noremove); 538*0Sstevel@tonic-gate extern int readline(FILE *ibuf, char *linebuf); 539*0Sstevel@tonic-gate extern void receipt(struct message *mp); 540*0Sstevel@tonic-gate extern void relsesigs(void); 541*0Sstevel@tonic-gate extern int removefile(char name[]); 542*0Sstevel@tonic-gate extern int replyall(int *msgvec); 543*0Sstevel@tonic-gate extern int replysender(int *msgvec); 544*0Sstevel@tonic-gate extern int respond(int *msgvec); 545*0Sstevel@tonic-gate extern int retfield(char *list[]); 546*0Sstevel@tonic-gate extern int rexit(int e); 547*0Sstevel@tonic-gate extern char *safeexpand(char name[]); 548*0Sstevel@tonic-gate extern void *salloc(unsigned size); 549*0Sstevel@tonic-gate extern void *srealloc(void *optr, unsigned size); 550*0Sstevel@tonic-gate extern int samebody(register char *user, register char *addr, 551*0Sstevel@tonic-gate int fuzzy); 552*0Sstevel@tonic-gate extern int save(char str[]); 553*0Sstevel@tonic-gate extern void savedead(int s); 554*0Sstevel@tonic-gate extern char *savestr(char *str); 555*0Sstevel@tonic-gate extern int schdir(char *str); 556*0Sstevel@tonic-gate extern int screensize(void); 557*0Sstevel@tonic-gate extern int scroll(char arg[]); 558*0Sstevel@tonic-gate extern int sendm(char *str); 559*0Sstevel@tonic-gate extern int set(char **arglist); 560*0Sstevel@tonic-gate extern void setclen(register struct message *mp); 561*0Sstevel@tonic-gate extern int setfile(char *name, int isedit); 562*0Sstevel@tonic-gate extern FILE *setinput(register struct message *mp); 563*0Sstevel@tonic-gate extern void setptr(register FILE *ibuf); 564*0Sstevel@tonic-gate extern int shell(char *str); 565*0Sstevel@tonic-gate #ifndef sigchild 566*0Sstevel@tonic-gate extern void sigchild(void); 567*0Sstevel@tonic-gate #endif 568*0Sstevel@tonic-gate #ifndef sigset 569*0Sstevel@tonic-gate extern void (*sigset())(); 570*0Sstevel@tonic-gate #endif 571*0Sstevel@tonic-gate extern char *skin(char *name); 572*0Sstevel@tonic-gate extern char *snarf(char linebuf[], int *flag, int erf); 573*0Sstevel@tonic-gate extern int source(char name[]); 574*0Sstevel@tonic-gate extern char *splice(char *addr, char *hdr); 575*0Sstevel@tonic-gate extern int sput(char str[]); 576*0Sstevel@tonic-gate extern void sreset(void); 577*0Sstevel@tonic-gate extern void stop(int s); 578*0Sstevel@tonic-gate extern int stouch(int msgvec[]); 579*0Sstevel@tonic-gate extern int substr(char *string1, char *string2); 580*0Sstevel@tonic-gate extern int swrite(char str[]); 581*0Sstevel@tonic-gate extern struct name *tailof(struct name *name); 582*0Sstevel@tonic-gate extern void tinit(void); 583*0Sstevel@tonic-gate extern int tmail(void); 584*0Sstevel@tonic-gate extern int top(int *msgvec); 585*0Sstevel@tonic-gate extern void touch(int mesg); 586*0Sstevel@tonic-gate extern struct name *translate(struct name *np); 587*0Sstevel@tonic-gate extern int type(int *msgvec); 588*0Sstevel@tonic-gate extern int undelete(int *msgvec); 589*0Sstevel@tonic-gate extern int ungroup(char **argv); 590*0Sstevel@tonic-gate extern int unigfield(char *list[]); 591*0Sstevel@tonic-gate extern void unlockmail(void); 592*0Sstevel@tonic-gate extern char **unpack(struct name *np); 593*0Sstevel@tonic-gate extern int unread(int msgvec[]); 594*0Sstevel@tonic-gate extern int unretfield(char *list[]); 595*0Sstevel@tonic-gate extern int unset(char **arglist); 596*0Sstevel@tonic-gate extern int unstack(void); 597*0Sstevel@tonic-gate extern char *unuucp(char *name); 598*0Sstevel@tonic-gate extern struct name *usermap(struct name *names); 599*0Sstevel@tonic-gate extern char *value(char name[]); 600*0Sstevel@tonic-gate extern char *vcopy(char str[]); 601*0Sstevel@tonic-gate extern void vfree(register char *cp); 602*0Sstevel@tonic-gate extern int visual(int *msgvec); 603*0Sstevel@tonic-gate extern char *yankword(char *name, char *word, int sz, int comma); 604*0Sstevel@tonic-gate 605*0Sstevel@tonic-gate /* 606*0Sstevel@tonic-gate * These functions are defined in libmail.a 607*0Sstevel@tonic-gate */ 608*0Sstevel@tonic-gate #ifdef __cplusplus 609*0Sstevel@tonic-gate extern "C" { 610*0Sstevel@tonic-gate #endif 611*0Sstevel@tonic-gate extern int delempty(mode_t, char *); 612*0Sstevel@tonic-gate extern char *maildomain(void); 613*0Sstevel@tonic-gate extern void touchlock(void); 614*0Sstevel@tonic-gate extern char *xgetenv(char *); 615*0Sstevel@tonic-gate extern int xsetenv(char *); 616*0Sstevel@tonic-gate #ifdef __cplusplus 617*0Sstevel@tonic-gate } 618*0Sstevel@tonic-gate #endif 619*0Sstevel@tonic-gate 620*0Sstevel@tonic-gate /* 621*0Sstevel@tonic-gate * Standard functions from the C library. 622*0Sstevel@tonic-gate * These are all defined in <stdlib.h> and <wait.h> in SVr4. 623*0Sstevel@tonic-gate */ 624*0Sstevel@tonic-gate #ifdef preSVr4 625*0Sstevel@tonic-gate extern long atol(); 626*0Sstevel@tonic-gate extern char *getcwd(); 627*0Sstevel@tonic-gate extern char *calloc(); 628*0Sstevel@tonic-gate extern char *getenv(); 629*0Sstevel@tonic-gate extern void exit(); 630*0Sstevel@tonic-gate extern void free(); 631*0Sstevel@tonic-gate extern char *malloc(); 632*0Sstevel@tonic-gate extern time_t time(); 633*0Sstevel@tonic-gate extern long ulimit(); 634*0Sstevel@tonic-gate extern int utime(); 635*0Sstevel@tonic-gate extern int wait(); 636*0Sstevel@tonic-gate extern int fputs(); 637*0Sstevel@tonic-gate #endif 638*0Sstevel@tonic-gate 639*0Sstevel@tonic-gate #ifdef __cplusplus 640*0Sstevel@tonic-gate } 641*0Sstevel@tonic-gate #endif 642*0Sstevel@tonic-gate 643*0Sstevel@tonic-gate #endif /* _MAILX_DEF_H */ 644