Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Reference > S


HP-UX 11i Version 3: February 2007

Technical documentation

» Feedback
Content starts here

 » Table of Contents

 » Index


sttyv6: stty — terminal interface for Version 6/PWB compatibility


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 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:


When the stty 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 (ioctl TIOCGETP) command is executed, the termio 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.


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. 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.


stty(2), termio(7).

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1983-2007 Hewlett-Packard Development Company, L.P.