Back to index

tetex-bin  3.0
Classes | Functions | Variables
lib_baudrate.c File Reference
#include <curses.priv.h>
#include <term.h>
#include <termcap.h>

Go to the source code of this file.

Classes

struct  speed

Functions

 _nc_baudrate (int OSpeed)
 _nc_ospeed (int BaudRate)
 baudrate (void)

Variables

static struct speed []

Class Documentation

struct speed

Definition at line 89 of file lib_baudrate.c.

Class Members
int s
int sp

Function Documentation

_nc_baudrate ( int  OSpeed)

Definition at line 142 of file lib_baudrate.c.

{
    static int last_OSpeed;
    static int last_baudrate;

    int result;
    unsigned i;

    if (OSpeed == last_OSpeed) {
       result = last_baudrate;
    } else {
       result = ERR;
       if (OSpeed >= 0) {
           for (i = 0; i < SIZEOF(speeds); i++) {
              if (speeds[i].s == OSpeed) {
                  result = speeds[i].sp;
                  break;
              }
           }
       }
       last_baudrate = result;
    }
    return (result);
}

Here is the caller graph for this function:

_nc_ospeed ( int  BaudRate)

Definition at line 168 of file lib_baudrate.c.

{
    int result = 1;
    unsigned i;

    if (BaudRate >= 0) {
       for (i = 0; i < SIZEOF(speeds); i++) {
           if (speeds[i].sp == BaudRate) {
              result = speeds[i].s;
              break;
           }
       }
    }
    return (result);
}

Here is the caller graph for this function:

baudrate ( void  )

Definition at line 185 of file lib_baudrate.c.

{
    int result;

    T((T_CALLED("baudrate()")));

    /*
     * In debugging, allow the environment symbol to override when we're
     * redirecting to a file, so we can construct repeatable test-cases
     * that take into account costs that depend on baudrate.
     */
#ifdef TRACE
    if (SP && !isatty(fileno(SP->_ofp))
       && getenv("BAUDRATE") != 0) {
       int ret;
       if ((ret = _nc_getenv_num("BAUDRATE")) <= 0)
           ret = 9600;
       ospeed = _nc_ospeed(ret);
       returnCode(ret);
    }
#endif

#ifdef USE_OLD_TTY
    result = cfgetospeed(&cur_term->Nttyb);
    ospeed = _nc_ospeed(result);
#else /* !USE_OLD_TTY */
#ifdef TERMIOS
    ospeed = cfgetospeed(&cur_term->Nttyb);
#else
    ospeed = cur_term->Nttyb.sg_ospeed;
#endif
    result = _nc_baudrate(ospeed);
#endif
    if (cur_term != 0)
       cur_term->_baudrate = result;

    returnCode(result);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

struct speed[] [static]

Definition at line 94 of file lib_baudrate.c.