xref: /original-bsd/usr.bin/mail/v7.local.c (revision c8876cb1)
1 /*
2  * Copyright (c) 1980 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 static char sccsid[] = "@(#)v7.local.c	5.12 (Berkeley) 02/03/91";
10 #endif /* not lint */
11 
12 /*
13  * Mail -- a mail program
14  *
15  * Version 7
16  *
17  * Local routines that are installation dependent.
18  */
19 
20 #include "rcv.h"
21 
22 /*
23  * Locate the user's mailbox file (ie, the place where new, unread
24  * mail is queued).
25  */
26 findmail(user, buf)
27 	char *user, *buf;
28 {
29 	(void)sprintf(buf, "%s/%s", _PATH_MAILDIR, user);
30 }
31 
32 /*
33  * Get rid of the queued mail.
34  */
35 demail()
36 {
37 
38 	if (value("keep") != NOSTR || rm(mailname) < 0)
39 		close(creat(mailname, 0600));
40 }
41 
42 /*
43  * Discover user login name.
44  */
45 char*
46 username()
47 {
48 	char *np;
49 
50 	if ((np = getenv("USER")) != NOSTR)
51 		return np;
52 	return getname(getuid());
53 }
54