BSD 2 development
[unix-history] / .ref-BSD-1 / s7 / htmps.c
CommitLineData
8c2df56f
BJ
1/*
2 * htmp - manipulation routines for "htmp" data base
3 * Bill Joy UCB September 24, 1977
4 * << set routines >>
5 */
6struct htmp {
7 int uid;
8 char home[28];
9 int ttytype;
10} hentry;
11
12char htmp[];
13
14hput(tty)
15 char tty;
16{
17 register int hunit;
18
19 hunit = open(htmp, 1);
20 if (hunit < 0)
21 return (-1);
22 seek(hunit, tty * sizeof hentry, 0);
23 if (write(hunit, &hentry, sizeof hentry) != sizeof hentry)
24 goto bad;
25 close(hunit);
26 return (0);
27bad:
28 close(hunit);
29 return (-1);
30}
31
32hsethome(cp)
33 char *cp;
34{
35 register int i;
36
37 for (i = 0; i < 27 && cp[i]; i++)
38 hentry.home[i] = cp[i];
39 hentry.home[i] = 0;
40}
41
42hsetuid(uid)
43 int uid;
44{
45
46 hentry.uid = uid;
47}
48
49hsettype(type)
50 int type;
51{
52
53 hentry.ttytype = type;
54}