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 6*34905Sbostic * provided that the above copyright notice and this paragraph are 7*34905Sbostic * duplicated in all such forms and that any documentation, 8*34905Sbostic * advertising materials, and other materials related to such 9*34905Sbostic * distribution and use acknowledge that the software was developed 10*34905Sbostic * by the University of California, Berkeley. The name of the 11*34905Sbostic * University may not be used to endorse or promote products derived 12*34905Sbostic * from this software without specific prior written permission. 13*34905Sbostic * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 14*34905Sbostic * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 15*34905Sbostic * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 1622468Sdist */ 1722468Sdist 18*34905Sbostic #ifndef lint 19*34905Sbostic static char sccsid[] = "@(#)temp.c 5.7 (Berkeley) 06/29/88"; 20*34905Sbostic #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]; 4131142Sedward uid_t getuid(); 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 } 571246Skas } 581246Skas else { 5931142Sedward uid = getuid(); 601246Skas if (username(uid, uname) < 0) { 6131142Sedward strcpy(myname, "ubluit"); 621246Skas if (rcvmode) { 631246Skas printf("Who are you!?\n"); 641246Skas exit(1); 651246Skas } 6631142Sedward } else 6731142Sedward strcpy(myname, uname); 681246Skas } 6931142Sedward if ((cp = value("HOME")) == NOSTR) 701246Skas cp = "."; 7131142Sedward strcpy(homedir, cp); 7231142Sedward strcpy(copy(homedir, mailrc), "/.mailrc"); 7331142Sedward strcpy(copy(homedir, deadletter), "/dead.letter"); 741246Skas if (debug) { 7534753Sedward printf("uid = %d, user = %s\n", uid, myname); 7634753Sedward printf("deadletter = %s, mailrc = %s\n", deadletter, mailrc); 771246Skas } 781246Skas } 79