Deleted Added
sdiff udiff text old ( 22989 ) new ( 25709 )
full compact
1/*
2 * Copyright (c) 1983, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 19 unchanged lines hidden (view full) ---

28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#ifndef lint
35/*static char sccsid[] = "from: @(#)subr.c 8.1 (Berkeley) 6/4/93";*/
36static char rcsid[] = "$Id$";
37#endif /* not lint */
38
39/*
40 * Melbourne getty.
41 */
42#define COMPAT_43
43#include <stdlib.h>
44#include <unistd.h>
45#include <string.h>
46#include <termios.h>
47#include <sys/ioctl.h>
48#include <sys/param.h>
49#ifdef DEBUG
50#include <stdio.h>
51#endif
52
53#include "gettytab.h"
54#include "pathnames.h"
55#include "extern.h"
56

--- 9 unchanged lines hidden (view full) ---

66gettable(name, buf)
67 const char *name;
68 char *buf;
69{
70 register struct gettystrs *sp;
71 register struct gettynums *np;
72 register struct gettyflags *fp;
73 long n;
74 const char *dba[2];
75 dba[0] = _PATH_GETTYTAB;
76 dba[1] = 0;
77
78 if (cgetent(&buf, dba, name) != 0)
79 return;
80
81 for (sp = gettystrs; sp->field; sp++)
82 cgetstr(buf, sp->field, &sp->value);
83 for (np = gettynums; np->field; np++) {
84 if (cgetnum(buf, np->field, &n) == -1)
85 np->set = 0;
86 else {
87 np->set = 1;
88 np->value = n;
89 }
90 }
91 for (fp = gettyflags; fp->field; fp++) {
92 if (cgetcap(buf, fp->field, ':') == NULL)
93 fp->set = 0;
94 else {
95 fp->set = 1;
96 fp->value = 1 ^ fp->invrt;
97 }
98 }
99#ifdef DEBUG
100 printf("name=\"%s\", buf=\"%s\"\r\n", name, buf);
101 for (sp = gettystrs; sp->field; sp++)
102 printf("cgetstr: %s=%s\r\n", sp->field, sp->value);
103 for (np = gettynums; np->field; np++)
104 printf("cgetnum: %s=%d\r\n", np->field, np->value);
105 for (fp = gettyflags; fp->field; fp++)
106 printf("cgetflags: %s='%c' set='%c'\r\n", fp->field,

--- 5 unchanged lines hidden (view full) ---

112gendefaults()
113{
114 register struct gettystrs *sp;
115 register struct gettynums *np;
116 register struct gettyflags *fp;
117
118 for (sp = gettystrs; sp->field; sp++)
119 if (sp->value)
120 sp->defalt = sp->value;
121 for (np = gettynums; np->field; np++)
122 if (np->set)
123 np->defalt = np->value;
124 for (fp = gettyflags; fp->field; fp++)
125 if (fp->set)
126 fp->defalt = fp->value;
127 else
128 fp->defalt = fp->invrt;
129}
130
131void
132setdefaults()
133{
134 register struct gettystrs *sp;
135 register struct gettynums *np;
136 register struct gettyflags *fp;
137
138 for (sp = gettystrs; sp->field; sp++)
139 if (!sp->value)
140 sp->value = sp->defalt;
141 for (np = gettynums; np->field; np++)
142 if (!np->set)
143 np->value = np->defalt;
144 for (fp = gettyflags; fp->field; fp++)
145 if (!fp->set)
146 fp->value = fp->defalt;
147}
148

--- 633 unchanged lines hidden ---