BSD 3 development
[unix-history] / .ref-BSD-2 / src / Mail / v6.local.c
CommitLineData
0f5e4452
KS
1/* Copyright (c) 1979 Regents of the University of California */
2#
3
4/*
5 * Mail -- a mail program
6 *
7 * Unix version 6.0
8 */
9
10#include "rcv.h"
11
12/*
13 * Locate the user's mailbox file (ie, the place where new, unread
14 * mail is queued). In Version 6, it is in ~/.mail
15 */
16
17findmail()
18{
19 register char *cp;
20
21 cp = copy(homedir, mailname);
22 copy("/.mail", cp);
23}
24
25/*
26 * Get rid of the queued mail.
27 */
28
29demail()
30{
31 close(creat(mailname, 0666));
32 alter(mailname);
33}
34
35/*
36 * Get an environment variable. At present, we only support
37 * "SHELL" and "HOME". This routine makes use of the getpw
38 * routine in the neighboring getname.c stuff.
39 */
40
41char *
42getenv(name)
43 char name[];
44{
45 char pwline[LINESIZE];
46 static char val[30];
47 register char *cp, *dp;
48 register int cc;
49
50 if (equal(name, "SHELL"))
51 cc = 6;
52 else if (equal(name, "HOME"))
53 cc = 5;
54 else
55 return(NOSTR);
56 if (getpw(uid, pwline) < 0)
57 return(NOSTR);
58 for (cp = pwline; *cp && cc > 0;)
59 if (*cp++ == ':')
60 cc--;
61 dp = cp;
62 while (*cp != ':' && *cp != '\0')
63 cp++;
64 *cp = '\0';
65 if (*dp == '\0')
66 return(NOSTR);
67 copy(dp, val);
68 return(val);
69}
70
71/*
72 * Lock and unlock retrofits which are only
73 * significant in version 7.
74 */
75
76lock(name)
77 char *name;
78{
79
80 return(0);
81}
82
83unlock()
84{
85
86 return(0);
87}