Previous | Table of Contents | Next

Page 1048

SEE ALSO

acos(3), asin(3), atan(3), atan2(3), cos(3), sin(3)

8 June 1993

tanh

tanh—Hyperbolic tangent function


SYNOPSIS

#include <math.h>
double tanh(double x);

DESCRIPTION

The tanh() function returns the hyperbolic tangent of x, which is defined mathematically as sinh(x) / cosh(x).

CONFORMS TO

SVID 3, POSIX, BSD 4.3, ISO 9899

SEE ALSO

acosh(3), asinh(3), atanh(3), cosh(3), sinh(3)

13 June 1993

telldir

telldir—Returns current location in directory stream

SYNOPSIS

#include <dirent.h>
off t telldir(DIR *dir);

DESCRIPTION

The telldir() function returns the current location associated with the directory stream dir.

RETURN VALUE

The telldir() function returns the current location in the directory stream or _1 if an error occurs.

ERRORS

EBADF Invalid directory stream descriptor dir

CONFORMS TO

BSD 4.3

SEE ALSO

opendir(3), readdir(3), closedir(3), rewinddir(3), seekdir(3), scandir(3)

31 March 1993

Page 1049

tempnam

tempnam—Creates a name for a temporary file

SYNOPSIS

#include <stdio.h>
char *tempnam(const char *dir, const char *pfx);

DESCRIPTION

The tempnam() function generates a unique temporary filename using up to five characters of pfx, if it is not NULL. The directory to place the file is searched for in the following order:

  1. The directory specified by the environment variable TMPDIR, if it is writable
  2. The directory specified by the argument dir, if it is not NULL
  3. The directory specified by P_tmpdir
  4. The directory \tmp

The storage for the filename is allocated by malloc(), and so can be freed by the function free().

RETURN VALUE

The tempnam() function returns a pointer to the unique temporary filename, or NULL if a unique filename cannot be generated.

ERRORS

EEXIST Unable to generate a unique filename

CONFORMS TO

SVID 3, BSD 4.3

SEE ALSO

mktemp(3), mkstemp(3), tmpnam(3), tmpfile(3)

GNU, 3 April 1993

termios, tcgetattr, tcsetattr, tcsendbreak, tcdrain, tcflush,
tcflow, cfmakeraw, cfgetospeed, cfgetispeed, cfsetispeed,
cfsetospeed, tcgetpgrp, tcsetpgrp

termios, tcgetattr, tcsetattr, tcsendbreak, tcdrain, tcflush, tcflow, cfmakeraw, cfgetospeed, cfgetispeed, cfsetispeed, cfsetospeed, tcgetpgrp, tcsetpgrp—Get and set terminal attributes, line control, get and set baud rate, get and set terminal foreground process group ID

SYNOPSIS

#include <termios.h>
#include <unistd.h>

int tcgetattr ( int fd, struct termios *termios_p );
int tcsetattr ( int fd,int optional_actions, struct termios *termios_p );
int tcsendbreak ( int fd,int duration );
int tcdrain ( int fd );
int tcflush ( int fd,int queue_selector );

Page 1050

int tcflow ( int fd,int action );
int cfmakeraw ( struct termios *termios_p );
speed_t cfgetospeed ( struct termios *termios_p );
int cfsetospeed ( struct termios *termios_p, speed_t speed );
speed_t cfgetispeed ( struct termios *termios_p );
int cfsetispeed ( struct termios *termios_p, speed_t speed );
pid_t tcgetpgrp ( int fd );
int tcsetpgrp ( int fd, pid_t pgrpid );

DESCRIPTION

The termios functions describe a general terminal interface that is provided to control asynchronous communications ports.

Many of the functions described here have a termios_p argument that is a pointer to a termios structure. This structure contains the following members:

tcflag_t c_iflag; /* input modes */
tcflag_t c_oflag; /* output modes */
tcflag_t c_cflag; /* control modes */
tcflag_t c_lflag;/*localmodes*/
cc_t c_cc[NCCS]; /* control chars */

The c_iflag flag constants are

