X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Flib_baudrate.c;h=9a425c69331081018df2b0f88fd7163cd37fe464;hp=252d03c593d8fcb11cc71d13ca4fddde69379001;hb=76a479337308b4b5e749fa8c38b7b7f482998c5b;hpb=cc387b11f421650091d84640e05825ea5161ac66;ds=sidebyside diff --git a/ncurses/tinfo/lib_baudrate.c b/ncurses/tinfo/lib_baudrate.c index 252d03c5..9a425c69 100644 --- a/ncurses/tinfo/lib_baudrate.c +++ b/ncurses/tinfo/lib_baudrate.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2010,2013 Free Software Foundation, Inc. * + * Copyright (c) 1998-2015,2016 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -49,7 +49,7 @@ * of the indices up to B115200 fit nicely in a 'short', allowing us to retain * ospeed's type for compatibility. */ -#if NCURSES_OSPEED_COMPAT && ((defined(__FreeBSD__) && (__FreeBSD_version < 700000)) || defined(__NetBSD__) || defined(__OpenBSD__)) +#if NCURSES_OSPEED_COMPAT && ((defined(__FreeBSD__) && (__FreeBSD_version < 700000)) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)) #undef B0 #undef B50 #undef B75 @@ -79,7 +79,7 @@ #undef USE_OLD_TTY #endif /* USE_OLD_TTY */ -MODULE_ID("$Id: lib_baudrate.c,v 1.34 2013/12/15 01:29:02 tom Exp $") +MODULE_ID("$Id: lib_baudrate.c,v 1.38 2016/05/28 23:22:52 tom Exp $") /* * int @@ -151,7 +151,6 @@ _nc_baudrate(int OSpeed) #endif int result = ERR; - unsigned i; #if !USE_REENTRANT if (OSpeed == last_OSpeed) { @@ -160,8 +159,10 @@ _nc_baudrate(int OSpeed) #endif if (result == ERR) { if (OSpeed >= 0) { + unsigned i; + for (i = 0; i < SIZEOF(speeds); i++) { - if (speeds[i].s == OSpeed) { + if ((int) speeds[i].s == OSpeed) { result = speeds[i].sp; break; } @@ -181,9 +182,10 @@ NCURSES_EXPORT(int) _nc_ospeed(int BaudRate) { int result = 1; - unsigned i; if (BaudRate >= 0) { + unsigned i; + for (i = 0; i < SIZEOF(speeds); i++) { if (speeds[i].sp == BaudRate) { result = speeds[i].s; @@ -208,7 +210,7 @@ NCURSES_SP_NAME(baudrate) (NCURSES_SP_DCL0) */ #ifdef TRACE if (IsValidTIScreen(SP_PARM) - && !isatty(fileno(SP_PARM ? SP_PARM->_ofp : stdout)) + && !NC_ISATTY(fileno(SP_PARM ? SP_PARM->_ofp : stdout)) && getenv("BAUDRATE") != 0) { int ret; if ((ret = _nc_getenv_num("BAUDRATE")) <= 0)