| 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 the above copyright notice and this paragraph are |
| 7 | * duplicated in all such forms and that any documentation, |
| 8 | * advertising materials, and other materials related to such |
| 9 | * distribution and use acknowledge that the software was developed |
| 10 | * by the University of California, Berkeley. The name of the |
| 11 | * University may not be used to endorse or promote products derived |
| 12 | * from this software without specific prior written permission. |
| 13 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR |
| 14 | * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED |
| 15 | * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 16 | */ |
| 17 | |
| 18 | #ifndef lint |
| 19 | static char sccsid[] = "@(#)v7.local.c 5.6 (Berkeley) %G%"; |
| 20 | #endif /* not lint */ |
| 21 | |
| 22 | /* |
| 23 | * Mail -- a mail program |
| 24 | * |
| 25 | * Version 7 |
| 26 | * |
| 27 | * Local routines that are installation dependent. |
| 28 | */ |
| 29 | |
| 30 | #include "rcv.h" |
| 31 | |
| 32 | /* |
| 33 | * Locate the user's mailbox file (ie, the place where new, unread |
| 34 | * mail is queued). |
| 35 | */ |
| 36 | char * |
| 37 | findmail(user) |
| 38 | char *user; |
| 39 | { |
| 40 | static char buf[PATHSIZE]; |
| 41 | |
| 42 | strcpy(copy("/usr/spool/mail/", buf), user); |
| 43 | return buf; |
| 44 | } |
| 45 | |
| 46 | /* |
| 47 | * Get rid of the queued mail. |
| 48 | */ |
| 49 | |
| 50 | demail() |
| 51 | { |
| 52 | |
| 53 | if (value("keep") != NOSTR) |
| 54 | close(creat(mailname, 0666)); |
| 55 | else { |
| 56 | if (remove(mailname) < 0) |
| 57 | close(creat(mailname, 0666)); |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | /* |
| 62 | * Discover user login name. |
| 63 | */ |
| 64 | |
| 65 | username(uid, namebuf) |
| 66 | char namebuf[]; |
| 67 | { |
| 68 | register char *np; |
| 69 | |
| 70 | if (uid == getuid() && (np = getenv("USER")) != NOSTR) { |
| 71 | strncpy(namebuf, np, PATHSIZE); |
| 72 | return(0); |
| 73 | } |
| 74 | return(getname(uid, namebuf)); |
| 75 | } |