Added more baudrates, added missing defs for MacOS

This commit is contained in:
Simon Duquennoy 2015-08-20 10:40:23 +02:00
parent 55d81ddd3a
commit 88118482a8

View File

@ -56,6 +56,50 @@
#include <err.h> #include <err.h>
#if __APPLE__
#ifndef B460800
#define B460800 460800
#endif
#ifndef B500000
#define B500000 500000
#endif
#ifndef B576000
#define B576000 576000
#endif
#ifndef B921600
#define B921600 921600
#endif
#ifndef B1000000
#define B1000000 1000000
#endif
#ifndef B1152000
#define B1152000 1152000
#endif
#ifndef B1500000
#define B1500000 1500000
#endif
#ifndef B2000000
#define B2000000 2000000
#endif
#ifndef B2500000
#define B2500000 2500000
#endif
#ifndef B3000000
#define B3000000 3000000
#endif
#ifndef B3500000
#define B3500000 3500000
#endif
#ifndef B4000000
#define B4000000 4000000
#endif
#endif
#ifndef BAUDRATE
#define BAUDRATE B115200
#endif
speed_t b_rate = BAUDRATE;
int verbose = 1; int verbose = 1;
const char *ipaddr; const char *ipaddr;
const char *netmask; const char *netmask;
@ -488,11 +532,6 @@ tun_to_serial(int infd, int outfd)
return size; return size;
} }
#ifndef BAUDRATE
#define BAUDRATE B115200
#endif
speed_t b_rate = BAUDRATE;
void void
stty_telos(int fd) stty_telos(int fd)
{ {
@ -878,40 +917,155 @@ exit(1);
switch(baudrate) { switch(baudrate) {
case -2: case -2:
break; /* Use default. */ break; /* Use default. */
#ifdef B50
case 50:
b_rate = B50;
break;
#endif
#ifdef B75
case 75:
b_rate = B75;
break;
#endif
#ifdef B110
case 110:
b_rate = B110;
break;
#endif
#ifdef B134
case 134:
b_rate = B134;
break;
#endif
#ifdef B150
case 150:
b_rate = B150;
break;
#endif
#ifdef B200
case 200:
b_rate = B200;
break;
#endif
#ifdef B300
case 300:
b_rate = B300;
break;
#endif
#ifdef B600
case 600:
b_rate = B600;
break;
#endif
#ifdef B1200
case 1200:
b_rate = B1200;
break;
#endif
#ifdef B1800
case 1800:
b_rate = B1800;
break;
#endif
#ifdef B2400
case 2400:
b_rate = B2400;
break;
#endif
#ifdef B4800
case 4800:
b_rate = B4800;
break;
#endif
#ifdef B9600
case 9600: case 9600:
b_rate = B9600; b_rate = B9600;
break; break;
#endif
#ifdef B19200
case 19200: case 19200:
b_rate = B19200; b_rate = B19200;
break; break;
#endif
#ifdef B38400
case 38400: case 38400:
b_rate = B38400; b_rate = B38400;
break; break;
#endif
#ifdef B57600
case 57600: case 57600:
b_rate = B57600; b_rate = B57600;
break; break;
#endif
#ifdef B115200
case 115200: case 115200:
b_rate = B115200; b_rate = B115200;
break; break;
#endif
#ifdef B230400
case 230400: case 230400:
b_rate = B230400; b_rate = B230400;
break; break;
#ifndef __APPLE__ #endif
#ifdef B460800
case 460800: case 460800:
b_rate = B460800; b_rate = B460800;
break; break;
#endif
#ifdef B500000
case 500000: case 500000:
b_rate = B500000; b_rate = B500000;
break; break;
#endif
#ifdef B576000
case 576000: case 576000:
b_rate = B576000; b_rate = B576000;
break; break;
#endif
#ifdef B921600
case 921600: case 921600:
b_rate = B921600; b_rate = B921600;
break; break;
#endif
#ifdef B1000000
case 1000000: case 1000000:
b_rate = B1000000; b_rate = B1000000;
break; break;
#endif
#ifdef B1152000
case 1152000:
b_rate = B1152000;
break;
#endif
#ifdef B1500000
case 1500000:
b_rate = B1500000;
break;
#endif
#ifdef B2000000
case 2000000:
b_rate = B2000000;
break;
#endif
#ifdef B2500000
case 2500000:
b_rate = B2500000;
break;
#endif
#ifdef B3000000
case 3000000:
b_rate = B3000000;
break;
#endif
#ifdef B3500000
case 3500000:
b_rate = B3500000;
break;
#endif
#ifdef B4000000
case 4000000:
b_rate = B4000000;
break;
#endif #endif
default: default:
err(1, "unknown baudrate %d", baudrate); err(1, "unknown baudrate %d", baudrate);