HPlogo HP-UX Reference Volume 5 of 5 > s

sttyv6(7)

» 

Technical documentation

Complete book in PDF

 » Table of Contents

 » Index

NAME

stty — terminal interface for Version 6/PWB compatibility

REMARKS

These facilities are included to aid in conversion of old programs, and should not be used in new code. Use the interface described in termio(7). Note that these conversions do not work for programs ported from UNIX Time-Sharing System, Seventh Edition (Version 7), because some V7 flags are defined differently.

DESCRIPTION

These routines attempt to map the UNIX Time-Sharing System, Sixth Edition (Version 6), and PWB stty and gtty calls into the current ioctls that perform the same functions. The mapping cannot be perfect. The way the features are translated is described below. The reader should be familiar with termio(7) before studying this entry.

The following data structure is defined in the include file <sgtty.h>:

struct sgttyb { char sg_ispeed; /* input speed */ char sg_ospeed; /* output speed */ char sg_erase; /* erase character */ char sg_kill; /* kill character */ int sg_flags; /* mode flags */ }

The flags, as defined in sgtty.h, are:

#define HUPCL01
#define XTABS02
#define LCASE04
#define ECHO010
#define CRMOD020
#define RAW040
#define ODDP0100
#define EVENP0200
#define ANYP0300
#define NLDELAY001400
#define TBDELAY002000
#define CRDELAY030000
#define VTDELAY040000
#define BSDELAY0100000
#define CR00
#define CR1010000
#define CR2020000
#define CR3030000
#define NL00
#define NL1000400
#define NL2001000
#define NL3001400
#define TAB00
#define TAB1002000
#define NOAL004000
#define FF00
#define FF1040000
#define BS00
#define BS10100000

When the stty(2) command (ioctl TIOCSETP) is executed, the flags in the old sgttyb structure are mapped into their new equivalents in the termio structure. Then the TCSETA command is executed.

The following table shows the mapping between the old sgttyb flags and the current termio flags. Note that flags contained in the termio structure that are not mentioned below are cleared.

HUPCL (if set)

sets the termio HUPCL flag;

HUPCL (if clear)

clears the termio HUPCL flag;

XTABS (if set)

sets the termio TAB3 flag;

XTABS (if clear)

clears the termio TAB3 flag;

TBDELAY (if set)

sets the termio TAB1 flag;

TBDELAY (if clear)

clears the termio TAB1 flag;

LCASE (if set)

sets the termio IUCLC, OLCUC, and XCASE flags;

LCASE (if clear)

clears the termio IUCLC, OLCUC, and XCASE flags;

ECHO (if set)

sets the termio ECHO flag;

ECHO (if clear)

clears the termio ECHO flag;

NOAL (if set)

sets the termio ECHOK flag;

NOAL (if clear)

clears the termio ECHOK flag;

CRMOD (if set)

sets the termio ICRNL and ONLCR flags; also, if CR1 is set, the termio CR1 flag is set, and if CR2 is set, the termio ONOCR and CR2 flags are set;

CRMOD (if clear)

sets the termio ONLRET flag; also, if NL1 is set, the termio CR1 flag is set, and if NL2 is set, the termio CR2 flag is set;

RAW (if set)

sets the termio CS8 flag, and clears the termio ICRNL and IUCLC flags; also, default values of 6 characters and 0.1 seconds are assigned to MIN and TIME, respectively;

RAW (if clear)

sets the termio BRKINT, IGNPAR, ISTRIP, IXON, IXANY, OPOST, CS7, PARENB, ICANON, and ISIG flags; also, the default values control-D and null are assigned to the control characters EOF and EOL, respectively;

ODDP (if set)

if EVENP is also set, clears the termio INPCK flag; otherwise, sets the termio PARODD flag;

VTDELAY (if set)

sets the termio FFDLY flag;

VTDELAY (if clear)

clears the termio FFDLY flag;

BSDELAY (if set)

sets the termio BSDLY flag;

BSDELAY (if clear)

clears the termio BSDLY flag.

In addition, the termio CREAD bit is set, and, if the baud rate is 110, the CSTOPB bit is set.

When using TIOCSETP, the ispeed entry in the sgttyb structure is mapped into the appropriate speed in the termio CBAUD field. The erase and kill sgttyb entries are mapped into the termio erase and kill characters.

When the gtty(2) (ioctl TIOCGETP) command is executed, the termio(7) TCGETA command is first executed. The resulting termio structure is then mapped into the sgttyb structure, which is then returned to the user.

The following table shows how the termio flags are mapped into the old sgttyb structure. Note that all flags contained in the sgttyb structure that are not mentioned below are cleared.

HUPCL (if set)

sets the sgttyb HUPCL flag;

HUPCL (if clear)

clears the sgttyb HUPCL flag;

ICANON (if set)

sets the sgttyb RAW flag;

ICANON (if clear)

clears the sgttyb RAW flag;

XCASE (if set)

sets the sgttyb LCASE flag;

XCASE (if clear)

clears the sgttyb LCASE flag;

ECHO (if set)

sets the sgttyb ECHO flag;

ECHO (if clear)

clears the sgttyb ECHO flag;

ECHOK (if set)

sets the sgttyb NOAL flag;

ECHOK (if clear)

clears the sgttyb NOAL flag;

PARODD (if set)

sets the sgttyb ODDP flag;

PARODD (if clear)

clears the sgttyb ODDP flag;

INPCK (if set)

sets the sgttyb EVENP flag;

PARODD, INPCK (if both clear)

sets the sgttyb ODDP and EVENP flags;

ONLCR (if set)

sets the sgttyb CRMOD flag; also, if CR1 is set, the sgttyb CR1 flag is set, and if CR2 is set, the sgttyb CR2 flag is set;

ONLCR (if clear)

if CR1 is set, the sgttyb NL1 flag is set, and if CR2 is set, the sgttyb NL2 flag is set;

TAB3 (if set)

sets the sgttyb XTABS flag;

TAB3 (if clear)

clears the sgttyb XTABS flag;

TAB1 (if set)

sets the sgttyb TBDELAY flag;

TAB1 (if clear)

clears the sgttyb TBDELAY flag;

FFDLY (if set)

sets the sgttyb VTDELAY flag;

FFDLY (if clear)

clears the sgttyb VTDELAY flag;

BSDLY (if set)

sets the sgttyb BSDELAY flag;

BSDLY (if clear)

clears the sgttyb BSDELAY flag.

When using TIOCGETP, the termio CBAUD field is mapped into the ispeed and ospeed entries of the sgttyb structure. Also, the termio erase and kill characters are mapped into the erase and kill sgttyb entries.

Note that, since there is not a one-to-one mapping between the sgttyb and termio structures, unexpected results may occur when using the older TIOCSETP and TIOCGETP calls. Thus, the TIOCSETP and TIOCGETP calls should be replaced in all future code by the current equivalents, TCSETA and TCGETA, respectively.

SEE ALSO

stty(2), termio(7).

© Hewlett-Packard Development Company, L.P.