init.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright 2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* All global externs defined in mail.h. All variables are initialized
* here!
*
* !!!!!IF YOU CHANGE (OR ADD) IT HERE, DO IT THERE ALSO !!!!!!!!
*
*/
#include "mail.h"
int ac; /* argument list count */
char **av; /* argument list */
int affbytecnt; /* Total bytes of Auto-Fwd. info in msg. */
int affcnt; /* Number of Auto-Fwd.-From: lines in msg. */
int Daffbytecnt; /* Hold affbytecnt when sending Delivery Notification */
int Daffcnt; /* Hold affcnt when sending Delivery Notification */
char binmsg[] = "*** Message content is not printable: delete, write or save it to a file ***";
int changed; /* > 0 says mailfile has changed */
char dbgfname[20];
int debug; /* Controls debugging level. 0 ==> no debugging */
int delflg = 1;
int dflag = 0; /* 1 says returning unsendable mail */
char *errlist[]= {
"",
"Unknown system",
"Problem with mailfile",
"Space problem",
"Unable to forward mail, check permissions and group",
"Syntax error",
"Forwarding loop",
"Invalid sender",
"Invalid recipient",
"Too many From lines",
"Invalid permissions",
"Cannot open mbox",
"Temporary file problem",
"Cannot create dead.letter",
"Unbounded forwarding",
"Cannot create lock file",
"No group id of 'mail'",
"Problem allocating memory",
"Could not fork",
"Cannot pipe",
"Must be owner to modify mailfile",
"Surrogate command failed"
};
int error = 0; /* Local value for error */
char *failsafe; /* $FAILSAFE */
int file_size;
int flge = 0; /* 1 ==> 'e' option specified */
int flgE = 0; /* 1 ==> 'E' option specified */
int flgF = 0; /* 1 ==> Installing/Removing Forwarding */
int flgf = 0; /* 1 ==> 'f' option specified */
int flgh = 0; /* 1 ==> 'h' option specified */
int flgm;
int flgp = 0; /* 1 ==> 'p' option specified */
int flgP = 0; /* 1 ==> 'P' option specified */
int flgr = 0; /* 1 ==> 'r' option -- print in fifo order */
int flgt = 0; /* 1 ==> 't' option -- add To: line to letter */
int flgT = 0; /* 1 ==> 'T' option specified */
int flgw = 0; /* 1 ==> 'w' option specified */
int fnuhdrtype = 0; /* type of first non-UNIX header line */
char forwmsg[] = " forwarded by %s\n";
char frwlmsg[] = " %s: Forwarding loop detected in %s's mailfile.\n";
char fwdFrom[1024];
int goerr = 0; /* counts parsing errors */
/* Default_display indicates whether to display this header line to the TTY */
/* when in default mode. Can be overridden via 'P' command at ? prompt */
"", FALSE,
"Auto-Forward-Count:", FALSE,
"Auto-Forwarded-From:", FALSE,
"Content-Length:", TRUE,
"Content-Type:", FALSE,
"Date:", TRUE,
"Default-Options:", FALSE,
"End-of-Header:", FALSE,
"From ", TRUE,
">From ", TRUE,
"From:", TRUE,
"MIME-Version:", FALSE,
"MTS-Message-ID:", FALSE,
"Message-Type:", FALSE,
"Message-Version:", FALSE,
"Message-Service:", TRUE,
"Received:", FALSE,
"Report-Version:", FALSE,
"Subject:", TRUE,
"To:", TRUE,
">To:", FALSE,
"Transport-Options:", FALSE,
"UA-Content-ID:", FALSE,
/*Dummy place holders for H_DAFWDFROM,*/
/*H_DTCOPY and H_RECEIVED. Should */
/* match above first...*/
"Hold-Auto-Forwarded-From:", FALSE,
"Hold->To:", FALSE,
"Hold-Received:", FALSE,
"Continue:", FALSE,
"Name-Value:", FALSE,
};
char *help[] = {
"?\t\tprint this help message\n",
"#\t\tdisplay message number #\n",
"-\t\tprint previous\n",
"+\t\tnext (no delete)\n",
"! cmd\t\texecute cmd\n",
"<CR>\t\tnext (no delete)\n",
"a\t\tposition at and read newly arrived mail\n",
"d [#]\t\tdelete message # (default current message)\n",
"dp\t\tdelete current message and print the next\n",
"dq\t\tdelete current message and exit\n",
"h a\t\tdisplay all headers\n",
"h d\t\tdisplay headers of letters scheduled for deletion\n",
"h [#]\t\tdisplay headers around # (default current message)\n",
"m user \tmail (and delete) current message to user\n",
"n\t\tnext (no delete)\n",
"p\t\tprint (override any warnings of binary content)\n",
"P\t\toverride default 'brief' mode and display ALL header lines\n",
"q, ^D\t\tquit\n",
"r [args]\treply to (and delete) current letter via mail [args]\n",
"s [files]\tsave (and delete) current message (default mbox)\n",
"u [#]\t\tundelete message # (default current message)\n",
"w [files]\tsave (and delete) current message without header\n",
"x\t\texit without changing mail\n",
"y [files]\tsave (and delete) current message (default mbox)\n",
0
};
char *hmdead; /* pointer to $HOME/dead.letter */
char *home; /* pointer to $HOME */
int interactive = 0; /* 1 says user is interactive */
* deliver directly to mailbox
*/
* when going into a mailbox
*/
int keepdbgfile;
char *lettmp; /* pointer to tmp filename */
char lfil[MAXFILENAME];
char *mailfile; /* pointer to mailfile */
int maxerr = 0; /* largest value of error */
char *msgtype;
int nlet = 0; /* current number of letters in mailfile */
int onlet = 0; /* number of letters in mailfile at startup*/
int optcnt = 0; /* Number of options specified */
int orig_aff = 0; /* orig. msg. contained H_AFWDFROM lines */
int orig_dbglvl; /* argument to -x invocation option */
int orig_rcv = 0; /* orig. msg. contained H_RECEIVED lines */
int orig_tcopy = 0; /* orig. msg. contained H_TCOPY lines */
int pflg = 0; /* binary message display override flag */
int Pflg = 0; /* Selective display flag; 1 ==> display all */
char *program; /* program name */
int rcvbytecnt; /* Total bytes of Received: info in msg. */
int Drcvbytecnt; /* Hold rcvbytecnt when sending Delivery Notification */
int replying = 0; /* 1 says we are replying to a letter */
char rmtmsg[] = " remote from %s\n";
char rtrnmsg[] = "***** UNDELIVERABLE MAIL sent to %s, being returned by %s *****\n";
int sav_errno;
void (*saveint)();
/* Any header line prefixes listed here WILL be displayed in default mode */
/* If it's not here, it won't be shown. Can be overridden via 'P' command */
/* at ? prompt */
char *seldisp[] = {
"Cc:",
"Bcc:",
"Paper-",
"Phone:",
"Message-",
"Original-",
"Confirming-",
"Delivered-",
"Deliverable-",
"Not-",
"En-Route-To:",
0
};
int sending; /* TRUE==>sending mail; FALSE==>printing mail */
char m_sendto[1024];
int surg_rc = 0; /* exit code of surrogate command */
int surr_len = 0;
char *thissys; /* Holds name of the system we are on */
char uval[1024];
int init()
{
}