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