IGNBRK Ignore BREAK condition on input.
BRKINT If IGNBRK is not set, generate SIGINT on BREAK condition, else read BREAK as character \0.
IGNPAR Ignore framing errors and parity errors.
PARMRK If IGNPAR is not set, prefix a character with a parity error or framing error with \377 \0. If neither IGNPAR nor PARMRK is set, read a character with a parity error or framing error as \0.
INPCK Enable input parity checking.
ISTRIP Strip off eighth bit.
INLCR Translate NL to CR on input.
IGNCR Ignore carriage return on input.
ICRNL Translate carriage return to newline on input (unless IGNCR is set).
IUCLC Map uppercase characters to lowercase on input.
IXON Enable XON/XOFF flow control on output.
IXANY Enable any character to restart output.
IXOFF Enable XON/XOFF flow control on input.
IMAXBEL Ring bell when input queue is full.

The c_oflag flag constants are

OPOST Enable implementation-defined output processing.
OLCUC Map lowercase characters to uppercase on output.
ONLCR Map NL to CR-NL on output.
OCRNL Map CR to NL on output.
ONOCR Don't output CR at column 0.
ONLRET Don't output CR.
OFILL Send fill characters for a delay, rather than using a timed delay.
OFDEL Fill character is ASCII DEL. If unset, fill character is ASCII NUL.
NLDLY Newline delay mask. Values are NL0 and NL1.
CRDLY Carriage return delay mask. Values are CR0, CR1, CR2,or CR3.

Page 1051

TABDLY Horizontal tab delay mask. Values are TAB0, TAB1, TAB2, TAB3, or XTABS. A value of XTABS expands tabs to spaces (with tab stops every eight columns).
BSDLY Backspace delay mask. Values are BS0 or BS1.
VTDLY Vertical tab delay mask. Values are VT0 or VT1.
FFDLY Form feed delay mask. Values are FF0 or FF1.

The c_cflag flag constants are

CSIZE Character size mask. Values are CS5, CS6, CS7,or CS8.
CSTOPB Set two stop bits, rather than one.
CREAD Enable receiver.
PARENB Enable parity generation on output and parity checking for input.
PARODD Parity for input and output is odd.
HUPCL Lower modem control lines after last process closes the device (hang up).
CLOCAL Ignore modem control lines.
CIBAUD Mask for input speeds (not used).
CRTSCTS Flow control.

The c_lflag flag constants are

ISIG When any of the characters INTR, QUIT, SUSP, or DSUSP are received, generate the corresponding signal.
ICANON Enable canonical mode. This enables the special characters EOF, EOL, EOL2, ERASE, KILL, REPRINT, STATUS, and WERASE, and buffers by lines.
XCASE If ICANON is also set, terminal is uppercase only. Input is converted to lowercase, except for characters preceded by \. On output, uppercase characters are preceded by \ and lowercase characters are converted to uppercase.
ECHO echo input characters.
ECHOE If ICANON is also set, the ERASE character erases the preceding input character, and WERASE erases the preceding word.
ECHOK If ICANON is also set, the KILL character erases the current line.
ECHONL If ICANON is also set, echo the NL character even if ECHO is not set.
ECHOCTL If ECHO is also set, ASCII control signals other than TAB, NL, START, and STOP are echoed as ^X, where X is the character with ASCII code 0x10 greater than the control signal. For example, character 0x28 (BS) is echoed as ^H.
ECHOPRT If ICANON and IECHO are also set, characters are printed as they are being erased.
ECHOKE If ICANON is also set, KILL is echoed by erasing each character on the line, as specified by ECHOE and ECHOPRT.
FLUSHO Output is being flushed. This flag is toggled by typing the DISCARD character.
NOFLSH Disable flushing the input and output queues when generating the SIGINT and SIGQUIT signals, and flushing the input queue when generating the SIGSUSP signal.
TOSTOP Send the SIGTTOU signal to the process group of a background process that tries to write to its controlling terminal.
PENDIN All characters in the input queue are reprinted when the next character is read. (bash handles typeahead this way.)
IEXTEN Enable implementation-defined input processing.

tcgetattr() gets the parameters associated with the object referred by fd and stores them in the termios structure referenced by termios_p. This function may be invoked from a background process; however, the terminal attributes may be subsequently changed by a foreground process.

Previous | Table of Contents | Next

1