xref: /original-bsd/usr.bin/mail/v7.local.c (revision 440fde76)
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.8 (Berkeley) 05/11/89";
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 findmail(user, buf)
37 	char *user;
38 	char *buf;
39 {
40 
41 	strcpy(copy(_PATH_MBOX, buf), user);
42 }
43 
44 /*
45  * Get rid of the queued mail.
46  */
47 demail()
48 {
49 
50 	if (value("keep") != NOSTR || remove(mailname) < 0)
51 		close(creat(mailname, 0600));
52 }
53 
54 /*
55  * Discover user login name.
56  */
57 char*
58 username()
59 {
60 	char *np;
61 
62 	if ((np = getenv("USER")) != NOSTR)
63 		return np;
64 	return getname(getuid());
65 }
66