|
|
1.1 root 1: #ident "@(#)init.c 1.4 'attmail mail(1) command'"
2: #ident "@(#)mailx:init.c 1.1"
3: /* Copyright (c) 1984 AT&T */
4: /* All Rights Reserved */
5:
6: /* THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T */
7: /* The copyright notice above does not evidence any */
8: /* actual or intended publication of such source code. */
9:
10: #ident "@(#)init.c 2.24 'attmail mail(1) command'"
11:
12: /*
13: * mailx -- a modified version of a University of California at Berkeley
14: * mail program
15: *
16: * A bunch of global variable declarations lie herein.
17: *
18: * All global externs are declared in def.h. All variables are initialized
19: * here!
20: *
21: * !!!!!IF YOU CHANGE (OR ADD) IT HERE, DO IT THERE ALSO !!!!!!!!
22: *
23: */
24:
25: #include "rcv.h"
26: #include <grp.h>
27: #include <pwd.h>
28: #include <utmp.h>
29:
30: struct hdr header[] = {
31: "", FALSE,
32: "Auto-Forward-Count:", FALSE,
33: "Auto-Forwarded-From:", FALSE,
34: "Content-Length:", TRUE,
35: "Content-Type:", FALSE,
36: "Date:", TRUE,
37: "Default-Options:", FALSE,
38: "End-of-Header:", FALSE,
39: "From ", TRUE,
40: ">From ", TRUE,
41: "From:", TRUE,
42: "MTS-Message-ID:", FALSE,
43: "Message-Type:", FALSE,
44: "Message-Version:", FALSE,
45: "Message-Service:", TRUE,
46: "Received:", FALSE,
47: "Report-Version:", FALSE,
48: "Status:", FALSE,
49: "Subject:", TRUE,
50: "To:", TRUE,
51: ">To:", FALSE,
52: "Transport-Options:", FALSE,
53: "UA-Content-ID:", FALSE,
54: /*Dummy place holders for H_DAFWDFROM,*/
55: /*H_DTCOPY and H_RECEIVED. Should */
56: /* match above first...*/
57: "Auto-Forwarded-From:", FALSE,
58: ">To:", FALSE,
59: "Received:", FALSE,
60: };
61:
62: char binmsg[] = "*** Message content is not printable: delete, write or save it to a file ***";
63:
64: NODE *fplist = NOFP;
65: NODE *curptr = NOFP;
66: gid_t myrgid;
67: gid_t myegid;
68: uid_t myruid;
69: uid_t myeuid;
70: int msgCount; /* Count of messages read in */
71: pid_t mypid; /* Current process id */
72: int rcvmode; /* True if receiving mail */
73: int sawcom; /* Set after first command */
74: int Fflag = 0; /* -F option (followup) */
75: int hflag; /* Sequence number for network -h */
76: int Hflag = 0; /* print headers and exit */
77: char *rflag; /* -r address for network */
78: char *Tflag; /* -T temp file for netnews */
79: int UnUUCP = 0; /* -U flag */
80: int exitflg = 0; /* -e for mail test */
81: int newsflg = 0; /* -I option for netnews */
82: char nosrc; /* Don't source /etc/mail/mailx.rc */
83: char noheader; /* Suprress initial header listing */
84: int selfsent; /* User sent self something */
85: int senderr; /* An error while checking */
86: int edit; /* Indicates editing a file */
87: int readonly; /* Will be unable to rewrite file */
88: int noreset; /* String resets suspended */
89: int sourcing; /* Currently reading variant file */
90: int loading; /* Loading user definitions */
91: int cond; /* Current state of conditional exc. */
92: FILE *itf; /* Input temp file buffer */
93: FILE *otf; /* Output temp file buffer */
94: FILE *pipef; /* Pipe file we have opened */
95: int image; /* File descriptor for image of msg */
96: FILE *input; /* Current command input file */
97: char *editfile; /* Name of file being edited */
98: char *sflag; /* Subject given from non tty */
99: int outtty; /* True if standard output a tty */
100: int intty; /* True if standard input a tty */
101: int baud; /* Output baud rate */
102: char homedir[PATHSIZE]; /* Name of home directory */
103: char mailname[PATHSIZE]; /* Name of system mailbox */
104: char origname[PATHSIZE]; /* Name of mailfile before expansion */
105: uid_t uid; /* The invoker's user id */
106: char myname[PATHSIZE]; /* My login id */
107: off_t mailsize; /* Size of system mailbox */
108: int lexnumber; /* Number of TNUMBER from scan() */
109: char lexstring[STRINGLEN]; /* String from TSTRING, scan() */
110: int regretp; /* Pointer to TOS of regret tokens */
111: int regretstack[REGDEP]; /* Stack of regretted tokens */
112: char *stringstack[REGDEP]; /* Stack of regretted strings */
113: int numberstack[REGDEP]; /* Stack of regretted numbers */
114: struct message *dot; /* Pointer to current message */
115: struct message *message; /* The actual message structure */
116: struct var *variables[HSHSIZE]; /* Pointer to active var list */
117: struct grouphead *groups[HSHSIZE];/* Pointer to active groups */
118: struct ignore *ignore[HSHSIZE];/* Pointer to ignored fields */
119: char **altnames; /* List of alternate names for user */
120: int debug; /* Debug flag set */
121: int rmail; /* Being called as rmail */
122: char *prompt = NOSTR; /* prompt string */
123: int space; /* Current maximum number of messages */
124: int maxfiles; /* Maximum number of open files */
125:
126: jmp_buf srbuf;
127: int ismail = TRUE; /* default to program=mail */
128:
129: #ifdef USR_SPOOL_MAIL
130: char maildir[] = "/usr/spool/mail/"; /* directory for mail files */
131: #else
132: # ifdef preSVr4
133: char maildir[] = "/usr/mail/"; /* directory for mail files */
134: # else
135: char maildir[] = "/var/mail/"; /* directory for mail files */
136: # endif
137: #endif
138:
139: char *progname; /* program name (argv[0]) */
140: int sending; /* TRUE==>sending mail; FALSE==>printing mail */
141: int askme;
142: char tempMail[14];
143: char tempQuit[14];
144: char tempEdit[14];
145: char tempSet[14];
146: char tempResid[PATHSIZE]; /* temp file in :saved || adb: put it back in /tmp */
147: char tempMesg[14];
148: char tempZedit[14];
149: static struct utimbuf utimeb;
150: struct utimbuf *utimep = &utimeb;
151:
152: /*
153: * The pointers for the string allocation routines,
154: * there are NSPACE independent areas.
155: * The first holds STRINGSIZE bytes, the next
156: * twice as much, and so on.
157: */
158:
159: struct strings stringdope[NSPACE];
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.