1 # 2 3 /* 4 * Mail -- a mail program 5 * 6 * EECS Cory 11/70 Version 7.0 7 * 8 * Local routines that are installation dependent. 9 * All fiddlers please note: if you make careful note of 10 * what you change here, I will incorporate your changes and 11 * you won't have to remake them each release. 12 */ 13 14 static char *SccsId = "@(#)c.local.c 1.1 10/08/80"; 15 16 #include "rcv.h" 17 #include <pwd.h> 18 19 /* 20 * Locate the user's mailbox file (ie, the place where new, unread 21 * mail is queued). At Cory, it is in /usr/spool/mail/name. 22 */ 23 24 findmail() 25 { 26 register char *cp; 27 28 cp = copy("/usr/spool/mail/", mailname); 29 copy(myname, cp); 30 } 31 32 /* 33 * Get rid of the queued mail. 34 */ 35 36 demail() 37 { 38 register int p; 39 40 close(creat(mailname, 0666)); 41 alter(mailname); 42 } 43 44 /* 45 * Mail file lock / unlock. 46 * Insignificant on Cory version 7, since /usr/spool/mail not 47 * generally writable. 48 */ 49 50 lock(name) 51 char *name; 52 { 53 54 return(0); 55 } 56 57 unlock() 58 { 59 60 return(0); 61 } 62 63 /* 64 * Discover user login name. 65 */ 66 67 username(uid, namebuf) 68 char namebuf[]; 69 { 70 register char *np; 71 72 if (uid == getuid() && (np = getenv("USER")) != NOSTR) { 73 strncpy(namebuf, np, 9); 74 return(0); 75 } 76 return(getname(uid, namebuf)); 77 } 78 79 /* 80 * Discover user name from uid. Uses the fancy hashed passwd 81 * data base available only on Cory Unix. 82 */ 83 84 getname(uid, namebuf) 85 char namebuf[]; 86 { 87 struct passwd *gp; 88 struct passwd *getpwuid(); 89 90 gp = getpwuid(uid); 91 if (gp == (struct passwd *) 0) 92 return(-1); 93 strcpy(namebuf, gp->pw_name); 94 return(0); 95 } 96 97 /* 98 * Cory hall getuserid 99 */ 100 101 getuserid(name) 102 char name[]; 103 { 104 struct passwd *gp; 105 struct passwd *getpwnam(); 106 107 if ((gp = getpwnam(name)) == (struct passwd *) 0) 108 return(-1); 109 return(gp->pw_uid); 110 } 111