* Copyright (c) 1991, 1993
* The Regents of the University of California. All rights reserved.
* %sccs.include.redist.c%
static char sccsid
[] = "@(#)print.c 8.4 (Berkeley) %G%";
static void binit
__P((char *));
static void bput
__P((char *));
static char *ccval
__P((struct cchar
*, int));
print(tp
, wp
, ldisc
, fmt
)
char buf1
[100], buf2
[100];
cnt
+= printf("tablet disc; ");
cnt
+= printf("slip disc; ");
cnt
+= printf("#%d disc; ", ldisc
);
ispeed
= cfgetispeed(tp
);
ospeed
= cfgetospeed(tp
);
printf("ispeed %d baud; ospeed %d baud;", ispeed
, ospeed
);
cnt
+= printf("speed %d baud;", ispeed
);
cnt
+= printf(" %d rows; %d columns;", wp
->ws_row
, wp
->ws_col
);
#define on(f) ((tmp&f) != 0)
if (fmt >= BSD || on(f) != d) \
put("-icanon", ICANON
, 1);
put("-iexten", IEXTEN
, 1);
put("-echoke", ECHOKE
, 0);
put("-echonl", ECHONL
, 0);
put("-echoctl", ECHOCTL
, 0);
put("-echoprt", ECHOPRT
, 0);
put("-altwerase", ALTWERASE
, 0);
put("-noflsh", NOFLSH
, 0);
put("-tostop", TOSTOP
, 0);
put("-mdmbuf", MDMBUF
, 0);
put("-flusho", FLUSHO
, 0);
put("-pendin", PENDIN
, 0);
put("-nokerninfo", NOKERNINFO
, 0);
put("-extproc", EXTPROC
, 0);
put("-istrip", ISTRIP
, 0);
put("-imaxbel", IMAXBEL
, 1);
put("-ignbrk", IGNBRK
, 0);
put("-brkint", BRKINT
, 1);
put("-ignpar", IGNPAR
, 0);
put("-parmrk", PARMRK
, 0);
put("-oxtabs", OXTABS
, 1);
/* control flags (hardware state) */
bput("-parenb" + on(PARENB
));
put("-parodd", PARODD
, 0);
put("-clocal", CLOCAL
, 0);
put("-cstopb", CSTOPB
, 0);
put("-crtscts", CRTSCTS
, 0);
/* special control characters */
for (p
= cchars1
; p
->name
; ++p
) {
(void)snprintf(buf1
, sizeof(buf1
), "%s = %s;",
p
->name
, ccval(p
, cc
[p
->sub
]));
for (p
= cchars1
, cnt
= 0; p
->name
; ++p
) {
if (fmt
!= BSD
&& cc
[p
->sub
] == p
->def
)
(void)sprintf(buf1
+ cnt
* 8, WD
, p
->name
);
(void)sprintf(buf2
+ cnt
* 8, WD
, ccval(p
, cc
[p
->sub
]));
if (++cnt
== LINELENGTH
/ 8) {
(void)printf("%s\n", buf1
);
(void)printf("%s\n", buf2
);
(void)printf("%s\n", buf1
);
(void)printf("%s\n", buf2
);
col
= printf("%s: %s", label
, s
);
if ((col
+ strlen(s
)) > LINELENGTH
) {
col
= printf("%s", s
) + 8;
if (c
== _POSIX_VDISABLE
)
if (p
->sub
== VMIN
|| p
->sub
== VTIME
) {
(void)snprintf(buf
, sizeof(buf
), "%d", c
);