static char sccsid
[] = "@(#)subr.c 4.1 (Berkeley) 83/07/06";
extern struct sgttyb tmode
;
extern struct ltchars ltc
;
gettable(name
, buf
, area
)
register struct gettystrs
*sp
;
register struct gettynums
*np
;
register struct gettyflags
*fp
;
hopcount
= 0; /* new lookup, start fresh */
if (getent(buf
, name
) != 1)
for (sp
= gettystrs
; sp
->field
; sp
++)
sp
->value
= getstr(sp
->field
, &area
);
for (np
= gettynums
; np
->field
; np
++) {
for (fp
= gettyflags
; fp
->field
; fp
++) {
fp
->value
= n
^ fp
->invrt
;
register struct gettystrs
*sp
;
register struct gettynums
*np
;
register struct gettyflags
*fp
;
for (sp
= gettystrs
; sp
->field
; sp
++)
for (np
= gettynums
; np
->field
; np
++)
for (fp
= gettyflags
; fp
->field
; fp
++)
register struct gettystrs
*sp
;
register struct gettynums
*np
;
register struct gettyflags
*fp
;
for (sp
= gettystrs
; sp
->field
; sp
++)
for (np
= gettynums
; np
->field
; np
++)
for (fp
= gettyflags
; fp
->field
; fp
++)
&ER
, &KL
, &IN
, &QU
, &XN
, &XF
, &ET
, &BK
,
&SU
, &DS
, &RP
, &FL
, &WE
, &LN
, 0
&tmode
.sg_erase
, &tmode
.sg_kill
, &tc
.t_intrc
,
&tc
.t_quitc
, &tc
.t_startc
, &tc
.t_stopc
,
&tc
.t_eofc
, &tc
.t_brkc
, <c
.t_suspc
,
<c
.t_dsuspc
, <c
.t_rprntc
, <c
.t_flushc
,
<c
.t_werasc
, <c
.t_lnextc
, 0
for (i
= 0; charnames
[i
]; i
++) {
if (n
== 1) { /* read mode flags */
unsigned delay
; /* delay in ms */
* below are random guesses, I can't be bothered checking
struct delayval crdelay
[] = {
struct delayval nldelay
[] = {
1, NL1
, /* special, calculated */
struct delayval bsdelay
[] = {
struct delayval ffdelay
[] = {
struct delayval tbdelay
[] = {
f
|= adelay(ND
, nldelay
);
f
|= adelay(FD
, ffdelay
);
f
|= adelay(TD
, tbdelay
);
f
|= adelay(BD
, bsdelay
);
register struct delayval
*dp
;
while (dp
->delay
&& ms
> dp
->delay
)
register char *host
= HN
;
register char *res
= editedhost
;
if (res
== &editedhost
[sizeof editedhost
- 1]) {
strncpy(res
, host
, sizeof editedhost
- (res
- editedhost
) - 1);
editedhost
[sizeof editedhost
- 1] = '\0';
19, EXTA
, /* for people who say 19.2K */
7200, EXTB
, /* alternative */
register struct speedtab
*sp
;
for (sp
= speedtab
; sp
->speed
; sp
++)
return (B300
); /* default in impossible cases */
static char termbuf
[128] = "TERM=";
while (q
= index(q
, ',')) {
* This speed select mechanism is written for the Develcon DATASWITCH.
* The Develcon sends a string of the form "B{speed}\n" at a predefined
* baud rate. This string indicates the user's actual speed.
* The routine below returns the terminal type mapped from derived speed.
char c
, baud
[20], *type
= "default";
register struct portselect
*ps
;
for (len
= 0; len
< sizeof (baud
) - 1; len
++) {
if (c
== '\n' || c
== '\r')
len
= 0; /* in case of leading garbage */
for (ps
= portspeeds
; ps
->ps_baud
; ps
++)
if (strcmp(ps
->ps_baud
, baud
) == 0) {
sleep(2); /* wait for connection to complete */