2 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
3 * Use is subject to license terms.
7 * Copyright (c) 1983 Regents of the University of California.
8 * All rights reserved. The Berkeley software License Agreement
9 * specifies the terms and conditions for redistribution.
12 #pragma ident "%Z%%M% %I% %E% SMI"
17 * Attributes to be gleened from remote host description
20 static char **caps
[] = {
21 &AT
, &DV
, &CM
, &CU
, &EL
, &IE
, &OE
, &PN
, &PR
, &DI
,
22 &ES
, &EX
, &FO
, &RC
, &RE
, &PA
25 static char *capstrings
[] = {
26 "at", "dv", "cm", "cu", "el", "ie", "oe", "pn", "pr",
27 "di", "es", "ex", "fo", "rc", "re", "pa", 0
30 extern char *rgetstr(char *, char **);
37 static char buf
[BUFSIZ
/2];
41 if ((stat
= rgetent(tbuf
, host
, sizeof (tbuf
))) <= 0) {
43 host
[0] == '/' && access(DV
= host
, R_OK
| W_OK
) == 0) {
45 * If the user specifies a device on the commandline,
57 RE
= (char *)"tip.record";
58 EX
= (char *)"\t\n\b\f";
64 (void) fprintf(stderr
, stat
== 0 ?
65 "tip: unknown host %s\n" :
66 "tip: can't open host description file\n", host
);
70 for (p
= capstrings
, q
= caps
; *p
!= NULL
; p
++, q
++)
72 **q
= rgetstr(*p
, &bp
);
73 if (!BR
&& (BR
= rgetnum("br")) < 0)
75 if ((FS
= rgetnum("fs")) < 0)
82 (void) fprintf(stderr
, "%s: missing device spec\n", host
);
85 if (DU
&& CU
== NOSTR
)
87 if (DU
&& PN
== NOSTR
) {
88 (void) fprintf(stderr
, "%s: missing phone number\n", host
);
94 * This effectively eliminates the "hw" attribute
95 * from the description file
98 HW
= (CU
== NOSTR
) || (DU
&& equal(DV
, CU
));
101 * see if uppercase mode should be turned on initially
104 boolean(value(RAISE
)) = 1;
106 boolean(value(ECHOCHECK
)) = 1;
108 boolean(value(BEAUTIFY
)) = 1;
110 boolean(value(BEAUTIFY
)) = 0;
112 boolean(value(SCRIPT
)) = 1;
114 boolean(value(TABEXPAND
)) = 1;
116 boolean(value(VERBOSE
)) = 1;
118 boolean(value(VERBOSE
)) = 0;
120 boolean(value(TAND
)) = 1;
122 boolean(value(TAND
)) = 0;
124 boolean(value(RAWFTP
)) = 1;
126 boolean(value(HALFDUPLEX
)) = 1;
128 boolean(value(HARDWAREFLOW
)) = 1;
130 RE
= (char *)"tip.record";
132 EX
= (char *)"\t\n\b\f";
134 (void) vstring("es", ES
);
136 (void) vstring("fo", FO
);
138 (void) vstring("pr", PR
);
140 (void) vstring("rc", RC
);
141 if ((DL
= rgetnum("dl")) < 0)
143 if ((CL
= rgetnum("cl")) < 0)
145 if ((ET
= rgetnum("et")) < 0)
150 getremote(char *host
)
154 static int lookedup
= 0;
157 if (host
== NOSTR
&& (host
= getenv("HOST")) == NOSTR
) {
158 (void) fprintf(stderr
, "tip: no host specified\n");
166 * We return a new device each time we're called (to allow
167 * a rotary action to be simulated)
171 if ((cp
= strchr(next
, ',')) == NULL
) {