4.4BSD snapshot (revision 8.1); add 1993 to copyright
[unix-history] / usr / src / usr.bin / mail / v7.local.c
CommitLineData
761330fe 1/*
a12ff486
KB
2 * Copyright (c) 1980, 1993
3 * The Regents of the University of California. All rights reserved.
0c5f72fb 4 *
f15db449 5 * %sccs.include.redist.c%
761330fe
DF
6 */
7
acfc7e9b 8#ifndef lint
a12ff486 9static char sccsid[] = "@(#)v7.local.c 8.1 (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"
a0d23834
KB
21#include <fcntl.h>
22#include "extern.h"
00a21395 23
00a21395
KS
24/*
25 * Locate the user's mailbox file (ie, the place where new, unread
2a0f6531 26 * mail is queued).
00a21395 27 */
a0d23834 28void
f674e088 29findmail(user, buf)
9125660a 30 char *user, *buf;
00a21395 31{
9125660a 32 (void)sprintf(buf, "%s/%s", _PATH_MAILDIR, user);
00a21395
KS
33}
34
35/*
36 * Get rid of the queued mail.
37 */
a0d23834 38void
00a21395
KS
39demail()
40{
41
f82cf0f0 42 if (value("keep") != NOSTR || rm(mailname) < 0)
f674e088 43 close(creat(mailname, 0600));
00a21395
KS
44}
45
46/*
47 * Discover user login name.
48 */
a0d23834 49char *
f674e088 50username()
00a21395 51{
f674e088 52 char *np;
00a21395 53
f674e088
EW
54 if ((np = getenv("USER")) != NOSTR)
55 return np;
56 return getname(getuid());
00a21395 57}