Commit | Line | Data |
---|---|---|
2ae9f53f SL |
1 | #ifndef lint |
2 | static char sccsid[] = "@(#)v7.local.c 2.3 (Berkeley) %G%"; | |
3 | #endif | |
00a21395 KS |
4 | |
5 | /* | |
6 | * Mail -- a mail program | |
7 | * | |
8 | * Version 7 | |
9 | * | |
10 | * Local routines that are installation dependent. | |
11 | */ | |
12 | ||
13 | #include "rcv.h" | |
14 | ||
00a21395 KS |
15 | /* |
16 | * Locate the user's mailbox file (ie, the place where new, unread | |
17 | * mail is queued). In Version 7, it is in /usr/spool/mail/name. | |
18 | */ | |
19 | ||
20 | findmail() | |
21 | { | |
22 | register char *cp; | |
23 | ||
24 | cp = copy("/usr/spool/mail/", mailname); | |
25 | copy(myname, cp); | |
26 | if (isdir(mailname)) { | |
27 | stradd(mailname, '/'); | |
28 | strcat(mailname, myname); | |
29 | } | |
30 | } | |
31 | ||
32 | /* | |
33 | * Get rid of the queued mail. | |
34 | */ | |
35 | ||
36 | demail() | |
37 | { | |
38 | ||
297f6c21 KS |
39 | if (value("keep") != NOSTR) |
40 | close(creat(mailname, 0666)); | |
77bc23cf KS |
41 | else { |
42 | if (remove(mailname) < 0) | |
43 | close(creat(mailname, 0666)); | |
44 | } | |
00a21395 KS |
45 | } |
46 | ||
47 | /* | |
48 | * Discover user login name. | |
49 | */ | |
50 | ||
51 | username(uid, namebuf) | |
52 | char namebuf[]; | |
53 | { | |
54 | register char *np; | |
55 | ||
56 | if (uid == getuid() && (np = getenv("USER")) != NOSTR) { | |
56b6e63e | 57 | strncpy(namebuf, np, PATHSIZE); |
00a21395 KS |
58 | return(0); |
59 | } | |
60 | return(getname(uid, namebuf)); | |
61 | } |