Back to index

glibc  2.9
termios.h
Go to the documentation of this file.
00001 /* termios type and macro definitions.  SunOS 4 version.
00002    Copyright (C) 1993, 1994, 1996, 1997 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #ifndef _TERMIOS_H
00021 # error "Never include <bits/termios.h> directly; use <termios.h> instead."
00022 #endif
00023 
00024 /* Type of terminal control flag masks.  */
00025 typedef unsigned long int tcflag_t;
00026 
00027 /* Type of control characters.  */
00028 typedef unsigned char cc_t;
00029 
00030 /* Type of baud rate specifiers.  */
00031 typedef unsigned int speed_t;
00032 
00033 /* Terminal control structure.  */
00034 struct termios
00035 {
00036   /* Input modes.  */
00037   tcflag_t c_iflag;
00038 #define       IGNBRK 0x0001        /* Ignore break condition.  */
00039 #define       BRKINT 0x0002        /* Signal interrupt on break.  */
00040 #define       IGNPAR 0x0004        /* Ignore characters with parity errors.  */
00041 #define       PARMRK 0x0008        /* Mark parity and framing errors.  */
00042 #define       INPCK  0x0010        /* Enable input parity check.  */
00043 #define       ISTRIP 0x0020        /* Strip 8th bit off characters.  */
00044 #define       INLCR  0x0040        /* Map NL to CR on input.  */
00045 #define       IGNCR  0x0080        /* Ignore CR.  */
00046 #define       ICRNL  0x0100        /* Map CR to NL on input.  */
00047 #ifdef __USE_BSD
00048 # define IUCLC       0x0200        /* Map upper case to lower case on input.  */
00049 #endif
00050 #define       IXON   0x0400        /* Enable start/stop output control.  */
00051 #define       IXOFF  0x1000        /* Enable start/stop input control.  */
00052 #ifdef __USE_BSD
00053 # define IXANY       0x0800        /* Any character will restart after stop.  */
00054 # define IMAXBEL     0x2000        /* Ring bell when input queue is full.  */
00055 #endif
00056 
00057   /* Output modes.  */
00058   tcflag_t c_oflag;
00059 #define       OPOST  0x0001        /* Perform output processing.  */
00060 #ifdef __USE_BSD
00061 # define OLCUC       0x00000002    /* Map lower case to upper case on output.  */
00062 # define ONLCR       0x00000004    /* Map NL to CR-NL on output.  */
00063 # define OCRNL       0x00000008
00064 # define ONOCR       0x00000010
00065 # define ONLRET      0x00000020
00066 # define OFILL       0x00000040
00067 # define OFDEL       0x00000080
00068 # define NLDLY       0x00000100
00069 # define NL0  0
00070 # define NL1  0x00000100
00071 # define CRDLY       0x00000600
00072 # define CR0  0
00073 # define CR1  0x00000200
00074 # define CR2  0x00000400
00075 # define CR3  0x00000600
00076 # define TABDLY      0x00001800
00077 # define TAB0 0
00078 # define TAB1 0x00000800
00079 # define TAB2 0x00001000
00080 # define XTABS       0x00001800
00081 # define TAB3 XTABS
00082 # define BSDLY       0x00002000
00083 # define BS0  0
00084 # define BS1  0x00002000
00085 # define VTDLY       0x00004000
00086 # define VT0  0
00087 # define VT1  0x00004000
00088 # define FFDLY       0x00008000
00089 # define FF0  0
00090 # define FF1  0x00008000
00091 # define PAGEOUT 0x00010000
00092 # define WRAP 0x00020000
00093 #endif
00094 
00095   /* Control modes.  */
00096   tcflag_t c_cflag;
00097 #define       CSIZE  (CS5|CS6|CS7|CS8) /* Number of bits per byte (mask).  */
00098 #define       CS5    0             /* 5 bits per byte.  */
00099 #define       CS6    0x00000010    /* 6 bits per byte.  */
00100 #define       CS7    0x00000020    /* 7 bits per byte.  */
00101 #define       CS8    0x00000030    /* 8 bits per byte.  */
00102 #define       CSTOPB 0x00000040    /* Two stop bits instead of one.  */
00103 #define       CREAD  0x00000080    /* Enable receiver.  */
00104 #define       PARENB 0x00000100    /* Parity enable.  */
00105 #define       PARODD 0x00000200    /* Odd parity instead of even.  */
00106 #define       HUPCL  0x00000400    /* Hang up on last close.  */
00107 #define       CLOCAL 0x00000800    /* Ignore modem status lines.  */
00108 #ifdef __USE_BSD
00109 # define LOBLK       0x00001000
00110 # define CRTSCTS     0x80000000
00111 # define CIBAUD      0x000f0000    /* Mask for input speed from c_cflag.  */
00112 # define CBAUD       0x0000000f    /* Mask for output speed from c_cflag.  */
00113 # define IBSHIFT     16            /* Bits to shift for input speed.  */
00114 #endif
00115 
00116   /* Input and output baud rates.  These are encoded in c_cflag.  */
00117 #define B0      0
00118 #define B50     1
00119 #define B75     2
00120 #define B110    3
00121 #define B134    4
00122 #define B150    5
00123 #define B200    6
00124 #define B300    7
00125 #define B600    8
00126 #define B1200   9
00127 #define B1800   10
00128 #define B2400   11
00129 #define B4800   12
00130 #define B9600   13
00131 #define B19200  14
00132 #define B38400  15
00133 #ifdef __USE_BSD
00134 # define EXTA   14
00135 # define EXTB   15
00136 #endif
00137 
00138   /* Local modes.  */
00139   tcflag_t c_lflag;
00140 #ifdef __USE_BSD
00141 # define ECHOKE      0x00000800    /* Visual erase for KILL.  */
00142 #endif
00143 #define       ECHOE  0x00000010    /* Visual erase for ERASE.  */
00144 #define       ECHOK  0x00000020    /* Echo NL after KILL.  */
00145 #define       ECHO   0x00000008    /* Enable echo.  */
00146 #define       ECHONL 0x00000040    /* Echo NL even if ECHO is off.  */
00147 #ifdef __USE_BSD
00148 # define ECHOPRT     0x00000400    /* Hardcopy visual erase.  */
00149 # define ECHOCTL     0x00000200    /* Echo control characters as ^X.  */
00150 #endif
00151 #define       ISIG   0x00000001    /* Enable signals.  */
00152 #define       ICANON 0x00000002    /* Do erase and kill processing.  */
00153 #define       IEXTEN 0x00008000    /* Enable DISCARD and LNEXT.  */
00154 #define       TOSTOP 0x00000100    /* Send SIGTTOU for background output.  */
00155 #ifdef __USE_BSD
00156 # define PENDIN      0x00004000    /* Retype pending input (state).  */
00157 #endif
00158 #define       NOFLSH 0x00000080    /* Disable flush after interrupt.  */
00159 
00160   char c_line;                     /* Line discipline (?) */
00161 
00162   /* Control characters.  */
00163 #define       VEOF   4             /* End-of-file character [ICANON].  */
00164 #define       VEOL   5             /* End-of-line character [ICANON].  */
00165 #ifdef __USE_BSD
00166 # define VEOL2       6             /* Second EOL character [ICANON].  */
00167 # define VSWTCH      7             /* ??? */
00168 #endif
00169 #define       VERASE 2             /* Erase character [ICANON].  */
00170 #ifdef __USE_BSD
00171 # define VWERASE     14            /* Word-erase character [ICANON].  */
00172 #endif
00173 #define       VKILL  3             /* Kill-line character [ICANON].  */
00174 #ifdef __USE_BSD
00175 # define VREPRINT 12        /* Reprint-line character [ICANON].  */
00176 #endif
00177 #define       VINTR  0             /* Interrupt character [ISIG].  */
00178 #define       VQUIT  1             /* Quit character [ISIG].  */
00179 #define       VSUSP  10            /* Suspend character [ISIG].  */
00180 #ifdef __USE_BSD
00181 # define VDSUSP      11            /* Delayed suspend character [ISIG].  */
00182 #endif
00183 #define       VSTART 8             /* Start (X-ON) character [IXON, IXOFF].  */
00184 #define       VSTOP  9             /* Stop (X-OFF) character [IXON, IXOFF].  */
00185 #ifdef __USE_BSD
00186 # define VLNEXT      15            /* Literal-next character [IEXTEN].  */
00187 # define VDISCARD 13        /* Discard character [IEXTEN].  */
00188 #endif
00189 #define       VMIN   VEOF          /* Minimum number of bytes read at once [!ICANON].  */
00190 #define       VTIME  VEOL          /* Time-out value (tenths of a second) [!ICANON].  */
00191 #define       NCCS   17
00192   cc_t c_cc[NCCS];
00193 };
00194 
00195 #define _IOT_termios /* Hurd ioctl type field.  */ \
00196   _IOT (_IOTS (cflag_t), 4, _IOTS (cc_t), NCCS, _IOTS (speed_t), 2)
00197 
00198 /* Values for the OPTIONAL_ACTIONS argument to `tcsetattr'.  */
00199 #define       TCSANOW              0      /* Change immediately.  */
00200 #define       TCSADRAIN     1      /* Change when pending output is written.  */
00201 #define       TCSAFLUSH     2      /* Flush pending input before changing.  */
00202 
00203 /* Values for the QUEUE_SELECTOR argument to `tcflush'.  */
00204 #define       TCIFLUSH      0      /* Discard data received but not yet read.  */
00205 #define       TCOFLUSH      1      /* Discard data written but not yet sent.  */
00206 #define       TCIOFLUSH     2      /* Discard all pending data.  */
00207 
00208 /* Values for the ACTION argument to `tcflow'.  */
00209 #define       TCOOFF 0             /* Suspend output.  */
00210 #define       TCOON  1             /* Restart suspended output.  */
00211 #define       TCIOFF 2             /* Send a STOP character.  */
00212 #define       TCION  3             /* Send a START character.  */