1 /* 2 * Copyright (c) 1980 Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)temp.c 5.15 (Berkeley) 02/03/91"; 10 #endif /* not lint */ 11 12 #include "rcv.h" 13 14 /* 15 * Mail -- a mail program 16 * 17 * Give names to all the temporary files that we will need. 18 */ 19 20 char tempMail[24]; 21 char tempQuit[24]; 22 char tempEdit[24]; 23 char tempResid[24]; 24 char tempMesg[24]; 25 26 tinit() 27 { 28 register char *cp; 29 30 strcpy(tempMail, _PATH_TMP); 31 mktemp(strcat(tempMail, "RsXXXXXX")); 32 strcpy(tempResid, _PATH_TMP); 33 mktemp(strcat(tempResid, "RqXXXXXX")); 34 strcpy(tempQuit, _PATH_TMP); 35 mktemp(strcat(tempQuit, "RmXXXXXX")); 36 strcpy(tempEdit, _PATH_TMP); 37 mktemp(strcat(tempEdit, "ReXXXXXX")); 38 strcpy(tempMesg, _PATH_TMP); 39 mktemp(strcat(tempMesg, "RxXXXXXX")); 40 41 /* 42 * It's okay to call savestr in here because main will 43 * do a spreserve() after us. 44 */ 45 if (myname != NOSTR) { 46 if (getuserid(myname) < 0) { 47 printf("\"%s\" is not a user of this system\n", 48 myname); 49 exit(1); 50 } 51 } else { 52 if ((cp = username()) == NOSTR) { 53 myname = "ubluit"; 54 if (rcvmode) { 55 printf("Who are you!?\n"); 56 exit(1); 57 } 58 } else 59 myname = savestr(cp); 60 } 61 if ((cp = getenv("HOME")) == NOSTR) 62 cp = "."; 63 homedir = savestr(cp); 64 if (debug) 65 printf("user = %s, homedir = %s\n", myname, homedir); 66 } 67