home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / mmdf / mmdf-IIb.43 / uip / ucbmail / temp.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-03-28  |  1.6 KB  |  78 lines

  1. /*
  2.  * Copyright (c) 1980 Regents of the University of California.
  3.  * All rights reserved.  The Berkeley software License Agreement
  4.  * specifies the terms and conditions for redistribution.
  5.  */
  6.  
  7. #ifndef lint
  8. static char *sccsid = "@(#)temp.c    5.2 (Berkeley) 6/21/85";
  9. #endif not lint
  10.  
  11. #include "./rcv.h"
  12.  
  13. /*
  14.  * Mail -- a mail program
  15.  *
  16.  * Give names to all the temporary files that we will need.
  17.  */
  18.  
  19. char    tempMail[14];
  20. char    tempQuit[14];
  21. char    tempEdit[14];
  22. char    tempSet[14];
  23. char    tempResid[14];
  24. char    tempMesg[14];
  25.  
  26. tinit()
  27. {
  28.     register char *cp;
  29.     char uname[PATHSIZE];
  30.     register int pid;
  31.  
  32.     pid = getpid();
  33.     sprintf(tempMail, "/tmp/Rs%05d", pid);
  34.     sprintf(tempResid, "/tmp/Rq%05d", pid);
  35.     sprintf(tempQuit, "/tmp/Rm%05d", pid);
  36.     sprintf(tempEdit, "/tmp/Re%05d", pid);
  37.     sprintf(tempSet, "/tmp/Rx%05d", pid);
  38.     sprintf(tempMesg, "/tmp/Rx%05d", pid);
  39.  
  40.     if (strlen(myname) != 0) {
  41.         uid = getuserid(myname);
  42.         if (uid == -1) {
  43.             printf("\"%s\" is not a user of this system\n",
  44.                 myname);
  45.             exit(1);
  46.         }
  47.     }
  48.     else {
  49.         uid = getuid() & UIDMASK;
  50.         if (username(uid, uname) < 0) {
  51.             copy("ubluit", myname);
  52.             if (rcvmode) {
  53.                 printf("Who are you!?\n");
  54.                 exit(1);
  55.             }
  56.         }
  57.         else
  58.             copy(uname, myname);
  59.     }
  60.     cp = value("HOME");
  61.     if (cp == NOSTR)
  62.         cp = ".";
  63.     copy(cp, homedir);
  64.     findmail();
  65.     cp = copy(homedir, mbox);
  66.     copy("/mbox", cp);
  67.     cp = copy(homedir, mailrc);
  68.     copy("/.mailrc", cp);
  69.     cp = copy(homedir, deadlettername);
  70.     copy("/dead.letter", cp);
  71.     if (debug) {
  72.         printf("uid = %d, user = %s, mailname = %s\n",
  73.             uid, myname, mailname);
  74.         printf("deadlettername = %s, mailrc = %s, mbox = %s\n",
  75.             deadlettername, mailrc, mbox);
  76.     }
  77. }
  78.