xref: /original-bsd/usr.bin/mail/v7.local.c (revision fa921481)
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.9 (Berkeley) 06/01/90";
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;
28 	char *buf;
29 {
30 
31 	strcpy(copy(_PATH_MBOX, buf), user);
32 }
33 
34 /*
35  * Get rid of the queued mail.
36  */
37 demail()
38 {
39 
40 	if (value("keep") != NOSTR || remove(mailname) < 0)
41 		close(creat(mailname, 0600));
42 }
43 
44 /*
45  * Discover user login name.
46  */
47 char*
48 username()
49 {
50 	char *np;
51 
52 	if ((np = getenv("USER")) != NOSTR)
53 		return np;
54 	return getname(getuid());
55 }
56