home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / amiga / os / bsdss4.tz / bsdss4 / bsdss / server / sys / termios.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-22  |  9.6 KB  |  307 lines

  1. /* 
  2.  * Mach Operating System
  3.  * Copyright (c) 1992 Carnegie Mellon University
  4.  * All Rights Reserved.
  5.  * 
  6.  * Permission to use, copy, modify and distribute this software and its
  7.  * documentation is hereby granted, provided that both the copyright
  8.  * notice and this permission notice appear in all copies of the
  9.  * software, derivative works or modified versions, and any portions
  10.  * thereof, and that both notices appear in supporting documentation.
  11.  * 
  12.  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
  13.  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
  14.  * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  15.  * 
  16.  * Carnegie Mellon requests users of this software to return to
  17.  * 
  18.  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
  19.  *  School of Computer Science
  20.  *  Carnegie Mellon University
  21.  *  Pittsburgh PA 15213-3890
  22.  * 
  23.  * any improvements or extensions that they make and grant Carnegie Mellon 
  24.  * the rights to redistribute these changes.
  25.  */
  26. /*
  27.  * HISTORY
  28.  * $Log:    termios.h,v $
  29.  * Revision 2.1  92/04/21  17:17:02  rwd
  30.  * BSDSS
  31.  * 
  32.  *
  33.  */
  34.  
  35. /*
  36.  * Copyright (c) 1988, 1989 The Regents of the University of California.
  37.  * All rights reserved.
  38.  *
  39.  * Redistribution and use in source and binary forms, with or without
  40.  * modification, are permitted provided that the following conditions
  41.  * are met:
  42.  * 1. Redistributions of source code must retain the above copyright
  43.  *    notice, this list of conditions and the following disclaimer.
  44.  * 2. Redistributions in binary form must reproduce the above copyright
  45.  *    notice, this list of conditions and the following disclaimer in the
  46.  *    documentation and/or other materials provided with the distribution.
  47.  * 3. All advertising materials mentioning features or use of this software
  48.  *    must display the following acknowledgement:
  49.  *    This product includes software developed by the University of
  50.  *    California, Berkeley and its contributors.
  51.  * 4. Neither the name of the University nor the names of its contributors
  52.  *    may be used to endorse or promote products derived from this software
  53.  *    without specific prior written permission.
  54.  *
  55.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  56.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  57.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  58.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  59.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  60.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  61.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  62.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  63.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  64.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  65.  * SUCH DAMAGE.
  66.  *
  67.  *    @(#)termios.h    7.22 (Berkeley) 5/7/91
  68.  */
  69.  
  70. /*
  71.  *  termios structure
  72.  */
  73. #ifndef _TERMIOS_H_
  74. #define _TERMIOS_H_
  75.  
  76. /* 
  77.  * Special Control Characters 
  78.  *
  79.  * Index into c_cc[] character array.
  80.  *
  81.  *    Name         Subscript    Enabled by 
  82.  */
  83. #define    VEOF        0    /* ICANON */
  84. #define    VEOL        1    /* ICANON */
  85. #ifndef _POSIX_SOURCE
  86. #define    VEOL2        2    /* ICANON */
  87. #endif
  88. #define    VERASE        3    /* ICANON */
  89. #ifndef _POSIX_SOURCE
  90. #define VWERASE     4    /* ICANON */
  91. #endif 
  92. #define VKILL        5    /* ICANON */
  93. #ifndef _POSIX_SOURCE
  94. #define    VREPRINT     6    /* ICANON */
  95. #endif
  96. /*            7       spare 1 */
  97. #define VINTR        8    /* ISIG */
  98. #define VQUIT        9    /* ISIG */
  99. #define VSUSP        10    /* ISIG */
  100. #ifndef _POSIX_SOURCE
  101. #define VDSUSP        11    /* ISIG */
  102. #endif
  103. #define VSTART        12    /* IXON, IXOFF */
  104. #define VSTOP        13    /* IXON, IXOFF */
  105. #ifndef _POSIX_SOURCE
  106. #define    VLNEXT        14    /* IEXTEN */
  107. #define    VDISCARD    15    /* IEXTEN */
  108. #endif
  109. #define VMIN        16    /* !ICANON */
  110. #define VTIME        17    /* !ICANON */
  111. #ifndef _POSIX_SOURCE
  112. #define VSTATUS        18    /* ICANON */
  113. /*            19       spare 2 */
  114. #define    NCCS        20
  115. #endif
  116.  
  117. #define _POSIX_VDISABLE    ((unsigned char)'\377')
  118.  
  119. #ifndef _POSIX_SOURCE
  120. #define CCEQ(val, c)    (c == val ? val != _POSIX_VDISABLE : 0)
  121. #endif
  122.  
  123. /*
  124.  * Input flags - software input processing
  125.  */
  126. #define    IGNBRK        0x00000001    /* ignore BREAK condition */
  127. #define    BRKINT        0x00000002    /* map BREAK to SIGINTR */
  128. #define    IGNPAR        0x00000004    /* ignore (discard) parity errors */
  129. #define    PARMRK        0x00000008    /* mark parity and framing errors */
  130. #define    INPCK        0x00000010    /* enable checking of parity errors */
  131. #define    ISTRIP        0x00000020    /* strip 8th bit off chars */
  132. #define    INLCR        0x00000040    /* map NL into CR */
  133. #define    IGNCR        0x00000080    /* ignore CR */
  134. #define    ICRNL        0x00000100    /* map CR to NL (ala CRMOD) */
  135. #define    IXON        0x00000200    /* enable output flow control */
  136. #define    IXOFF        0x00000400    /* enable input flow control */
  137. #ifndef _POSIX_SOURCE
  138. #define    IXANY        0x00000800    /* any char will restart after stop */
  139. #define IMAXBEL        0x00002000    /* ring bell on input queue full */
  140. #endif  /*_POSIX_SOURCE */
  141.  
  142. /*
  143.  * Output flags - software output processing
  144.  */
  145. #define    OPOST        0x00000001    /* enable following output processing */
  146. #ifndef _POSIX_SOURCE
  147. #define ONLCR        0x00000002    /* map NL to CR-NL (ala CRMOD) */
  148. #define OXTABS        0x00000004    /* expand tabs to spaces */
  149. #define ONOEOT        0x00000008    /* discard EOT's (^D) on output) */
  150. #endif  /*_POSIX_SOURCE */
  151.  
  152. /*
  153.  * Control flags - hardware control of terminal
  154.  */
  155. #ifndef _POSIX_SOURCE
  156. #define    CIGNORE        0x00000001    /* ignore control flags */
  157. #endif
  158. #define CSIZE        0x00000300    /* character size mask */
  159. #define     CS5            0x00000000        /* 5 bits (pseudo) */
  160. #define     CS6            0x00000100        /* 6 bits */
  161. #define     CS7            0x00000200        /* 7 bits */
  162. #define     CS8            0x00000300        /* 8 bits */
  163. #define CSTOPB        0x00000400    /* send 2 stop bits */
  164. #define CREAD        0x00000800    /* enable receiver */
  165. #define PARENB        0x00001000    /* parity enable */
  166. #define PARODD        0x00002000    /* odd parity, else even */
  167. #define HUPCL        0x00004000    /* hang up on last close */
  168. #define CLOCAL        0x00008000    /* ignore modem status lines */
  169. #ifndef _POSIX_SOURCE
  170. #define CCTS_OFLOW    0x00010000    /* CTS flow control of output */
  171. #define CRTSCTS        CCTS_OFLOW    /* ??? */
  172. #define CRTS_IFLOW    0x00020000    /* RTS flow control of input */
  173. #define    MDMBUF        0x00100000    /* flow control output via Carrier */
  174. #endif
  175.  
  176.  
  177. /* 
  178.  * "Local" flags - dumping ground for other state
  179.  *
  180.  * Warning: some flags in this structure begin with
  181.  * the letter "I" and look like they belong in the
  182.  * input flag.
  183.  */
  184.  
  185. #ifndef _POSIX_SOURCE
  186. #define    ECHOKE        0x00000001    /* visual erase for line kill */
  187. #endif  /*_POSIX_SOURCE */
  188. #define    ECHOE        0x00000002    /* visually erase chars */
  189. #define    ECHOK        0x00000004    /* echo NL after line kill */
  190. #define ECHO        0x00000008    /* enable echoing */
  191. #define    ECHONL        0x00000010    /* echo NL even if ECHO is off */
  192. #ifndef _POSIX_SOURCE
  193. #define    ECHOPRT        0x00000020    /* visual erase mode for hardcopy */
  194. #define ECHOCTL      0x00000040    /* echo control chars as ^(Char) */
  195. #endif  /*_POSIX_SOURCE */
  196. #define    ISIG        0x00000080    /* enable signals INTR, QUIT, [D]SUSP */
  197. #define    ICANON        0x00000100    /* canonicalize input lines */
  198. #ifndef _POSIX_SOURCE
  199. #define ALTWERASE    0x00000200    /* use alternate WERASE algorithm */
  200. #endif  /*_POSIX_SOURCE */
  201. #define    IEXTEN        0x00000400    /* enable DISCARD and LNEXT */
  202. #define EXTPROC         0x00000800      /* external processing */
  203. #define TOSTOP        0x00400000    /* stop background jobs from output */
  204. #ifndef _POSIX_SOURCE
  205. #define FLUSHO        0x00800000    /* output being flushed (state) */
  206. #define    NOKERNINFO    0x02000000    /* no kernel output from VSTATUS */
  207. #define PENDIN        0x20000000    /* XXX retype pending input (state) */
  208. #endif  /*_POSIX_SOURCE */
  209. #define    NOFLSH        0x80000000    /* don't flush after interrupt */
  210.  
  211. typedef unsigned long    tcflag_t;
  212. typedef unsigned char    cc_t;
  213. typedef long        speed_t;
  214.  
  215. struct termios {
  216.     tcflag_t    c_iflag;    /* input flags */
  217.     tcflag_t    c_oflag;    /* output flags */
  218.     tcflag_t    c_cflag;    /* control flags */
  219.     tcflag_t    c_lflag;    /* local flags */
  220.     cc_t        c_cc[NCCS];    /* control chars */
  221.     long        c_ispeed;    /* input speed */
  222.     long        c_ospeed;    /* output speed */
  223. };
  224.  
  225. /* 
  226.  * Commands passed to tcsetattr() for setting the termios structure.
  227.  */
  228. #define    TCSANOW        0        /* make change immediate */
  229. #define    TCSADRAIN    1        /* drain output, then change */
  230. #define    TCSAFLUSH    2        /* drain output, flush input */
  231. #ifndef _POSIX_SOURCE
  232. #define TCSASOFT    0x10        /* flag - don't alter h.w. state */
  233. #endif
  234.  
  235. /*
  236.  * Standard speeds
  237.  */
  238. #include <device/tty_status.h>
  239.  
  240. #if 0
  241. #define B0    0
  242. #define B50    50
  243. #define B75    75
  244. #define B110    110
  245. #define B134    134
  246. #define B150    150
  247. #define B200    200
  248. #define B300    300
  249. #define B600    600
  250. #define B1200    1200
  251. #define    B1800    1800
  252. #define B2400    2400
  253. #define B4800    4800
  254. #define B9600    9600
  255. #define B19200    19200
  256. #define B38400    38400
  257. #ifndef _POSIX_SOURCE
  258. #define EXTA    19200
  259. #define EXTB    38400
  260. #endif  /*_POSIX_SOURCE */
  261. #endif 0
  262.  
  263. #ifndef KERNEL
  264.  
  265. #include <sys/cdefs.h>
  266.  
  267. __BEGIN_DECLS
  268. speed_t    cfgetispeed __P((const struct termios *));
  269. speed_t    cfgetospeed __P((const struct termios *));
  270. int    cfsetispeed __P((struct termios *, speed_t));
  271. int    cfsetospeed __P((struct termios *, speed_t));
  272. int    tcdrain __P((int));
  273. int    tcflow __P((int, int));
  274. int    tcflush __P((int, int));
  275. int    tcgetattr __P((int, struct termios *));
  276. int    tcsendbreak __P((int, int));
  277. int    tcsetattr __P((int, int, const struct termios *));
  278.  
  279. #define    TCIFLUSH    1
  280. #define    TCOFLUSH    2
  281. #define TCIOFLUSH    3
  282. #define    TCOOFF        1
  283. #define    TCOON        2
  284. #define TCIOFF        3
  285. #define TCION        4
  286.  
  287. #ifndef _POSIX_SOURCE
  288. void    cfmakeraw __P((struct termios *));
  289. void    cfsetspeed __P((struct termios *, speed_t));
  290. #endif /* !POSIX */
  291. __END_DECLS
  292.  
  293. #endif /* !KERNEL */
  294.  
  295. /*
  296.  * END OF PROTECTED INCLUDE.
  297.  */
  298. #endif /* !_TERMIOS_H_ */
  299.  
  300. #ifndef _POSIX_SOURCE
  301. #ifdef KERNEL
  302. #include <sys/ttydefaults.h>
  303. #else
  304. #include <sys/ttydefaults.h>
  305. #endif
  306. #endif  /*_POSIX_SOURCE */
  307.