sendmail -> paths.h
[unix-history] / usr / src / usr.bin / mail / temp.c
CommitLineData
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
435e8dff 19static char sccsid[] = "@(#)temp.c 5.12 (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
435e8dff
KB
30char tempMail[24];
31char tempQuit[24];
32char tempEdit[24];
33char tempSet[24];
34char tempResid[24];
35char tempMesg[24];
ca3f0029
KS
36
37tinit()
38{
828615a1 39 register char *cp;
ca3f0029 40
435e8dff
KB
41 strcpy(tempMail, _PATH_TMP);
42 mktemp(strcat(tempMail, "/RsXXXXXX"));
43 strcpy(tempResid, _PATH_TMP);
44 mktemp(strcat(tempResid, "/RqXXXXXX"));
45 strcpy(tempQuit, _PATH_TMP);
46 mktemp(strcat(tempQuit, "/RmXXXXXX"));
47 strcpy(tempEdit, _PATH_TMP);
48 mktemp(strcat(tempEdit, "/ReXXXXXX"));
49 strcpy(tempSet, _PATH_TMP);
50 mktemp(strcat(tempSet, "/RxXXXXXX"));
51 strcpy(tempMesg, _PATH_TMP);
52 mktemp(strcat(tempMesg, "/RxXXXXXX"));
ca3f0029 53
f674e088
EW
54 /*
55 * It's okay to call savestr in here because main will
56 * do a spreserve() after us.
57 */
58 if (myname != NOSTR) {
59 if (getuserid(myname) < 0) {
95bf992b
KS
60 printf("\"%s\" is not a user of this system\n",
61 myname);
62 exit(1);
63 }
a073e085 64 } else {
f674e088
EW
65 if ((cp = username()) == NOSTR) {
66 myname = "ubluit";
ca3f0029
KS
67 if (rcvmode) {
68 printf("Who are you!?\n");
69 exit(1);
70 }
828615a1 71 } else
f674e088 72 myname = savestr(cp);
ca3f0029 73 }
e9d34eb2 74 if ((cp = getenv("HOME")) == NOSTR)
ca3f0029 75 cp = ".";
f674e088 76 homedir = savestr(cp);
f674e088 77 if (debug)
e9d34eb2 78 printf("user = %s, homedir = %s\n", myname, homedir);
ca3f0029 79}