home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 9.ddi / usr / include / sys / termios.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  12.4 KB  |  486 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. #ifndef _SYS_TERMIOS_H
  11. #define _SYS_TERMIOS_H
  12.  
  13. #ident    "@(#)/usr/include/sys/termios.h.sl 1.1 4.0 12/08/90 45923 AT&T-USL"
  14.  
  15. #if !defined(_POSIX_SOURCE) 
  16. #include <sys/ttydev.h>
  17. #endif /* !defined(_POSIX_SOURCE) */ 
  18.  
  19. #include <sys/types.h>
  20.  
  21. #ifndef _POSIX_VDISABLE
  22. #define _POSIX_VDISABLE 0 /* Disable special character functions */
  23. #endif
  24.  
  25. #if !defined(_POSIX_SOURCE) 
  26. #define    CTRL(c)    ((c)&037)
  27. #define IBSHIFT 16
  28.  
  29. /* required by termio.h and VCEOF/VCEOL */
  30. #define    NCC    8
  31. #endif /* !defined(_POSIX_SOURCE) */ 
  32.  
  33. /* some defines required by POSIX */
  34. #define    NCCS    19
  35.  
  36. /*
  37.  * types defined by POSIX. These are better off in types.h, but 
  38.  * the standard says that they have to be in termios.h.
  39.  */
  40. typedef unsigned long tcflag_t;
  41. typedef unsigned char cc_t;
  42. typedef unsigned long speed_t;
  43.  
  44. /*
  45.  * Ioctl control packet
  46.  */
  47. struct termios {
  48.     tcflag_t    c_iflag;    /* input modes */
  49.     tcflag_t    c_oflag;    /* output modes */
  50.     tcflag_t    c_cflag;    /* control modes */
  51.     tcflag_t    c_lflag;    /* line discipline modes */
  52.     cc_t        c_cc[NCCS];    /* control chars */
  53. };
  54.  
  55. /* 
  56.  * POSIX termios functions
  57.  * These functions get mapped into ioctls.
  58.  */
  59.  
  60. #ifndef _KERNEL
  61.  
  62. #if defined(__STDC__)
  63.  
  64. extern speed_t cfgetospeed (const struct termios *);
  65. extern int cfsetospeed (struct termios *, speed_t);
  66. extern speed_t cfgetispeed (const struct termios *);
  67. extern int cfsetispeed (struct termios *, speed_t);
  68. extern int tcgetattr (int, struct termios *);
  69. extern int tcsetattr (int, int, const struct termios *);
  70. extern int tcsendbreak (int, int);
  71. extern int tcdrain (int);
  72. extern int tcflush (int, int);
  73. extern int tcflow (int, int);
  74.  
  75. #else
  76.  
  77. extern speed_t cfgetospeed ();
  78. extern int cfsetospeed ();
  79. extern speed_t cfgetispeed ();
  80. extern int cfsetispeed ();
  81. extern int tcgetattr ();
  82. extern int tcsetattr ();
  83. extern int tcsendbreak ();
  84. extern int tcdrain ();
  85. extern int tcflush ();
  86. extern int tcflow ();
  87.  
  88. #endif /* __STDC__ */
  89.  
  90. #if !defined(_POSIX_SOURCE) 
  91.  
  92. #if defined(__STDC__)
  93. extern pid_t tcgetsid (int);
  94. #else
  95. extern pid_t tcgetsid ();
  96. #endif /* __STDC__ */
  97.  
  98. #endif /* !defined(_POSIX_SOURCE) */ 
  99.  
  100. #endif
  101.  
  102. /* control characters */
  103. #define    VINTR    0
  104. #define    VQUIT    1
  105. #define    VERASE    2
  106. #define    VKILL    3
  107. #define    VEOF    4
  108. #define    VEOL    5
  109. #if !defined(_POSIX_SOURCE) 
  110. #define    VEOL2    6
  111. #endif /* !defined(_POSIX_SOURCE) */ 
  112. #define    VMIN    4
  113. #define    VTIME    5
  114. #if !defined(_POSIX_SOURCE) 
  115. #define    VSWTCH    7
  116. #endif /* !defined(_POSIX_SOURCE) */ 
  117. #define    VSTART        8
  118. #define    VSTOP        9
  119. #define    VSUSP        10
  120. #if !defined(_POSIX_SOURCE) 
  121. #define    VDSUSP        11
  122. #define    VREPRINT    12
  123. #define    VDISCARD    13
  124. #define    VWERASE        14
  125. #define    VLNEXT        15
  126. /* 16 thru 19 reserved for future use */
  127.  
  128. /*
  129.  * control characters form Xenix termio.h
  130.  */
  131. #define    VCEOF    NCC        /* RESERVED true EOF char (V7 compatability) */
  132. #define    VCEOL    (NCC + 1)    /* RESERVED true EOL char */
  133.  
  134. #define    CNUL    0
  135. #define    CDEL    0377
  136.  
  137. /* S5 default control chars */
  138. #define    CESC    '\\'
  139. #define    CINTR    0177    /* DEL */
  140. #define    CQUIT    034    /* FS, cntl | */
  141. #define    CERASE    '#'
  142. #define    CKILL    '@'
  143. #define CEOT    04
  144. #define CEOL    0
  145. #define CEOL2    0
  146. #define    CEOF    04    /* cntl d */
  147. #define    CSTART    021    /* cntl q */
  148. #define    CSTOP    023    /* cntl s */
  149. #define    CSWTCH    032    /* cntl z */
  150. #define    CNSWTCH    0
  151. #define    CSUSP    CTRL('z')
  152. #define    CDSUSP    CTRL('y')
  153. #define    CRPRNT    CTRL('r')
  154. #define    CFLUSH    CTRL('o')
  155. #define    CWERASE    CTRL('w')
  156. #define    CLNEXT    CTRL('v')
  157. #endif /* !defined(_POSIX_SOURCE) */ 
  158.  
  159.  
  160. /* input modes */
  161. #define    IGNBRK    0000001
  162. #define    BRKINT    0000002
  163. #define    IGNPAR    0000004
  164. #define    PARMRK    0000010
  165. #define    INPCK    0000020
  166. #define    ISTRIP    0000040
  167. #define    INLCR    0000100
  168. #define    IGNCR    0000200
  169. #define    ICRNL    0000400
  170. #if !defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) 
  171. #define    IUCLC    0001000
  172. #endif /* !defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) */ 
  173. #define    IXON    0002000
  174. #if !defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) 
  175. #define    IXANY    0004000
  176. #endif /* !defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) */ 
  177. #define    IXOFF    0010000
  178. #if !defined(_POSIX_SOURCE) 
  179. #define IMAXBEL 0020000
  180. #define DOSMODE    0100000  /* for 386 compatibility */
  181. #endif /* !defined(_POSIX_SOURCE) */ 
  182.  
  183. /* output modes */
  184. #define    OPOST    0000001
  185. #if !defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) 
  186. #define    OLCUC    0000002
  187. #define    ONLCR    0000004
  188. #define    OCRNL    0000010
  189. #define    ONOCR    0000020
  190. #define    ONLRET    0000040
  191. #define    OFILL    0000100
  192. #define    OFDEL    0000200
  193. #define    NLDLY    0000400
  194. #define    NL0    0
  195. #define    NL1    0000400
  196. #define    CRDLY    0003000
  197. #define    CR0    0
  198. #define    CR1    0001000
  199. #define    CR2    0002000
  200. #define    CR3    0003000
  201. #define    TABDLY    0014000
  202. #define    TAB0    0
  203. #define    TAB1    0004000
  204. #define    TAB2    0010000
  205. #define    TAB3    0014000
  206. #endif /* !defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) */ 
  207. #if !defined(_POSIX_SOURCE) 
  208. #define XTABS    0014000
  209. #endif /* !defined(_POSIX_SOURCE) */ 
  210. #if !defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) 
  211. #define    BSDLY    0020000
  212. #define    BS0    0
  213. #define    BS1    0020000
  214. #define    VTDLY    0040000
  215. #define    VT0    0
  216. #define    VT1    0040000
  217. #define    FFDLY    0100000
  218. #define    FF0    0
  219. #define    FF1    0100000
  220. #endif /* !defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) */ 
  221. #if !defined(_POSIX_SOURCE) 
  222. #define PAGEOUT 0200000
  223. #define WRAP    0400000
  224.  
  225. /* control modes */
  226. #define    CBAUD    0000017
  227. #endif /* !defined(_POSIX_SOURCE) */ 
  228. #define    CSIZE    0000060
  229. #define    CS5    0
  230. #define    CS6    0000020
  231. #define    CS7    0000040
  232. #define    CS8    0000060
  233. #define    CSTOPB    0000100
  234. #define    CREAD    0000200
  235. #define    PARENB    0000400
  236. #define    PARODD    0001000
  237. #define    HUPCL    0002000
  238. #define    CLOCAL    0004000
  239. #if !defined(_POSIX_SOURCE) 
  240. #define RCV1EN    0010000
  241. #define    XMT1EN    0020000
  242. #define    LOBLK    0040000
  243. #define    XCLUDE    0100000        /* *V7* exclusive use coming fron XENIX */
  244. #define CIBAUD    03600000
  245. #define PAREXT    04000000
  246. #endif /* !defined(_POSIX_SOURCE) */ 
  247.  
  248. /* line discipline 0 modes */
  249. #define    ISIG    0000001
  250. #define    ICANON    0000002
  251. #if !defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) 
  252. #define    XCASE    0000004
  253. #endif /* !defined(_POSIX_SOURCE) || defined(_XOPEN_SOURCE) */ 
  254. #define    ECHO    0000010
  255. #define    ECHOE    0000020
  256. #define    ECHOK    0000040
  257. #define    ECHONL    0000100
  258. #define    NOFLSH    0000200
  259. #define    TOSTOP    0000400
  260. #if !defined(_POSIX_SOURCE) 
  261. #define    ECHOCTL    0001000
  262. #define    ECHOPRT    0002000
  263. #define    ECHOKE    0004000
  264. #define    DEFECHO    0010000
  265. #define    FLUSHO    0020000
  266. #define    PENDIN    0040000
  267. #endif /* !defined(_POSIX_SOURCE) */ 
  268. #define    IEXTEN    0100000  /* POSIX flag - enable POSIX extensions */
  269.  
  270. #if !defined(_POSIX_SOURCE) 
  271. #define    TIOC    ('T'<<8)
  272.  
  273. #define    TCGETA    (TIOC|1)
  274. #define    TCSETA    (TIOC|2)
  275. #define    TCSETAW    (TIOC|3)
  276. #define    TCSETAF    (TIOC|4)
  277. #define    TCSBRK    (TIOC|5)
  278. #define    TCXONC    (TIOC|6)
  279. #define    TCFLSH    (TIOC|7)
  280.  
  281. /* Slots reserved for 386/XENIX compatibility - keyboard control */
  282.  
  283. #ifndef _KB_386 /* These are also defined in kd.h   */
  284. #define _KB_386
  285. #define TIOCKBON    (TIOC|8)
  286. #define TIOCKBOF     (TIOC|9)
  287. #define KBENABLED     (TIOC|10)
  288. #endif  /* _KB_386 */
  289.  
  290. #ifndef IOCTYPE
  291. #define    IOCTYPE    0xff00
  292. #endif
  293.  
  294. #define    TCDSET    (TIOC|32)
  295. #define    RTS_TOG    (TIOC|33)    /* 386 - "RTS" toggle define 8A1 protocol */
  296.  
  297.  
  298. /* MERGE386 scancode input flag bits */
  299. #define KB_RESERVED1    1
  300. #define KB_RESERVED2    2
  301. #define KB_XSCANCODE    4   /* Translate scancode to ascii */
  302. #define KB_ISSCANCODE   8   /* TTY sends scancodes */
  303. /* OBSOLETE MERGE386 DEFINES -- HERE JUST INCASE FILES ACCESS THEM */
  304.  
  305.  
  306. #define TIOCGWINSZ (TIOC|104)
  307. #define TIOCSWINSZ (TIOC|103)
  308.  
  309.  
  310. /* termios ioctls */
  311.  
  312. #define TCGETS        (TIOC|13)
  313. #define TCSETS        (TIOC|14)
  314. #endif /* !defined(_POSIX_SOURCE) */ 
  315. #define TCSANOW        (('T'<<8)|14) /* same as TCSETS */
  316. #if !defined(_POSIX_SOURCE) 
  317. #define TCSETSW        (TIOC|15)
  318. #endif /* !defined(_POSIX_SOURCE) */ 
  319. #define TCSADRAIN    (('T'<<8)|15) /* same as TCSETSW */
  320. #if !defined(_POSIX_SOURCE) 
  321. #define    TCSETSF        (TIOC|16)
  322. #endif /* !defined(_POSIX_SOURCE) */ 
  323. #define    TCSAFLUSH    (('T'<<8)|16) /* same as TCSETSF */
  324.  
  325. /* termios option flags */
  326.  
  327. #define TCIFLUSH    0  /* flush data received but not read */
  328. #define TCOFLUSH    1  /* flush data written but not transmitted */
  329. #define TCIOFLUSH    2  /* flush both data both input and output queues */    
  330.  
  331. #define TCOOFF        0  /* suspend output */
  332. #define TCOON        1  /* restart suspended output */
  333. #define TCIOFF        2  /* suspend input */
  334. #define TCION        3  /* restart suspended input */
  335.  
  336. /* TIOC ioctls for BSD, ptys, job control and modem control */
  337.  
  338. #if !defined(_POSIX_SOURCE) 
  339. #define    tIOC    ('t'<<8)
  340. #endif /* !defined(_POSIX_SOURCE) */ 
  341.  
  342.  
  343. /* Slots for 386/XENIX compatibility */
  344. /* BSD includes these ioctls in ttold.h */
  345.  
  346. #ifndef _SYS_TTOLD_H
  347.  
  348. #if !defined(_POSIX_SOURCE) 
  349. #define TIOCGETD    (tIOC|0)
  350. #define TIOCSETD    (tIOC|1)
  351. #define TIOCHPCL    (tIOC|2)
  352. #define TIOCGETP    (tIOC|8)
  353. #define TIOCSETP      (tIOC|9)
  354. #define TIOCSETN    (tIOC|10)
  355. #define TIOCEXCL    (tIOC|13)
  356. #define TIOCNXCL    (tIOC|14)
  357. #define TIOCFLUSH    (tIOC|16)
  358. #define TIOCSETC    (tIOC|17)
  359. #define TIOCGETC    (tIOC|18)
  360. /*
  361.  * BSD ioctls that are not the same as XENIX are included here.
  362.  * There are also some relevant ioctls from SUN/BSD sys/ttycom.h
  363.  * BSD pty ioctls like TIOCPKT are not supported in SVR4.
  364.  */
  365.  
  366. #define    TIOCLBIS    (tIOC|127)    /* bis local mode bits */
  367. #define    TIOCLBIC    (tIOC|126)    /* bic local mode bits */
  368. #define    TIOCLSET    (tIOC|125)    /* set entire local mode word */
  369. #define    TIOCLGET    (tIOC|124)    /* get local modes */
  370. #define    TIOCSBRK    (tIOC|123)    /* set break bit */
  371. #define    TIOCCBRK    (tIOC|122)    /* clear break bit */
  372. #define    TIOCSDTR    (tIOC|121)    /* set data terminal ready */
  373. #define    TIOCCDTR    (tIOC|120)    /* clear data terminal ready */
  374. #define    TIOCSLTC    (tIOC|117)    /* set local special chars */
  375. #define    TIOCGLTC    (tIOC|116)    /* get local special chars */
  376. #define    TIOCOUTQ    (tIOC|115)    /* driver output queue size */
  377. #define    TIOCNOTTY    (tIOC|113)    /* void tty association */
  378. #define    TIOCSTOP    (tIOC|111)    /* stop output, like ^S */
  379. #define    TIOCSTART    (tIOC|110)    /* start output, like ^Q */
  380. #endif /* !defined(_POSIX_SOURCE) */ 
  381.  
  382. #endif /* end _SYS_TTOLD_H */
  383.  
  384. /* POSIX job control ioctls */
  385.  
  386. #if !defined(_POSIX_SOURCE) 
  387. #define    TIOCGPGRP    (tIOC|20)    /* get pgrp of tty */
  388. #define    TIOCSPGRP    (tIOC|21)    /* set pgrp of tty */
  389. #define    TIOCGSID    (tIOC|22)    /* get session id on ctty*/
  390. #define    TIOCSSID    (tIOC|24)    /* set session id on ctty*/
  391.  
  392. /* Miscellanous */
  393. #define    TIOCSTI        (tIOC|23)    /* simulate terminal input */
  394.  
  395. /* Modem control */
  396. #define    TIOCMSET    (tIOC|26)    /* set all modem bits */
  397. #define    TIOCMBIS    (tIOC|27)    /* bis modem bits */
  398. #define    TIOCMBIC    (tIOC|28)    /* bic modem bits */
  399. #define    TIOCMGET    (tIOC|29)    /* get all modem bits */
  400. #define        TIOCM_LE    0001        /* line enable */
  401. #define        TIOCM_DTR    0002        /* data terminal ready */
  402. #define        TIOCM_RTS    0004        /* request to send */
  403. #define        TIOCM_ST    0010        /* secondary transmit */
  404. #define        TIOCM_SR    0020        /* secondary receive */
  405. #define        TIOCM_CTS    0040        /* clear to send */
  406. #define        TIOCM_CAR    0100        /* carrier detect */
  407. #define        TIOCM_CD    TIOCM_CAR
  408. #define        TIOCM_RNG    0200        /* ring */
  409. #define        TIOCM_RI    TIOCM_RNG
  410. #define        TIOCM_DSR    0400        /* data set ready */
  411.  
  412. /* pseudo-tty */
  413.  
  414. #define    TIOCREMOTE    (tIOC|30)    /* remote input editing */
  415. #define TIOCSIGNAL    (tIOC|31)    /* pty: send signal to slave */
  416.  
  417.  
  418. /* Some more 386 xenix stuff */
  419.  
  420. #define    LDIOC    ('D'<<8)
  421.  
  422. #define    LDOPEN    (LDIOC|0)
  423. #define    LDCLOSE    (LDIOC|1)
  424. #define    LDCHG    (LDIOC|2)
  425. #define    LDGETT    (LDIOC|8)
  426. #define    LDSETT    (LDIOC|9)
  427.  
  428. /* Slots for 386 compatibility */
  429.  
  430. #define    LDSMAP        (LDIOC|10)
  431. #define    LDGMAP        (LDIOC|11)
  432. #define    LDNMAP        (LDIOC|12)
  433.  
  434. /*
  435.  * These are retained for 386/XENIX compatibility.
  436.  */
  437.  
  438. #define    DIOC    ('d'<<8)
  439. #define DIOCGETP        (DIOC|8)                /* V7 */
  440. #define DIOCSETP        (DIOC|9)                /* V7 */
  441.  
  442. /*
  443.  * Returns a non-zero value if there
  444.  * are characters in the input queue.
  445.  */
  446. #define FIORDCHK        (('f'<<8)|3)            /* V7 */
  447. #endif /* !defined(_POSIX_SOURCE) */ 
  448.  
  449. /*
  450.  * Speeds
  451.  */
  452. #define B0    0
  453. #define B50    1
  454. #define B75    2
  455. #define B110    3
  456. #define B134    4
  457. #define B150    5
  458. #define B200    6
  459. #define B300    7
  460. #define B600    8
  461. #define B1200    9
  462. #define    B1800    10
  463. #define B2400    11
  464. #define B4800    12
  465. #define B9600    13
  466. #define B19200    14
  467. #define B38400    15
  468.  
  469. #ifndef _SYS_TTOLD_H
  470. #ifndef _SYS_PTEM_H
  471.  
  472. #if !defined(_POSIX_SOURCE) 
  473. /* Windowing structure to support JWINSIZE/TIOCSWINSZ/TIOCGWINSZ */
  474. struct winsize {
  475.     unsigned short ws_row;       /* rows, in characters*/
  476.     unsigned short ws_col;       /* columns, in character */
  477.     unsigned short ws_xpixel;    /* horizontal size, pixels */
  478.     unsigned short ws_ypixel;    /* vertical size, pixels */
  479. };
  480. #endif /* !defined(_POSIX_SOURCE) */ 
  481.  
  482. #endif /* end _SYS_PTEM_H */
  483. #endif /* end _SYS_TTOLD_H */
  484.  
  485. #endif    /* _SYS_TERMIOS_H */
  486.