diff options
author | ache <ache@FreeBSD.org> | 1995-08-05 21:22:07 +0000 |
---|---|---|
committer | ache <ache@FreeBSD.org> | 1995-08-05 21:22:07 +0000 |
commit | 100e6f311c5d20fdb09afe48750d3d733c8b8e45 (patch) | |
tree | 84255860ff0aa7fd3bacde0ab4494a6ab882406e /lib/libtermcap/tospeed.c | |
parent | c426abc4240ef56049117a4cc11d9db6a62c0db1 (diff) | |
download | FreeBSD-src-100e6f311c5d20fdb09afe48750d3d733c8b8e45.zip FreeBSD-src-100e6f311c5d20fdb09afe48750d3d733c8b8e45.tar.gz |
Do a little trick which covers 99% cases: initialize ospeed
variable directly in tgetent by stderr or stdout output speed.
It helps hide in non-standard __set_ospeed function and remove it
from other sources (coming soon).
Do prototype cleanup too.
Diffstat (limited to 'lib/libtermcap/tospeed.c')
-rw-r--r-- | lib/libtermcap/tospeed.c | 47 |
1 files changed, 24 insertions, 23 deletions
diff --git a/lib/libtermcap/tospeed.c b/lib/libtermcap/tospeed.c index 89c37aa..dd2026a 100644 --- a/lib/libtermcap/tospeed.c +++ b/lib/libtermcap/tospeed.c @@ -24,42 +24,43 @@ * SUCH DAMAGE. */ -extern short ospeed; +#include <termios.h> +#include "termcap.h" static struct stable { - long speed; + speed_t speed; short code; } table[] = { - {115200,17}, - {57600, 16}, - {38400, 15}, - {19200, 14}, - {9600, 13}, - {4800, 12}, - {2400, 11}, - {1800, 10}, - {1200, 9}, - {600, 8}, - {300, 7}, - {200, 6}, - {150, 5}, - {134, 4}, - {110, 3}, - {75, 2}, - {50, 1}, - {0, 0}, + {B115200,17}, + {B57600, 16}, + {B38400, 15}, + {B19200, 14}, + {B9600, 13}, + {B4800, 12}, + {B2400, 11}, + {B1800, 10}, + {B1200, 9}, + {B600, 8}, + {B300, 7}, + {B200, 6}, + {B150, 5}, + {B134, 4}, + {B110, 3}, + {B75, 2}, + {B50, 1}, + {B0, 0}, {-1, -1} }; -void _set_ospeed(long speed) +void __set_ospeed(speed_t speed) { struct stable *stable; - if (speed == 0) { + if (speed == B0) { ospeed = 0; return; } - for (stable = table; stable->speed > 0; stable++) { + for (stable = table; stable->speed > B0; stable++) { /* nearest one, rounded down */ if (stable->speed <= speed) { ospeed = stable->code; |