X-Git-Url: http://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=ncurses%2Ftinfo%2Flib_ttyflags.c;h=3faa3ad8f0aeee861744daf29d23cc7f2517111a;hp=43bed3536cfc1d63c32d29ecedec1031394e6419;hb=62ca6190a9a8ddccb2c4d5ca7b2ef9f88432da65;hpb=c885a3fdd089f784f17dd2e9c03d8eb774072dc9;ds=sidebyside diff --git a/ncurses/tinfo/lib_ttyflags.c b/ncurses/tinfo/lib_ttyflags.c index 43bed353..3faa3ad8 100644 --- a/ncurses/tinfo/lib_ttyflags.c +++ b/ncurses/tinfo/lib_ttyflags.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2012,2014 Free Software Foundation, Inc. * + * Copyright (c) 1998-2014,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 * @@ -41,42 +41,42 @@ #define CUR SP_TERMTYPE #endif -MODULE_ID("$Id: lib_ttyflags.c,v 1.30 2014/04/26 18:47:20 juergen Exp $") +MODULE_ID("$Id: lib_ttyflags.c,v 1.31 2016/12/24 21:41:24 tom Exp $") NCURSES_EXPORT(int) NCURSES_SP_NAME(_nc_get_tty_mode) (NCURSES_SP_DCLx TTY * buf) { + TERMINAL *termp = TerminalOf(SP_PARM); int result = OK; - if (buf == 0 || SP_PARM == 0) { + if (buf == 0 || termp == 0) { result = ERR; } else { - TERMINAL *termp = TerminalOf(SP_PARM); - if (0 == termp) { - result = ERR; - } else { #ifdef USE_TERM_DRIVER + if (SP_PARM != 0) { result = CallDriver_2(SP_PARM, td_sgmode, FALSE, buf); + } else { + result = ERR; + } #else - for (;;) { - if (GET_TTY(termp->Filedes, buf) != 0) { - if (errno == EINTR) - continue; - result = ERR; - } - break; + for (;;) { + if (GET_TTY(termp->Filedes, buf) != 0) { + if (errno == EINTR) + continue; + result = ERR; } -#endif + break; } - - if (result == ERR) - memset(buf, 0, sizeof(*buf)); +#endif TR(TRACE_BITS, ("_nc_get_tty_mode(%d): %s", termp ? termp->Filedes : -1, _nc_trace_ttymode(buf))); } + if (result == ERR && buf != 0) + memset(buf, 0, sizeof(*buf)); + return (result); }