~ubuntu-branches/debian/sid/ncurses/sid-200908151531

« back to all changes in this revision

Viewing changes to ncurses/tinfo/lib_baudrate.c

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Baumann
  • Date: 2008-11-05 21:34:00 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20081105213400-7d9r3jj2ngz18k24
Tags: 5.7-1
* Merging upstream version 5.7.
* Updating soname and sodepver to 5.7 in rules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/****************************************************************************
2
 
 * Copyright (c) 1998-2008,2009 Free Software Foundation, Inc.              *
 
2
 * Copyright (c) 1998-2007,2008 Free Software Foundation, Inc.              *
3
3
 *                                                                          *
4
4
 * Permission is hereby granted, free of charge, to any person obtaining a  *
5
5
 * copy of this software and associated documentation files (the            *
38
38
 */
39
39
 
40
40
#include <curses.priv.h>
 
41
#include <term.h>               /* cur_term, pad_char */
41
42
#include <termcap.h>            /* ospeed */
42
43
#if defined(__FreeBSD__)
43
44
#include <sys/param.h>
79
80
#undef USE_OLD_TTY
80
81
#endif /* USE_OLD_TTY */
81
82
 
82
 
MODULE_ID("$Id: lib_baudrate.c,v 1.29 2009/02/21 17:22:13 tom Exp $")
 
83
MODULE_ID("$Id: lib_baudrate.c,v 1.27 2008/06/28 15:19:24 tom Exp $")
83
84
 
84
85
/*
85
86
 *      int
194
195
}
195
196
 
196
197
NCURSES_EXPORT(int)
197
 
NCURSES_SP_NAME(baudrate) (NCURSES_SP_DCL0)
 
198
baudrate(void)
198
199
{
199
200
    int result;
200
201
 
201
 
    T((T_CALLED("baudrate(%p)"), SP_PARM));
 
202
    T((T_CALLED("baudrate()")));
202
203
 
203
204
    /*
204
205
     * In debugging, allow the environment symbol to override when we're
206
207
     * that take into account costs that depend on baudrate.
207
208
     */
208
209
#ifdef TRACE
209
 
    if (IsValidTIScreen(SP_PARM)
210
 
        && !isatty(fileno(SP_PARM ? SP_PARM->_ofp : stdout))
 
210
    if (!isatty(fileno(SP ? SP->_ofp : stdout))
211
211
        && getenv("BAUDRATE") != 0) {
212
212
        int ret;
213
213
        if ((ret = _nc_getenv_num("BAUDRATE")) <= 0)
217
217
    }
218
218
#endif
219
219
 
220
 
    if (IsValidTIScreen(SP_PARM)) {
 
220
    if (cur_term != 0) {
221
221
#ifdef USE_OLD_TTY
222
 
        result = cfgetospeed(&(TerminalOf(SP_PARM)->Nttyb));
 
222
        result = cfgetospeed(&cur_term->Nttyb);
223
223
        ospeed = _nc_ospeed(result);
224
224
#else /* !USE_OLD_TTY */
225
225
#ifdef TERMIOS
226
 
        ospeed = cfgetospeed(&(TerminalOf(SP_PARM)->Nttyb));
 
226
        ospeed = cfgetospeed(&cur_term->Nttyb);
227
227
#else
228
 
        ospeed = TerminalOf(SP_PARM)->Nttyb.sg_ospeed;
 
228
        ospeed = cur_term->Nttyb.sg_ospeed;
229
229
#endif
230
230
        result = _nc_baudrate(ospeed);
231
231
#endif
232
 
        TerminalOf(SP_PARM)->_baudrate = result;
 
232
        cur_term->_baudrate = result;
233
233
    } else {
234
234
        result = ERR;
235
235
    }
236
236
 
237
237
    returnCode(result);
238
238
}
239
 
 
240
 
#if NCURSES_SP_FUNCS
241
 
NCURSES_EXPORT(int)
242
 
baudrate(void)
243
 
{
244
 
    return NCURSES_SP_NAME(baudrate) (CURRENT_SCREEN);
245
 
}
246
 
#endif