added : to the stop character set
[unix-history] / usr / src / usr.bin / mail / temp.c
CommitLineData
ca3f0029
KS
1#
2
3#include "rcv.h"
4
5/*
6 * Mail -- a mail program
7 *
8 * Give names to all the temporary files that we will need.
9 */
10
95bf992b 11static char *SccsId = "@(#)temp.c 1.3 %G%";
ca3f0029
KS
12
13char tempMail[14];
14char tempQuit[14];
15char tempEdit[14];
16char tempSet[14];
17char tempResid[14];
18char tempMesg[14];
19
20tinit()
21{
22 register char *cp, *cp2;
6d3a0f2f 23 char uname[PATHSIZE];
ca3f0029
KS
24 register int err = 0;
25 register int pid;
26
27 pid = getpid();
28 sprintf(tempMail, "/tmp/Rs%05d", pid);
29 sprintf(tempResid, "/tmp/Rq%05d", pid);
30 sprintf(tempQuit, "/tmp/Rm%05d", pid);
31 sprintf(tempEdit, "/tmp/Re%05d", pid);
32 sprintf(tempSet, "/tmp/Rx%05d", pid);
33 sprintf(tempMesg, "/tmp/Rx%05d", pid);
34
35 if (strlen(myname) != 0) {
36 uid = getuserid(myname);
95bf992b
KS
37 if (uid == -1) {
38 printf("\"%s\" is not a user of this system\n",
39 myname);
40 exit(1);
41 }
ca3f0029
KS
42 }
43 else {
44 uid = getuid() & UIDMASK;
45 if (username(uid, uname) < 0) {
46 copy("ubluit", myname);
ca3f0029
KS
47 err++;
48 if (rcvmode) {
49 printf("Who are you!?\n");
50 exit(1);
51 }
52 }
95bf992b
KS
53 else
54 copy(uname, myname);
ca3f0029
KS
55 }
56 mailname = mailspace;
57 cp = value("HOME");
58 if (cp == NOSTR)
59 cp = ".";
60 copy(cp, homedir);
61 findmail();
62 cp = copy(homedir, mbox);
63 copy("/mbox", cp);
64 cp = copy(homedir, mailrc);
65 copy("/.mailrc", cp);
66 cp = copy(homedir, deadletter);
67 copy("/dead.letter", cp);
68 if (debug) {
69 printf("uid = %d, user = %s, mailname = %s\n",
70 uid, myname, mailname);
71 printf("deadletter = %s, mailrc = %s, mbox = %s\n",
72 deadletter, mailrc, mbox);
73 }
74}