file reorg, pathnames.h, paths.h
[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 *
5 * Redistribution and use in source and binary forms are permitted
acfc7e9b
KB
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.
761330fe
DF
16 */
17
acfc7e9b 18#ifndef lint
435e8dff 19static char sccsid[] = "@(#)v7.local.c 5.8 (Berkeley) %G%";
acfc7e9b 20#endif /* not lint */
00a21395
KS
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
00a21395
KS
32/*
33 * Locate the user's mailbox file (ie, the place where new, unread
2a0f6531 34 * mail is queued).
00a21395 35 */
f674e088 36findmail(user, buf)
2a0f6531 37 char *user;
f674e088 38 char *buf;
00a21395 39{
00a21395 40
435e8dff 41 strcpy(copy(_PATH_MBOX, buf), user);
00a21395
KS
42}
43
44/*
45 * Get rid of the queued mail.
46 */
00a21395
KS
47demail()
48{
49
f674e088
EW
50 if (value("keep") != NOSTR || remove(mailname) < 0)
51 close(creat(mailname, 0600));
00a21395
KS
52}
53
54/*
55 * Discover user login name.
56 */
f674e088
EW
57char*
58username()
00a21395 59{
f674e088 60 char *np;
00a21395 61
f674e088
EW
62 if ((np = getenv("USER")) != NOSTR)
63 return np;
64 return getname(getuid());
00a21395 65}