diff options
author | Michał Łyszczek <michal.lyszczek@bofc.pl> | 2018-05-03 10:59:24 +0200 |
---|---|---|
committer | Michał Łyszczek <michal.lyszczek@bofc.pl> | 2018-05-03 10:59:24 +0200 |
commit | 81896ba4173ab6396b94ce35be26397d597786b5 (patch) | |
tree | 8d0b9d1ad98449e28ad1d4b95848e81a3adff309 | |
parent | 1647ce904341f863112ad5cbe2f58704b2b44a58 (diff) | |
download | embedlog-81896ba4173ab6396b94ce35be26397d597786b5.tar.gz embedlog-81896ba4173ab6396b94ce35be26397d597786b5.tar.bz2 embedlog-81896ba4173ab6396b94ce35be26397d597786b5.zip |
use unsigned int instead of speed_t to prevent compiler error when termios is not available
-rw-r--r-- | src/el-options.c | 4 | ||||
-rw-r--r-- | src/el-private.h | 2 | ||||
-rw-r--r-- | src/el-tty.c | 8 |
3 files changed, 7 insertions, 7 deletions
diff --git a/src/el-options.c b/src/el-options.c index 22b7e1a..9bc9758 100644 --- a/src/el-options.c +++ b/src/el-options.c @@ -314,10 +314,10 @@ static int el_vooption case EL_TTY_DEV: { - speed_t speed; + unsigned int speed; value_str = va_arg(ap, const char *); /* serial tty to open */ - speed = va_arg(ap, speed_t); + speed = va_arg(ap, unsigned int); VALID(EINVAL, value_str); diff --git a/src/el-private.h b/src/el-private.h index c1c2d9b..e81d61c 100644 --- a/src/el-private.h +++ b/src/el-private.h @@ -261,7 +261,7 @@ void el_file_cleanup(struct el_options *options); #if ENABLE_OUT_TTY -int el_tty_open(struct el_options *options, const char *dev, speed_t speed); +int el_tty_open(struct el_options *options, const char *dev, unsigned int speed); int el_tty_puts(struct el_options *options, const char *s); int el_tty_close(struct el_options *options); #endif diff --git a/src/el-tty.c b/src/el-tty.c index 0b0791d..91cdcc1 100644 --- a/src/el-tty.c +++ b/src/el-tty.c @@ -54,11 +54,13 @@ int el_tty_open ( struct el_options *options, /* store serial file descriptor here */ const char *dev, /* device to open like /dev/ttyS0 */ - speed_t speed /* serial port baud rate */ + unsigned int speed /* serial port baud rate */ ) { +#if HAVE_TERMIOS_H struct termios tty; /* serial port settings */ int e; /* holder for errno */ +#endif /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ @@ -100,7 +102,7 @@ int el_tty_open goto error; } - if (cfsetispeed(&tty, speed) != 0) + if (cfsetispeed(&tty, (speed_t)speed) != 0) { goto error; } @@ -129,8 +131,6 @@ error: return -1; #else - (void)tty; - (void)e; return 0; #endif } |