Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ cfgetospeed(3C) — CX/UX 6.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

tcsetattr(3P)

termios(7)

cfgetospeed(3C)

NAME

cfgetospeed, cfsetospeed, cfgetispeed, cfsetispeed − Get or set input or output baud rate values in termios structure

SYNOPSIS

#include <termios.h>

speed_t cfgetospeed (termios_p)
struct termios ∗termios_p;

int cfsetospeed (termios_p, speed)
struct termios ∗termios_p;
speed_t speed;

speed_t cfgetispeed (termios_p)
struct termios ∗termios_p;

speed_t cfsetispeed (termios_p, speed)
struct termios ∗termios_p;
speed_t speed;

DESCRIPTION

The cfgetospeed(), cfsetospeed(), cfgetispeed(), and cfsetispeed() functions are defined in the POSIX 1003.1 standard and used in the 88open OCS and BCS standards.  CX/UX applications which are not POSIX/OCS/BCS compliant can use these functions. 

The argument termios_p points to a termios structure defined within the user program and the argument speed refers to one of the baud rate values (B1200, B9600, etc.) defined in the header file <termios.h>.  The type speed_t and the termios structure are also defined in <termios.h>.  The effects on the terminal device as a result of one of these functions do not become effective until the tcsetattr function is successfully called passing the modified termios structure to the system. 

Cfgetospeed returns the output baud rate stored in the termios structure pointed to by termios_p. 

Cfsetospeed sets the output baud rate stored in the termios structure pointed to by termios_p to speed .  A connection may be terminated by assigning B0, the zero baud rate, to speed.  In this case, the modem control lines shall no longer be asserted thus effectively disconnecting the line. 

Cfgetispeed returns the input baud rate stored in the termios structure pointed to by termios_p. 

Cfsetispeed sets the input baud rate stored in the termios structure pointed to by termios_p to speed.  If the input baud rate is set to B0, the input baud rate will be specified by the value of the output baud rate. 

NOTE

CX/UX does not support separate line speeds for terminal devices.  As a result, all references to input speeds actually refer to output speeds.  Therefore, the input rate should be specified by the same value as the output rate when using cfsetispeed.  It is best to use cfsetispeed with speed set to B0 allowing the input rate to be automatically specified by the value of the output baud rate.  This assumes that cfsetospeed has been previously called.  If both input and output baud rates do not match, the tcsetattr function call will fail with errno set to ­[EINVAL]. 

SEE ALSO

tcsetattr(3P), termios(7)

DIAGNOSTICS

Cfsetispeed and cfsetospeed will return one of the following values:  0 indicating that the call succeeded or -1 if speed does not match one of the baud rate values specified in <termios.h>.  Errno will not be set.  Cfgetispeed and cfgetospeed do not return any diagnostics. 

CX/UX Programmer’s Reference Manual

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026