Commit | Line | Data |
---|---|---|
761330fe DF |
1 | /* |
2 | * Copyright (c) 1980 Regents of the University of California. | |
ca67e7b4 C |
3 | * All rights reserved. |
4 | * | |
5 | * Redistribution and use in source and binary forms are permitted | |
6 | * provided that this notice is preserved and that due credit is given | |
7 | * to the University of California at Berkeley. The name of the University | |
8 | * may not be used to endorse or promote products derived from this | |
9 | * software without specific prior written permission. This software | |
10 | * is provided ``as is'' without express or implied warranty. | |
761330fe DF |
11 | */ |
12 | ||
ca67e7b4 C |
13 | #ifdef notdef |
14 | static char sccsid[] = "@(#)temp.c 5.4 (Berkeley) 2/18/88"; | |
15 | #endif /* notdef */ | |
ca3f0029 KS |
16 | |
17 | #include "rcv.h" | |
18 | ||
19 | /* | |
20 | * Mail -- a mail program | |
21 | * | |
22 | * Give names to all the temporary files that we will need. | |
23 | */ | |
24 | ||
ca3f0029 KS |
25 | char tempMail[14]; |
26 | char tempQuit[14]; | |
27 | char tempEdit[14]; | |
28 | char tempSet[14]; | |
29 | char tempResid[14]; | |
30 | char tempMesg[14]; | |
31 | ||
32 | tinit() | |
33 | { | |
ca67e7b4 | 34 | register char *cp; |
6d3a0f2f | 35 | char uname[PATHSIZE]; |
ca3f0029 | 36 | register int pid; |
ca67e7b4 | 37 | uid_t getuid(); |
ca3f0029 KS |
38 | |
39 | pid = getpid(); | |
40 | sprintf(tempMail, "/tmp/Rs%05d", pid); | |
41 | sprintf(tempResid, "/tmp/Rq%05d", pid); | |
42 | sprintf(tempQuit, "/tmp/Rm%05d", pid); | |
43 | sprintf(tempEdit, "/tmp/Re%05d", pid); | |
44 | sprintf(tempSet, "/tmp/Rx%05d", pid); | |
45 | sprintf(tempMesg, "/tmp/Rx%05d", pid); | |
46 | ||
47 | if (strlen(myname) != 0) { | |
48 | uid = getuserid(myname); | |
95bf992b KS |
49 | if (uid == -1) { |
50 | printf("\"%s\" is not a user of this system\n", | |
51 | myname); | |
52 | exit(1); | |
53 | } | |
ca3f0029 KS |
54 | } |
55 | else { | |
ca67e7b4 | 56 | uid = getuid(); |
ca3f0029 | 57 | if (username(uid, uname) < 0) { |
ca67e7b4 | 58 | strcpy(myname, "ubluit"); |
ca3f0029 KS |
59 | if (rcvmode) { |
60 | printf("Who are you!?\n"); | |
61 | exit(1); | |
62 | } | |
ca67e7b4 C |
63 | } else |
64 | strcpy(myname, uname); | |
ca3f0029 | 65 | } |
ca67e7b4 | 66 | if ((cp = value("HOME")) == NOSTR) |
ca3f0029 | 67 | cp = "."; |
ca67e7b4 | 68 | strcpy(homedir, cp); |
ca3f0029 | 69 | findmail(); |
ca67e7b4 C |
70 | strcpy(copy(homedir, mbox), "/mbox"); |
71 | strcpy(copy(homedir, mailrc), "/.mailrc"); | |
72 | strcpy(copy(homedir, deadletter), "/dead.letter"); | |
ca3f0029 KS |
73 | if (debug) { |
74 | printf("uid = %d, user = %s, mailname = %s\n", | |
75 | uid, myname, mailname); | |
76 | printf("deadletter = %s, mailrc = %s, mbox = %s\n", | |
77 | deadletter, mailrc, mbox); | |
78 | } | |
79 | } |