new copyright notice
[unix-history] / usr / src / usr.bin / mail / v7.local.c
CommitLineData
761330fe
DF
1/*
2 * Copyright (c) 1980 Regents of the University of California.
0c5f72fb
KB
3 * All rights reserved.
4 *
f15db449 5 * %sccs.include.redist.c%
761330fe
DF
6 */
7
acfc7e9b 8#ifndef lint
f15db449 9static char sccsid[] = "@(#)v7.local.c 5.9 (Berkeley) %G%";
acfc7e9b 10#endif /* not lint */
00a21395
KS
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
00a21395
KS
22/*
23 * Locate the user's mailbox file (ie, the place where new, unread
2a0f6531 24 * mail is queued).
00a21395 25 */
f674e088 26findmail(user, buf)
2a0f6531 27 char *user;
f674e088 28 char *buf;
00a21395 29{
00a21395 30
435e8dff 31 strcpy(copy(_PATH_MBOX, buf), user);
00a21395
KS
32}
33
34/*
35 * Get rid of the queued mail.
36 */
00a21395
KS
37demail()
38{
39
f674e088
EW
40 if (value("keep") != NOSTR || remove(mailname) < 0)
41 close(creat(mailname, 0600));
00a21395
KS
42}
43
44/*
45 * Discover user login name.
46 */
f674e088
EW
47char*
48username()
00a21395 49{
f674e088 50 char *np;
00a21395 51
f674e088
EW
52 if ((np = getenv("USER")) != NOSTR)
53 return np;
54 return getname(getuid());
00a21395 55}