Commit | Line | Data |
---|---|---|
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 KB |
18 | #ifndef lint |
19 | static char sccsid[] = "@(#)v7.local.c 5.6 (Berkeley) %G%"; | |
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 | */ |
2a0f6531 EW |
36 | char * |
37 | findmail(user) | |
38 | char *user; | |
00a21395 | 39 | { |
2a0f6531 | 40 | static char buf[PATHSIZE]; |
00a21395 | 41 | |
2a0f6531 EW |
42 | strcpy(copy("/usr/spool/mail/", buf), user); |
43 | return buf; | |
00a21395 KS |
44 | } |
45 | ||
46 | /* | |
47 | * Get rid of the queued mail. | |
48 | */ | |
49 | ||
50 | demail() | |
51 | { | |
52 | ||
297f6c21 KS |
53 | if (value("keep") != NOSTR) |
54 | close(creat(mailname, 0666)); | |
77bc23cf KS |
55 | else { |
56 | if (remove(mailname) < 0) | |
57 | close(creat(mailname, 0666)); | |
58 | } | |
00a21395 KS |
59 | } |
60 | ||
61 | /* | |
62 | * Discover user login name. | |
63 | */ | |
64 | ||
65 | username(uid, namebuf) | |
66 | char namebuf[]; | |
67 | { | |
68 | register char *np; | |
69 | ||
70 | if (uid == getuid() && (np = getenv("USER")) != NOSTR) { | |
56b6e63e | 71 | strncpy(namebuf, np, PATHSIZE); |
00a21395 KS |
72 | return(0); |
73 | } | |
74 | return(getname(uid, namebuf)); | |
75 | } |