/* * Specify serial communications speed. * $Id$ * Copyright (c) 1997 by Tycho Softworks. * For conditions of distribution and reuse see product license. */ #include #ifndef TERMIOS_H_MISSING #include #endif int setspeed(stty_t tios, ulong speed) { #ifdef B38400 int rate = B38400; #else int rate = B19200; #endif switch(speed) { case 110: rate = B110; break; case 300: rate = B300; break; case 600: rate = B600; break; case 1200: rate = B1200; break; case 2400: rate = B2400; break; case 4800: rate = B4800; break; case 9600: rate = B9600; break; case 19200: rate = B19200; break; #ifdef B38400 case 38400: rate = B38400; break; #endif #ifdef B57600 case 57600: rate = B57600; break; #endif #ifdef B115200 case 115200: rate = B115200; break; #endif } #ifndef TERMIOS_H_MISSING cfsetospeed(tios, rate); cfsetispeed(tios, rate); #endif return rate; }