From 3097328edf0de7ed793760a43fe341b9a3c1175c Mon Sep 17 00:00:00 2001 From: ache Date: Mon, 12 Dec 1994 06:14:42 +0000 Subject: Fix includes, tputs argument, ospeed setting, printing attributes started with 'l' --- usr.bin/tput/tput.c | 42 +++++++++++++++++++++++++++++++++++------- 1 file changed, 35 insertions(+), 7 deletions(-) (limited to 'usr.bin/tput/tput.c') diff --git a/usr.bin/tput/tput.c b/usr.bin/tput/tput.c index cfc5be6..938f94a 100644 --- a/usr.bin/tput/tput.c +++ b/usr.bin/tput/tput.c @@ -41,14 +41,15 @@ static char copyright[] = static char sccsid[] = "@(#)tput.c 8.2 (Berkeley) 3/19/94"; #endif /* not lint */ -#include +#include #include -#include +#include #include #include #include +#undef putchar #define outc putchar static void prlongname __P((char *)); @@ -95,9 +96,11 @@ errx(2, "no terminal type specified and no TERM environmental variable."); p = "is"; break; case 'l': - if (!strcmp(p, "longname")) + if (!strcmp(p, "longname")) { prlongname(tbuf); - continue; + continue; + } + break; case 'r': if (!strcmp(p, "reset")) p = "rs"; @@ -202,14 +205,39 @@ process(cap, str, argv) static void setospeed() { -#undef ospeed - extern short ospeed; struct termios t; if (tcgetattr(STDOUT_FILENO, &t) != -1) ospeed = 0; else - ospeed = cfgetospeed(&t); + switch(cfgetospeed(&t)) { + case B0: ospeed = 0; break; + case B50: ospeed = 1; break; + case B75: ospeed = 2; break; + case B110: ospeed = 3; break; + case B134: ospeed = 4; break; + case B150: ospeed = 5; break; + case B200: ospeed = 6; break; + case B300: ospeed = 7; break; + case B600: ospeed = 8; break; + case B1200: ospeed = 9; break; + case B1800: ospeed = 10; break; + case B2400: ospeed = 11; break; + case B4800: ospeed = 12; break; + case B9600: ospeed = 13; break; +#ifdef EXTA + case EXTA: ospeed = 14; break; +#endif +#ifdef EXTB + case EXTB: ospeed = 15; break; +#endif +#ifdef B57600 + case B57600: ospeed = 16; break; +#endif +#ifdef B115200 + case B115200: ospeed = 17; break; +#endif + } } static void -- cgit v1.1