122468Sdist /* 222468Sdist * Copyright (c) 1980 Regents of the University of California. 333499Sbostic * All rights reserved. 433499Sbostic * 533499Sbostic * Redistribution and use in source and binary forms are permitted 634905Sbostic * provided that the above copyright notice and this paragraph are 734905Sbostic * duplicated in all such forms and that any documentation, 834905Sbostic * advertising materials, and other materials related to such 934905Sbostic * distribution and use acknowledge that the software was developed 1034905Sbostic * by the University of California, Berkeley. The name of the 1134905Sbostic * University may not be used to endorse or promote products derived 1234905Sbostic * from this software without specific prior written permission. 1334905Sbostic * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 1434905Sbostic * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 1534905Sbostic * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 1622468Sdist */ 1722468Sdist 1834905Sbostic #ifndef lint 19*34962Sedward static char sccsid[] = "@(#)temp.c 5.8 (Berkeley) 07/06/88"; 2034905Sbostic #endif /* not lint */ 211246Skas 221246Skas #include "rcv.h" 231246Skas 241246Skas /* 251246Skas * Mail -- a mail program 261246Skas * 271246Skas * Give names to all the temporary files that we will need. 281246Skas */ 291246Skas 301246Skas char tempMail[14]; 311246Skas char tempQuit[14]; 321246Skas char tempEdit[14]; 331246Skas char tempSet[14]; 341246Skas char tempResid[14]; 351246Skas char tempMesg[14]; 361246Skas 371246Skas tinit() 381246Skas { 3931142Sedward register char *cp; 401488Skas char uname[PATHSIZE]; 41*34962Sedward int uid; 421246Skas 4334878Sedward mktemp(strcpy(tempMail, "/tmp/RsXXXXXX")); 4434878Sedward mktemp(strcpy(tempResid, "/tmp/RqXXXXXX")); 4534878Sedward mktemp(strcpy(tempQuit, "/tmp/RmXXXXXX")); 4634878Sedward mktemp(strcpy(tempEdit, "/tmp/ReXXXXXX")); 4734878Sedward mktemp(strcpy(tempSet, "/tmp/RxXXXXXX")); 4834878Sedward mktemp(strcpy(tempMesg, "/tmp/RxXXXXXX")); 491246Skas 501246Skas if (strlen(myname) != 0) { 511246Skas uid = getuserid(myname); 521725Skas if (uid == -1) { 531725Skas printf("\"%s\" is not a user of this system\n", 541725Skas myname); 551725Skas exit(1); 561725Skas } 57*34962Sedward } else { 5831142Sedward uid = getuid(); 591246Skas if (username(uid, uname) < 0) { 6031142Sedward strcpy(myname, "ubluit"); 611246Skas if (rcvmode) { 621246Skas printf("Who are you!?\n"); 631246Skas exit(1); 641246Skas } 6531142Sedward } else 6631142Sedward strcpy(myname, uname); 671246Skas } 6831142Sedward if ((cp = value("HOME")) == NOSTR) 691246Skas cp = "."; 7031142Sedward strcpy(homedir, cp); 7131142Sedward strcpy(copy(homedir, mailrc), "/.mailrc"); 7231142Sedward strcpy(copy(homedir, deadletter), "/dead.letter"); 731246Skas if (debug) { 7434753Sedward printf("uid = %d, user = %s\n", uid, myname); 7534753Sedward printf("deadletter = %s, mailrc = %s\n", deadletter, mailrc); 761246Skas } 771246Skas } 78