Commit | Line | Data |
---|---|---|
761330fe DF |
1 | /* |
2 | * Copyright (c) 1980 Regents of the University of California. | |
0c5f72fb KB |
3 | * All rights reserved. |
4 | * | |
5 | * Redistribution and use in source and binary forms are permitted | |
acfc7e9b KB |
6 | * provided that the above copyright notice and this paragraph are |
7 | * duplicated in all such forms and that any documentation, | |
8 | * advertising materials, and other materials related to such | |
9 | * distribution and use acknowledge that the software was developed | |
10 | * by the University of California, Berkeley. The name of the | |
11 | * University may not be used to endorse or promote products derived | |
12 | * from this software without specific prior written permission. | |
13 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR | |
14 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED | |
15 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. | |
761330fe DF |
16 | */ |
17 | ||
acfc7e9b | 18 | #ifndef lint |
f674e088 | 19 | static char sccsid[] = "@(#)temp.c 5.9 (Berkeley) %G%"; |
acfc7e9b | 20 | #endif /* not lint */ |
ca3f0029 KS |
21 | |
22 | #include "rcv.h" | |
23 | ||
24 | /* | |
25 | * Mail -- a mail program | |
26 | * | |
27 | * Give names to all the temporary files that we will need. | |
28 | */ | |
29 | ||
ca3f0029 KS |
30 | char tempMail[14]; |
31 | char tempQuit[14]; | |
32 | char tempEdit[14]; | |
33 | char tempSet[14]; | |
34 | char tempResid[14]; | |
35 | char tempMesg[14]; | |
36 | ||
37 | tinit() | |
38 | { | |
828615a1 | 39 | register char *cp; |
f674e088 | 40 | char buf[PATHSIZE]; |
ca3f0029 | 41 | |
5208cae4 EW |
42 | mktemp(strcpy(tempMail, "/tmp/RsXXXXXX")); |
43 | mktemp(strcpy(tempResid, "/tmp/RqXXXXXX")); | |
44 | mktemp(strcpy(tempQuit, "/tmp/RmXXXXXX")); | |
45 | mktemp(strcpy(tempEdit, "/tmp/ReXXXXXX")); | |
46 | mktemp(strcpy(tempSet, "/tmp/RxXXXXXX")); | |
47 | mktemp(strcpy(tempMesg, "/tmp/RxXXXXXX")); | |
ca3f0029 | 48 | |
f674e088 EW |
49 | /* |
50 | * It's okay to call savestr in here because main will | |
51 | * do a spreserve() after us. | |
52 | */ | |
53 | if (myname != NOSTR) { | |
54 | if (getuserid(myname) < 0) { | |
95bf992b KS |
55 | printf("\"%s\" is not a user of this system\n", |
56 | myname); | |
57 | exit(1); | |
58 | } | |
a073e085 | 59 | } else { |
f674e088 EW |
60 | if ((cp = username()) == NOSTR) { |
61 | myname = "ubluit"; | |
ca3f0029 KS |
62 | if (rcvmode) { |
63 | printf("Who are you!?\n"); | |
64 | exit(1); | |
65 | } | |
828615a1 | 66 | } else |
f674e088 | 67 | myname = savestr(cp); |
ca3f0029 | 68 | } |
828615a1 | 69 | if ((cp = value("HOME")) == NOSTR) |
ca3f0029 | 70 | cp = "."; |
f674e088 EW |
71 | homedir = savestr(cp); |
72 | sprintf(buf, "%s/.mailrc", homedir); | |
73 | mailrc = savestr(buf); | |
74 | sprintf(buf, "%s/dead.letter", homedir); | |
75 | deadletter = savestr(buf); | |
76 | if (debug) | |
77 | printf("user = %s, deadletter = %s, mailrc = %s\n", | |
78 | myname, deadletter, mailrc); | |
ca3f0029 | 79 | } |