date and time created 80/10/08 09:52:17 by kas
[unix-history] / usr / src / usr.bin / mail / 40.local.c
CommitLineData
e997e9a8
KS
1#
2
3/*
4 * Mail -- a mail program
5 *
6 * Ingres 11/70. Unix version 6.0
7 *
8 * Local routines that are installation dependent.
9 * All fiddlers please note: if you make careful note of
10 * what you change here, I will incorporate your changes and
11 * you won't have to remake them each release.
12 */
13
14static char *SccsId = "@(#)40.local.c 1.1 %G%";
15
16#include "rcv.h"
17
18/*
19 * Locate the user's mailbox file (ie, the place where new, unread
20 * mail is queued). On the 11/40, it is in /usr/mail/name
21 */
22
23findmail()
24{
25 register char *cp;
26
27 cp = copy("/usr/mail/", mailname);
28 copy(myname, cp);
29}
30
31/*
32 * Get rid of the queued mail.
33 */
34
35demail()
36{
37
38 close(creat(mailname, 0644));
39 alter(mailname);
40}
41
42/*
43 * Get an environment variable. At present, we only support
44 * "SHELL" and "HOME". This routine makes use of the getpw
45 * routine in the neighboring getname.c stuff.
46 */
47
48char *
49getenv(name)
50 char name[];
51{
52 char pwline[LINESIZE];
53 static char val[30];
54 register char *cp, *dp;
55 register int cc;
56
57 if (equal(name, "SHELL"))
58 cc = 6;
59 else if (equal(name, "HOME"))
60 cc = 5;
61 else
62 return(NOSTR);
63 if (getpw(uid, pwline) < 0)
64 return(NOSTR);
65 for (cp = pwline; *cp && cc > 0;)
66 if (*cp++ == ':')
67 cc--;
68 dp = cp;
69 while (*cp != ':' && *cp != '\0')
70 cp++;
71 *cp = '\0';
72 if (*dp == '\0')
73 return(NOSTR);
74 copy(dp, val);
75 return(val);
76}
77
78/*
79 * Lock and unlock retrofits which are only
80 * significant in version 7.
81 */
82
83lock(name)
84 char *name;
85{
86
87 return(0);
88}
89
90unlock()
91{
92
93 return(0);
94}
95
96/*
97 * discover user's login name.
98 */
99
100username(uid, namebuf)
101 char namebuf[];
102{
103
104 return(getname(uid, namebuf));
105}