home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / metamail / tahoe / temp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-02-18  |  1.9 KB  |  80 lines

  1. /*
  2.  * Copyright (c) 1980 Regents of the University of California.
  3.  * All rights reserved.
  4.  *
  5.  * Redistribution and use in source and binary forms are permitted
  6.  * provided that this notice is preserved and that due credit is given
  7.  * to the University of California at Berkeley. The name of the University
  8.  * may not be used to endorse or promote products derived from this
  9.  * software without specific prior written permission. This software
  10.  * is provided ``as is'' without express or implied warranty.
  11.  */
  12.  
  13. #ifdef notdef
  14. static char sccsid[] = "@(#)temp.c    5.4 (Berkeley) 2/18/88";
  15. #endif /* notdef */
  16.  
  17. #include "rcv.h"
  18.  
  19. /*
  20.  * Mail -- a mail program
  21.  *
  22.  * Give names to all the temporary files that we will need.
  23.  */
  24.  
  25. char    tempMail[14];
  26. char    tempQuit[14];
  27. char    tempEdit[14];
  28. char    tempSet[14];
  29. char    tempResid[14];
  30. char    tempMesg[14];
  31.  
  32. tinit()
  33. {
  34.     register char *cp;
  35.     char uname[PATHSIZE];
  36.     register int pid;
  37.     uid_t getuid();
  38.  
  39.     pid = getpid();
  40.     sprintf(tempMail, "/tmp/Rs%05d", pid);
  41.     sprintf(tempResid, "/tmp/Rq%05d", pid);
  42.     sprintf(tempQuit, "/tmp/Rm%05d", pid);
  43.     sprintf(tempEdit, "/tmp/Re%05d", pid);
  44.     sprintf(tempSet, "/tmp/Rx%05d", pid);
  45.     sprintf(tempMesg, "/tmp/Rx%05d", pid);
  46.  
  47.     if (strlen(myname) != 0) {
  48.         uid = getuserid(myname);
  49.         if (uid == -1) {
  50.             printf("\"%s\" is not a user of this system\n",
  51.                 myname);
  52.             exit(1);
  53.         }
  54.     }
  55.     else {
  56.         uid = getuid();
  57.         if (username(uid, uname) < 0) {
  58.             strcpy(myname, "ubluit");
  59.             if (rcvmode) {
  60.                 printf("Who are you!?\n");
  61.                 exit(1);
  62.             }
  63.         } else
  64.             strcpy(myname, uname);
  65.     }
  66.     if ((cp = value("HOME")) == NOSTR)
  67.         cp = ".";
  68.     strcpy(homedir, cp);
  69.     findmail();
  70.     strcpy(copy(homedir, mbox), "/mbox");
  71.     strcpy(copy(homedir, mailrc), "/.mailrc");
  72.     strcpy(copy(homedir, deadletter), "/dead.letter");
  73.     if (debug) {
  74.         printf("uid = %d, user = %s, mailname = %s\n",
  75.             uid, myname, mailname);
  76.         printf("deadletter = %s, mailrc = %s, mbox = %s\n",
  77.             deadletter, mailrc, mbox);
  78.     }
  79. }
  80.